I'm trying to learn the algorithmic package for typesetting pseudocode. One problem I'm running into is that I can't figure out how to insert blank lines, to separate blocks of code. The usual \\ or starting a new paragraph doesn't seem to work. How can I insert blank lines in in the algorithmic environment?


If you want the empty line to be numbered, just insert


on this line.

If you want an unnumbered empty line, insert



  • But the lefthand label number increments by 1 as usual. Any way to introduce a new line WITHOUT incrementing the number? Sep 9 '13 at 10:11
  • 1
    I recommend the package algorithmicx which provides a set of macros to extend package algorithmic and is more customizable than the latter). Using algorithmicx, a blank line can be produced by \State (numbered) or \Statex (unnumbered).
    – hengxin
    Oct 15 '13 at 3:01
  • 1
    When I add \STATE or \item[] before a \COMMENT line, then it doesn't work. I need to add it twice in order to see the same effect.
    – Agostino
    May 22 '15 at 0:47

just add


it always works for me!!


It’s a kludge, but you might be able to use

    \STATE $x \leftarrow 1$
    \STATE $x \leftarrow 2$
  • This didn't work in an algorithmic environment for me.
    – metakermit
    Jul 23 '13 at 22:51
  • Thanks. I added \[\] to algorithm and the line now is unnumbered.
    – Avra
    Apr 5 at 21:41

Just use \[\] instead of \\. Math formula is not numbered as a single line in algorithmicx.

  • What is the reason behind that? Why this would unnumber a line?
    – Avra
    Apr 5 at 21:40
  • Thank you. \begin{algorithm}\end{algorithm}. I tried that on algorithm and it works!
    – Avra
    Apr 5 at 21:41

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.