# Suppress line numbers in front of 'repeat' and 'until' keywords in algorithmic

Here is my minimal example:

\documentclass{article}

\usepackage{algorithm}
\usepackage{algorithmic}

\begin{document}

\begin{algorithm}
\caption{Test}
\begin{algorithmic}[1]
\REQUIRE
\REPEAT
\STATE state
\STATE state
\STATE state
\UNTIL condition
\end{algorithmic}
\end{algorithm}

\end{document}

I get this result:

But I would prefer this result:

How can I achive this?

• Welcome to TeX.SX! You can have a look at our starter guide to familiarize yourself further with our format. – Andrew Swann Dec 6 '13 at 13:33

algorithmic creates all of the necessary pseudocode macros at the start of the algorithmic environment. As such, it's not as easy to merely patch \REPEAT and/or \UNTIL in the "usual" way.

The following MWE inserts the patch after the algorithmic environment starts. The patch uses a "no step" \item in the form of \ALC@it@nostep rather than the default \ALC@it:

\documentclass{article}

\usepackage{algorithm,algorithmic}% http://ctan.org/pkg/algorithms
\usepackage{xpatch,letltxmacro}% http://ctan.org/pkg/etoolbox
\makeatletter
\newcommand{\ALC@it@nostep}{\item[]}% No-step algorithmic item
% \patchcmd{<cmd>}{<search>}{<replace>}{<success>}{<failure>}
\LetLtxMacro\oldalgorithmic\algorithmic
\LetLtxMacro\endoldalgorithmic\endalgorithmic
\renewenvironment{algorithmic}[1][0]{%
\oldalgorithmic[#1]%
\xpatchcmd{\REPEAT}{\ALC@it}{\ALC@it@nostep}{}{}%
\xpatchcmd{\UNTIL}{\ALC@it}{\ALC@it@nostep}{}{}%
}{\endoldalgorithmic}
\makeatother

\begin{document}

\begin{algorithm}
\caption{Test}
\begin{algorithmic}[1]
\REQUIRE
\REPEAT
\STATE state
\STATE state
\STATE state
\UNTIL condition
\end{algorithmic}
\end{algorithm}

\end{document}