[Tex/LaTex] How to have a “repeat” statement without an “until” statement using algorithmicx package


I'd like to write something very similar to the algorithm shown below, but using the algorithmicx package. (This example comes from p. 152 of the book Proximal Algorithms by Boyd and Parikh.) How can I have a "repeat" statement without a corresponding "until" statement using algorithmicx?

(I mention the algorithmicx package specifically because I think it's more customizable than other algorithm packages.)

enter image description here

Best Answer

Here's one option using \algblockdefx to define a block and then \algonotext to suppress typesetting the ending part for the block:




\State $sum\gets 0$
\State $i\gets 1$
\State $sum\gets sum+i$
\State $i\gets i+1$
\State $i\gets 100$


enter image description here