I am typesetting algorithms with the algorithm package, and I would like to add unnumbered lines in them.
Is there a way to create a \State*
command, the same way there is an equation*
environment?
Here is an example of algorithm. I would like the \State {}
line to be unnumbered, and therefore \State Step 3.
to be number 3.
\documentclass{article}
\usepackage{algorithm}
\usepackage{algpseudocode}
\begin{document}
\begin{algorithm}
\caption{A title.}
\begin{algorithmic}[1]
\State Step 1.
\State Step 2.
\State {}
\State Step 3.
\end{algorithmic}
\end{algorithm}
\end{document}
Best Answer
By virtue of the fact that you are using
algpseudocode
, it looks like you are actually using thealgorithmicx
package. From page 4 of its manual, it looks like you want the\Statex
command.If for some reason that doesn't work, a solution can be nastily hacked by forcing suppression of the line number:
You can then use
\NoNumber
like\State
: