# algorithmic package

I want to write something like

\Repeat {comment}
\State
\until


The code:

\documentclass[a4paper]{article}
\usepackage{algorithm}
\usepackage{algorithmic}
\begin{document}
\begin{algorithm}[H]
\begin{spacing}{1.2}
\begin{algorithmic}
\STATE Initialize
\REPEAT (for each episode)
\UNTIL $s_t$ is terminal
\end{algorithmic}
\end{spacing}
\end{algorithm}
\end{document}


But I can not put the comment on the same line of the repeat command. Could you help me?

Thanks.

• Welcome to TeX.SX! Please help us to help you and add a minimal working example (MWE) that illustrates your problem. It will be much easier for us to reproduce your situation and find out what the issue is when we see compilable code, starting with \documentclass{...} and ending with \end{document}. – Andrew Swann Sep 17 '14 at 12:07
• Ok, I edited my first post! – supertoto Sep 17 '14 at 12:33

As usual you have to use brackets for optional argument. Thus using \REPEAT[for each episode], should give the desired result.