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.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

When I insert more than one new line before the if-clause of an algorithm; or a new line between two if-clauses in an Algorithms-section, I get the following error: []

! LaTeX Error: There's no line here to end.

Here follows extracts from my code:

            \If{ $currentFecUnit$ > $HIGHEST\_FEC\_UNIT\_NR\_DECODED\_GLOBAL$ OR
            ( $currentFecUnit$ == 0 AND $nrOfPacketsReceived$ == 1 ) }
              ExtractPktHeaderAndPutIntoGlobalFecUnitHeaderValues () 

How do I add one more line before the if-clause without gettin syntax-error?

share|improve this question
up vote 5 down vote accepted

You can use \BlankLine:



\KwData{this text}
\KwResult{how to write algorithm with \LaTeX2e }
\While{not at end of this document}{
read current\;
go to next section\;
current section becomes this one\;
go back to the beginning of current section\;
\caption{How to write algorithms}


enter image description here

share|improve this answer

Your Answer


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.