4

Maybe this is a simple question. But how do I use the pagenumber in parallel pages text typesetted with eledpar? Using \thepage yields always page number 1, see this MWE:

\documentclass{scrartcl} 
\usepackage{lipsum,eledmac,eledpar}

\begin{document}

\begin{pages}

\begin{Leftside}
    \beginnumbering

    \pstart
    \textbf{Here page \thepage. }
    \lipsum[1]
    \pend

    \pstart
    \textbf{Here page \thepage. }
    \lipsum[2]
    \pend

    \pstart
    \textbf{Here page \thepage.}
    \lipsum[3]
    \pend

    \pstart
    \textbf{Here page \thepage. }
    \lipsum[4]
    \pend

    \pstart
    \textbf{Here page \thepage. }
    \lipsum[5]
    \pend

    \pstart
    \textbf{Here page \thepage. }
    \lipsum[6]
    \pend

    \pstart
    \textbf{Here page \thepage.}
    \lipsum[7]
    \pend

    \pstart
    \textbf{Here page \thepage.}
    \lipsum[8]
    \pend

    \endnumbering
\end{Leftside}

\begin{Rightside}
    \beginnumbering
    \pstart Test \pend
    \pstart Test \pend
    \pstart Test \pend
    \pstart Test \pend
    \pstart Test \pend
    \pstart Test \pend
    \pstart Test \pend
    \pstart Test \pend
    \endnumbering
\end{Rightside}

\end{pages}
\Pages

\end{document}
3

This has nothing to do with eledmac/eledpar, but rather with the fact that page numbers are stepped when pages are shipped out; until then, the value of \thepage will not change.

You have to use the \pageref mechanism:

\documentclass{scrartcl} 
\usepackage{lipsum,eledmac,eledpar}

\newcounter{thispage}
\renewcommand{\thethispage}{\romannumeral\value{thispage}}
\newcommand{\thispage}{%
  \refstepcounter{thispage}\label{THISPAGE@\thethispage}%
  \pageref{THISPAGE@\thethispage}%
}

\begin{document}

\begin{pages}

\begin{Leftside}
    \beginnumbering

    \pstart
    \textbf{Here page \thispage. }
    \lipsum[1]
    \pend

    \pstart
    \textbf{Here page \thispage. }
    \lipsum[2]
    \pend

    \pstart
    \textbf{Here page \thispage.}
    \lipsum[3]
    \pend

    \pstart
    \textbf{Here page \thispage. }
    \lipsum[4]
    \pend

    \pstart
    \textbf{Here page \thispage. }
    \lipsum[5]
    \pend

    \pstart
    \textbf{Here page \thispage. }
    \lipsum[6]
    \pend

    \pstart
    \textbf{Here page \thispage.}
    \lipsum[7]
    \pend

    \pstart
    \textbf{Here page \thispage.}
    \lipsum[8]
    \pend

    \endnumbering
\end{Leftside}

\begin{Rightside}
    \beginnumbering
    \pstart Test \pend
    \pstart Test \pend
    \pstart Test \pend
    \pstart Test \pend
    \pstart Test \pend
    \pstart Test \pend
    \pstart Test \pend
    \pstart Test \pend
    \endnumbering
\end{Rightside}

\end{pages}
\Pages

\end{document}

The command \thispage generates automatically a label and then refers to it for getting the correct page number. This of course requires multiple passes in order to converge (as usual with cross references).

Here's the start of page 4

enter image description here

  • in the specific case, that is something to do with eledpar: the pages are not shiped out when \pstart is called, but when the \pstart...\pend paragraph is called, but when the \Pages is called. – Maïeul Mar 24 '15 at 15:55
  • in general @LaTechneuse thinks one think about counter and macro value with eledpar: when you have problem, is it in many case because of the difference between the call of a pstart and the print of it. – Maïeul Mar 24 '15 at 15:56
  • @Maïeul It's the same problem anyway; \thepage is not guaranteed to expand to the correct page number unless at the explicit start of a new page. – egreg Mar 24 '15 at 16:03
  • yes, but in the case of eledpar, we are sur that it can't. In many case, \thepage expanded the good way... – Maïeul Mar 24 '15 at 16:09
  • Yes, thank you both. Indeed I needed to understand that with eledpar, call of \pstart is separate from printing of \pstart – LaTechneuse Mar 24 '15 at 16:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.