algpseudocode
lets me write code such as:
\documentclass{article}
\usepackage{algpseudocode}
\begin{document}
\begin{algorithmic}
\While{$n>3$}
\If{$m>n$}
\State ...
\State ...
\EndIf
\If{$m>2$}
\State ...
\EndIf
\EndWhile
\end{algorithmic}
\end{document}
Yielding results similar to
while n>3
if m>n
...
...
end if
if m>2
...
end if
end while
I'd like all of that "end if", "end while", "end procedure" text to disappear and everything to compress upwards such that the result is:
while n>3
if m>n
...
...
if m>2
...
That is, I'd like a Pythonic-style where indentations indicate blocks.
Can algpseudocode
do this? Or is there another package with similar functionality?
Best Answer
Instead of (re)defining the way
\While
and\If
works, you can remove the "end line" text viaHere's your MWE: