I'm using the Latex style files of ICML 2020, that can be found here. In particular, they supply algorithm.sty
and algorithmic.sty
. When I try to reference a line in an algorithm, I get a cross-reference to the algorithm itself. To make the problem even weirder, when I remove these two style files (and force my compiler to use the updated packages) the cross-reference becomes correct.
Any Ideas?
Here's a minimal working example (I kept the lines I felt are necessary):
\documentclass{article}
\newcommand{\theHalgorithm}{\arabic{algorithm}}
\usepackage{icml2020}
\begin{document}
\section{Introduction}
\label{submission}
\begin{algorithm}
\caption{This is an algorithm}
\label{alg:the_alg}
\begin{algorithmic}[1]
\STATE line number one \label{op0}
\STATE line number two \label{op1}
\end{algorithmic}
\end{algorithm}
This is Line \ref{op0}, and this is Line \ref{op1}.
\end{document}
This code produces the following:
Best Answer
The main problem here is on line 106 of
algorithmic.sty
:The line counter number is incremented using
instead of
So, it should resemble
My suggestion would be to contact the ICML and request that they change their version of
algorithmic.sty
they release with their conference style to allow for proper referencing.In the interim, you can define your own
\alglinelabel
macro that properly sets a\label
that can be referenced: