# Reledmac/reledpar: problem with endnote verse line numbers referring to multiple lines

The question is related to this one. The problem of the error with footnotes referring to multiple verse lines is resolved by a workaround, but when several endnotes are used, line numbers do not seem to be correct, even after several runs:

\documentclass{article}

\usepackage[series={A},noledgroup,nofamiliar]{reledmac}
\usepackage{reledpar}
\setstanzaindents{12,0}
\setcounter{stanzaindentsrepetition}{1}

\begin{document}

\begin{pages}
\begin{Leftside}
\beginnumbering
\begin{astanza}

First line text. \edtext{An interesting}{%
\lemma{An interesting Phrase}%
\xxref{begin}{end}%
\Aendnote{Comment on lines 1-2.}%
}\edlabel{begin}&
\edlabel{end}Phrase. Second line text.&
Third line text. \edtext{An interesting}{%
\lemma{An interesting Phrase}%
\xxref{begin}{end}%
\Aendnote{Comment on lines 3-4.}%
}\edlabel{begin}&
\edlabel{end}Phrase. Fourth line text.\&

\end{astanza}
\endnumbering
\end{Leftside}

\begin{Rightside}
\beginnumbering
\pstart

Right-hand side...Right-hand side...Right-hand side...\edtext{Right-hand side...Right-hand side...Right-hand side}{\Afootnote{SNCF}}...Right-hand side...Right-hand side...Right-hand side...Right-hand side...

\pend
\endnumbering
\end{Rightside}
\end{pages}
\Pages

\doendnotes{A}

\end{document}


You didn't understand how to use \xxref. If you change endnote to footnote, you see you get the same problem :)

\xxref is used to change line number in foot/endnote. The first argument is the name of a label placed on the first line, the second argument is the name of a label placed on the last line.

You have placed two times a begin label and a \end label. So only the last one of the two is used to determine line number.

Both reledmac and LaTeX told you that you have a problem with yours label. In the compilation message/log file, you can read

Package reledmac Warning: Duplicate definition of label begin'.

LaTeX Warning: Label begin' multiply defined.

Package reledmac Warning: Duplicate definition of label end'.

LaTeX Warning: Label end' multiply defined.


Here a example which will get you the good result

\documentclass{article}

\usepackage[series={A},noledgroup,nofamiliar]{reledmac}
\usepackage{reledpar}
\setstanzaindents{12,0}
\setcounter{stanzaindentsrepetition}{1}

\begin{document}

\begin{pages}
\begin{Leftside}
\beginnumbering
\begin{astanza}

First line text. \edtext{An interesting}{%
\lemma{An interesting Phrase}%
\xxref{begin1}{end1}%
\Aendnote{Comment on lines 1-2.}%
}\edlabel{begin1}&
\edlabel{end1}Phrase. Second line text.&
Third line text. \edtext{An interesting}{%
\lemma{An interesting Phrase}%
\xxref{begin2}{end2}%
\Aendnote{Comment on lines 3-4.}%
}\edlabel{begin2}&
\edlabel{end2}Phrase. Fourth line text.\&

\end{astanza}
\endnumbering
\end{Leftside}

\begin{Rightside}
\beginnumbering
\pstart

Right-hand side...Right-hand side...Right-hand side...\edtext{Right-hand side...Right-hand side...Right-hand side}{\Afootnote{SNCF}}...Right-hand side...Right-hand side...Right-hand side...Right-hand side...

\pend
\endnumbering
\end{Rightside}
\end{pages}
\Pages

\doendnotes{A}

\end{document}


May I suggest you to use latexmk :

• As reledmac/reledpar can need many run, you will be sur to runs the good number of time.
• At the end of latexmk, you get a summary of the label problem (and also of some other potential problem, for example citekey problems)
• Exactly; I expected a sort of counter reset after each use. Many thanks! – Simon Oct 24 '17 at 21:52
• It won't be possible, as you may have edtext referring to overlapping lemma. – Maïeul Oct 25 '17 at 8:33