当标签由 \doinsidelinehook 设置时,\edlineref 会产生错误的视觉交叉引用

当标签由 \doinsidelinehook 设置时,\edlineref 会产生错误的视觉交叉引用

我需要为文本版本的每一行制作独特的标签,因为我在处理过程中随机引用了许多行。此外,我还为交叉引用添加了超链接,以方便读者使用。

在下面的 MWE 中,我使用了该\doinsidelinehook功能,一旦设置了行号(根据文档),它就会自动生成唯一标签。据我所知,链接似乎按预期工作(单击似乎会将我带到正确的位置),但存在一个问题:输出与行号不匹配。

在此处输入图片描述

我想知道我做错了什么或者如何覆盖输出以便向读者提供正确的视觉信息。

注意:删除确实\doinsidelinehook可以纠正视觉输出错误,但当然我没有有意义的自动生成的标签。

\documentclass{article}

\usepackage{libertine}
\usepackage[colorlinks=true,linkcolor=blue]{hyperref}

\usepackage[series={},nocritical,noend,noeledsec,nofamiliar,noledgroup]{reledmac}
    \firstlinenum{1}\linenumincrement{1}
    \newcommand{\nochange}[1]{#1}   % dummy command
    \Xwraplinenumannotationref{\nochange} % disable \textsuperscript of annotations
    % generate unique labels for each line
    \makeatletter
    \doinsidelinehook{\edlabel{L:\the\line@num}}
    \makeatother

\begin{document}

This file demonstrates hyperref links to reledmac lines.

%NB documentation says "\annotref" but it seems to be "\annotationref"
\begin{enumerate}
\item Jump to \edlineref{L:1}\annotationref{L:1}
      (first line on first page; this should read `1').
\item Jump to \edlineref{L:2}\annotationref{L:2}
      (last line on first page; this should read `2').
\item Jump to \edlineref{L:3}\annotationref{L:3}
      (first line on second page; this should read `3X').
\item Now let's jump to the last line of the text using a
      `normal' label, \edlineref{L:test}. We expect `5'.
\end{enumerate}

\beginnumbering
\pstart Lorem ipsum dolor sit amet, consectetur adipiscing
elit. Mauris dapibus scelerisque imperdiet. Aliquam
gravida elementum enim facilisis tincidunt.\pend
\clearpage% makes it easy to see whether the jumps work

\pstart \linenumannotation{X}Nullam vel nisi ut lacus
luctus malesuada ut vitae lectus. Donec sed mauris
aliquet, congue est sed, tincidunt nulla. Ut malesuada,
urna vitae luctus volutpat, nulla mauris tincidunt
nibh, nec malesuada justo ipsum tempor\edlabel{L:test}
justo.\pend
\endnumbering
\end{document}

另一个示例更接近实际预期用途(不是最小但解决了注释中提到的换行问题)。由于某种原因,注释根本不起作用。

\documentclass{memoir}

\usepackage{libertine}
\usepackage[colorlinks=true,linkcolor=blue]{hyperref}

\usepackage[series={},nocritical,noend,noeledsec,nofamiliar,noledgroup]{reledmac}
    \firstlinenum{1}\linenumincrement{1}
    \newcommand{\nochange}[1]{#1}
    \Xwraplinenumannotation{\nochange}
    \Xwraplinenumannotationref{\nochange}

\usepackage{reledpar} 
    \setlength{\Lcolwidth}{0.49\textwidth}
    \setlength{\Rcolwidth}{0.49\textwidth} 
    \firstlinenum*{1}
    \linenumincrement*{1}
    \setstanzaindents{1,0}
    \setlength{\stanzaindentbase}{1em}
    \setcounter{stanzaindentsrepetition}{1}
    \AtBeginPairs{\sloppy}
    % generate unique labels for each line
    \makeatletter
    \doinsidelineLhook{\edlabel{\text\the\line@num}}
    \makeatother

\newcommand{\text}{}

\begin{document}

This file demonstrates hyperref links to reledmac lines.

\begin{enumerate}
\item Jump to \edlineref{1:1}\annotationref{1:1}
      (first line of text 1).
\item Jump to \edlineref{1:2}\annotationref{1:2}
      (last line of text 1).
\item Jump to \edlineref{2:3}\annotationref{2:3}
      (first line of text 2/second page).
\item Now let's try some normal labels:
     \edlineref{test1}\annotationref{test1} and \edlineref{test2}\annotationref{test2}.
\end{enumerate}

\renewcommand{\text}{1:}
Text \text

\begin{pairs}
\begin{Leftside}
\beginnumbering
\begin{astanza}
one short line one&
\edlabel{test1}\linenumannotation{X}one short line two\&
\end{astanza}
\pausenumbering
\end{Leftside}
\begin{Rightside}
\beginnumbering
\autopar
\noindent first translation\pend
\pausenumbering
\end{Rightside}
\end{pairs}
\Columns
\clearpage% makes it easy to see whether the jumps work

\renewcommand{\text}{2:}
Text \text

\begin{pairs}
\begin{Leftside}
\resumenumbering
\begin{astanza}
two short line one&
\edlabel{test2}two short line two&
\skipnumbering continued\&
\end{astanza}
\endnumbering
\end{Leftside}
\begin{Rightside}
\resumenumbering
\autopar
\noindent second translation\pend
\endnumbering
\end{Rightside}
\end{pairs}
\Columns

\end{document}

在此处输入图片描述

相关内容