当我想使用 algpseudocode 引用某一行时,单击给出的链接会将\ref
我发送到算法的开头,而不是将我发送到相关的行。
您是否知道是否存在实现第二种行为的方法 (我知道算法就是这种情况)? 如果是,该怎么做?
例子:
\documentclass{article}
\usepackage{algorithm, algpseudocode}
\usepackage{hyperref}
\hypersetup{
colorlinks=true,
% linkcolor=teal,
% filecolor=blue,
% citecolor=cyan,
% urlcolor=violet,
}
\begin{document}
\begin{algorithm}
\caption{My algorithm}
\label{algo:example}
\begin{algorithmic}
\State \label{line:1} Lots of line...
\State Line 2
\State Line 3
\State Line 4
\State Line 5
\State Line 6
\State Line 7
\State Line 8
\State Line 9
\State \label{line:10}Line 10
\end{algorithmic}
\end{algorithm}
Line \ref{line:1} and \ref{line:10} reference different lines but both point to the beginning of the algorithm when I click on the links.
\end{document}