# Label specific state in the algorithmic environment

if I have this code

\begin{algorithm}
\label{alg:the_alg}
\begin{algorithmic}[1]
\STATE operation 0
\STATE operation 1
\end{algorithmic}
\end{algorithm}


I can make a reference to alg:the_alg. But, how I can make a reference to a STATE in algorithmic ?

You would use the same technique as you would with a regular label. The reference will be to the line number inside algorithmic:

\documentclass{article}
\usepackage{algorithm,algorithmic}% http://ctan.org/pkg/algorithms
\begin{document}
\begin{algorithm}
\caption{This is an algorithm}
\label{alg:the_alg}
\begin{algorithmic}[1]
\STATE operation 0 \label{op0}
\STATE operation 1 \label{op1}
\end{algorithmic}
\end{algorithm}

See Algorithm~\ref{alg:the_alg}. More specifically, Operation~\ref{op1}.
\end{document}


Consider using the compatible (modernized) algorithmicx bundle which offers algpseudocode. Here's a duplicate of the above MWE, now with the updated algpseudocode package:

\documentclass{article}
\usepackage{algorithm,algpseudocode}
\begin{document}
\begin{algorithm}
\caption{This is an algorithm}
\label{alg:the_alg}
\begin{algorithmic}[1]
\State operation 0 \label{op0}
\State operation 1 \label{op1}
\end{algorithmic}
\end{algorithm}

See Algorithm~\ref{alg:the_alg}. More specifically, Operation~\ref{op1}.
\end{document}