I have a bunch of algorithms which I need to explain by referring to certain line numbers in them. I'm trying to use \crefrange for this, but the simplest example seems to fail.
In the example below, on the 2nd page, I refer to line range 1-3 in the 2nd algorithm using \crefrange. Unfortunately, in the resulting PDF, when I click on "Lines 1-3," the link takes me to the right line but in the wrong algorithm (i.e., algorithm one, not two.)
\documentclass{article}
\usepackage{algorithm,algpseudocode}
\usepackage[colorlinks]{hyperref}
\usepackage[noabbrev,capitalize,nameinlink]{cleveref}
\begin{document}
\section{Page 1}
\cref{a:one:line2} in \cref{a:one} is \dots
\cref{a:one:line2,a:one:line3} of the algorithm are based on \dots
\begin{algorithm}
\caption{Baseline}\label{a:one}
\begin{algorithmic}[1]
\State Do X
\State Do Y \label{a:one:line2}
\State $x = y + z$ \label{a:one:line3}
\end{algorithmic}
\end{algorithm}
\pagebreak
\section{Page 2}
\cref{a:two:line2} in \cref{a:two} is \dots
\crefrange{a:two:line1}{a:two:line3} of the algorithm are based on \dots
\begin{algorithm}
\caption{Baseline}\label{a:two}
\begin{algorithmic}[1]
\State Do X \label{a:two:line1}
\State Do Y \label{a:two:line2}
\State $x = y + z$ \label{a:two:line3}
\end{algorithmic}
\end{algorithm}
\end{document}
I'm using TexStudio with pdflatex on Ubuntu, if that matters.
l.30 \State Do Y \label{a:two:line2}pdfTeX warning (ext4): desti nation with the same identifier (name{ALG@line.3}) has been already used, dupli cate ignored, right? – Apr 03 '18 at 20:36\crefrangebut with\crefas well. – Mico Apr 03 '18 at 20:39ALG@line.2,ALG@line.1. – Alin Tomescu Apr 03 '18 at 20:46algorithmpackage". And page 24 saysalgorithmicis not supported, which I'm not using am I? I am only doing\usepackage{algorithm,algpseudocode}– Alin Tomescu Apr 03 '18 at 20:54