I'm using Algorithm2e and want a loop with no intial condition and no ending condition. Using Algorithmic, this can be achieved with \Loop ... \EndLoop, but I cannot find a similar loop for Algorithm2e. How do I do this in Algorithm2e?
-
It's not very clear; can you make an example?egreg– egreg2013-12-04 22:06:14 +00:00Commented Dec 4, 2013 at 22:06
Add a comment
|
1 Answer
Something like this, with empty condition?
\documentclass{article}
\usepackage{algorithm2e}
\begin{document}
\thispagestyle{empty}
\SetKwFor{Loop}{Loop}{}{EndLoop}
\begin{algorithm}
\Loop{}{Statement\;Statement\;}
\end{algorithm}
\end{document}

-
3Or perhaps more elegantly
\SetKwBlock{Loop}{Loop}{EndLoop}Detached Laconian– Detached Laconian2018-09-06 00:46:07 +00:00Commented Sep 6, 2018 at 0:46