8

I would like to generate an algorithm with the algorithmic package which does not show the annoying closing statements when I typeset it. I have done this before but have now forgotten how to do it. Specifically,

   \FORALL Natural numbers N
      \STATE N=N-1 !
   \ENDFOR

I'd prefer that the final \ENDFOR statement not show up after typesetting as this just needlessly chews up space.

  • 8
    Can you post your answer as an answer to this question, so that you can accept it and the question be resolved? – Charles Stewart Jan 28 '11 at 8:32
  • It doesn't look like blackkettle will returen. So I added a CW answer. Could someone please upvote it once, so that this question gets off the unanswered list. – Caramdir Feb 7 '11 at 23:17
12

From the algorithmic manual:

There is a single option, noend that may be invoked when the algorithmic package is loaded. With this option invoked the end statements are omitted in the output. This allows space to be saved in the output document when this is an issue.

So, if you load the package with

\usepackage[noend]{algorithmic}

there won't be any closing statements.

  • 1
    I use \begin{algorithm} around algorithmic and only load \usepackage{algorithm}. I get errors if a additionally \usepackage[noend]{algorithmic}. Is there another way to remove the closing statements? – CGFoX Jan 17 '17 at 9:24
  • @CGFoX use [noend] argument with package algpseudocode instead of package algorithmic. – ZaydH Apr 29 at 21:24
0

Package algpseudocode also has a noend option. It is invoked via:

\usepackage[noend]{algpseudocode}

This alternate approach solves the issue reported in a previous comment that adding package algorithmic to the document leads to the error:

Command \algorithmic already defined. {\end{list}}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.