Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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?

share|improve this question

2 Answers 2

up vote 9 down vote accepted

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

\STATE

on this line.

If you want an unnumbered empty line, insert

\item[]

instead.

share|improve this answer
    
But the lefthand label number increments by 1 as usual. Any way to introduce a new line WITHOUT incrementing the number? –  Sibbs Gambling 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

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

\renewcommand{\algorithmiccomment}[1]{}
\begin{algorithmic}
    \STATE $x \leftarrow 1$
    \COMMENT{}
    \STATE $x \leftarrow 2$
\end{algorithmic}
share|improve this answer
    
This didn't work in an algorithmic environment for me. –  kermit666 Jul 23 '13 at 22:51

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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