2

I am new to using the paracol package and while I have learnt the basics of the package I am stuck on the following. Here is a MWE.

\documentclass[11pt]{article}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{amsthm}
\usepackage{polyglossia}
\usepackage{metalogo}
\usepackage{fontspec}
\newfontfamily\greekfont[Script=Greek]{GFS Neohellenic}
\setdefaultlanguage{greek}

%set gfsartemisia as main font
\usepackage{gfsartemisia}


%load hyperref package to enable links
\usepackage{hyperref}


%switch effortlessly between 1 column and 2 column document
\usepackage{paracol}
\setlength{\columnseprule}{1pt}

%define custom environment for exercises

\def\UrlFont{\ttfamily}

% Counter for exercises
\newcounter{exercise}

% Define the environment with 3 optional arguments:
% #1 = proposer
% #2 = url
% #3 = post-body (e.g., a hyperlink to the solution)
\NewDocumentEnvironment{exercise}{O{} O{} O{}}
{
    \refstepcounter{exercise}%
    \par\medskip
    \noindent\textbf{Exercise \theexercise}%
    \IfNoValueF{#1}{\ \textit{(Proposed by #1)}}%
    %\IfNoValueF{#3}{\ \textnormal{ #3}}%
    \par\medskip
    \begingroup
    \setlength{\parindent}{0pt}%
    \itshape
}
{
    \par\medskip
    \normalfont
    \IfNoValueF{#2}{\noindent\textbf{Link:} \raggedright \href{#2}{#3}\par}
    \medskip
    \endgroup
}


\begin{document}
    
    \begin{paracol}{2}
        
        \begin{exercise}[George][www.domain.com][www.domain.com]
            
            Here is the first exercise
            
        \end{exercise}
        
        \switchcolumn
        
        \begin{exercise}[John Doe][www.domain2.com][www.domain2.com]
            This is the second exercise
        \end{exercise}
        
    \end{paracol}
    
\end{document}

So the problem is when I switch columns the \begin{exercise} does not auto increment but resets back to 1 as can be seen below.

enter image description here\

I can force a change by using the \stepcounter{exercise} command but I would like something more automated.

1 Answer 1

4

The issue is similar to Scope of counters in paracol environment and Figure counter is not incrementing after use of paracol. It can be solved by placing \globalcounter{exercise} after \usepackage{paracol}.

1
  • 2
    This did the trick. I should have asked earlier because I spent the whole day yesterday coming up this possible solutions ... that did not work.
    – Tolaso
    Commented Jul 27 at 13:14

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.