To set the name of the \autoref
command for an algorithm I use:
\newcommand{\algorithmautorefname}{Algorithm}
like commented here. I would also like to be able to refer to lines within an algorithmic
environment with line x
.
\begin{algorithm}
\label{alg:myalg}
\begin{algorithmic}[1]
\State Do X
\State Do Y \label{algl:y}
\State $x = y + z$
\end{algorithmic}
\end{algorithm}
\autoref{alg:myalg}
gives me correctly Algorithm 1. In addition, I would also like to have \autoref{algl:y}
generate line 2. Until now I'm using: line~\ref{algl:y}
.
Seeing the same answer you can define the autoref names by: \....autorefname
.
But then he mentions that some counters are hidden, for example the line numbering: \c@ALG@line
. Is it possible to create an autoref name for them?
I have tried:
\newcommand{\ALGlineautorefname}{line}
\newcommand{\ALG_lineautorefname}{line}
\newcommand{\ALG@lineautorefname}{line}
but none work and only the first compiles.
If possible, how can I create an \autorefname
for a line in an algorithmic
environment.