Closed marquinho78 closed 3 years ago
Well, indeed, I didn't implement this feature. That is because that implies to differ the time we put the hypertarget.
I am looking on it.
Please try branch issue929
Thanks a lot for your time and your work, Maïeul! On the one hand, the new branch is very satisfactory, in that it solves the hyperlink issue completely. Now the links point to the expected hypertarget. Great!
On the other hand, it seems to introduce a new (but small) problem:
If the document contains two or more \edtext
s that are not identified via an explicitly stated \applabel
, then the program assigns them an identifier automatically. But then it throws a warning in the log for each \edtext
.
The problem wasn't evident in my previous MWE, because in it, every \edtext
had an explicit \applabel
.
You will find a MWE below.
This is the warning:
pdfTeX warning (ext4): destination with the same identifier
(name{\\applabel@thisedtext@1\040:end})
has been already used, duplicate ignored
The issue might have to do with the way that applabel@thisedtext@\the\@edtext@level
is defined, i.e. with the value of \@edtext@level
. Because every warning contains an identifier ending in 1\040:end
.
Now, this issue doesn't change the result.
The "important" \edtext
s, the ones we want to reference, are fine, because each of them does get its very own \applabel
. So whenever we make a reference, the numbers and the hypertarget are good.
But the program still throws lots of warnings (and in our real-life document we're already in the thousands :) ).
So even if the issue is a hard one to fix, it might be enough to just "mute" the warning, because the error itself is inconsequential!
MWE
\documentclass{article}
\usepackage[series={A},nofamiliar,noeledsec]{reledmac}
\begin{document}
\beginnumbering
\pstart
\edtext{No warnings in the \texttt{.log} so far, even if this \texttt{edtext} doesn't have an \texttt{applabel}, because it is the first note in the document.}{%
% no applabel here!
\Afootnote{%
No problem}}
\pend
\pstart
\edtext{No warnings in the \texttt{.log} so far, because this note and the following have been explicitly labeled via \texttt{applabel}.}{%
\applabel{no-problem-1}%
\Afootnote{%
No problem}}
%
\edtext{Ditto.}{%
\applabel{no-problem-2}%
\Afootnote{%
No problem}}
\pend
\pstart
\edtext{But as soon as there is a second \texttt{edtext} in the document without an explicit \texttt{applabel}, the program throws a warning in the \texttt{.log}.}{%
% no applabel here!
\Aendnote{%
Warnings in the log!}}
%
\edtext{(It doesn't matter if a footnote or an endnote is appended to it.)}{%
% no applabel here!
\Afootnote{%
Warnings in the log!}}
\pend
\endnumbering
\end{document}
Please try new version of the branch.
Tested it each and every way and it works perfectly. Thanks a lot!
works fine
Version
reledmac 2021/09/27 v2.38.1.
TeX Engine
Tested in pdfLaTeX, XeLaTeX, LuaLaTeX.
Description
We assign a unique label to a footnote or endnote via
\applabel
, then make a reference to that label using\appref
and\apprefwithpage
. This procedure generates flawless references and the (page and) line numbers are correct.However, a problem arises when package
hyperref
is active. All the reference numbers are made into clickable links, however the links to the end of the referenced passage (corresponding to the label{#1:end}
) are broken: clicking on them leads to nowhere (= to the top of page 1). Whereas clicking on the starting number brings to the expected place in the text.I believe there might be some bug in how
\applabel
defines the ending label ({#1:end}
) when it is placed into the text. It is not an error in how a certain referencing command calls the label. This is because virtually all referencing commands are affected by this (see below). Also, if we bypass\applabel
and create two manual labels{endnote-manual:start}
and{endnote-manual:end}
, the hyperlink behavior of\appref
is suddenly correct.In fact, all of the following are affected:
--critical
\Xfootnote
as well as\Xendnote
--referencing the note via\appref
(and\SEref
!) = only line numbers, as well as\apprefwithpage
(and\SErefwithpage
) = page and line numbers. In the latter case, both the page and line number of{#1:end}
are broken --short notes whose\edtext
is contained on one page (they only get line numbers) as well as long\edtexts
that span multiple pages (they get page and line numbers). Both the page and line number of{#1:end}
are broken.Also, the links displayed within the footnote/endnote, right before the
\lemma
, are correct. But these are set by\printlines
, independently of\applabel
. This seems to confirm that the bug rests within\applabel
.The log displays this error message:
pdfTeX warning (dest): name{myfootnote:end} has been referenced but does not exist, replaced by a fixed one
However, without
hyperref
, there is no error message.Minimal Working Example
Workaround
A workaround would be to bypass
\applabel
entirely and place the labels manually:\edlabels{#1:start}
and\edlabels{#1:end}
, but this defeats the purpose.