I am using this approach to have a for all ... do in parallel using the algcompatible package.


  {\textbf{for all }#1 \textbf{do in parallel}}%
  {\textbf{end for}}


\caption{A test algorithm}
\FORALL {$v \in V(G)$}
\STATE $l(v) \leftarrow \infty$
\FORALLP{$v \in V(G)$}
\STATE $l(v) \leftarrow \infty$


How can I get rid of the end for at the end of the block?

  • I've added a MWE – Filippo Bistaffa Jan 31 '15 at 18:19
  • You probably want to remove also the “end for” in the \FORALL cycle. Note that algcompatible is just for old documents and algpseudocode should be used instead. – egreg Jan 31 '15 at 18:22
  • 1
    Use \algtext*{ENDFAP} after defining FORALLP and ENDFAP, as suggested in algpseudocode without end block text. – Werner Jan 31 '15 at 18:25
  • @FilippoBistaffa: Since the answer is entirely contained in the linked post, this could be considered a duplicate (rather up-vote the linked posts). – Werner Jan 31 '15 at 19:11

Browse other questions tagged or ask your own question.