# Adding a blank line in algorithm2e

Is there any way to add a blank line in algorithm2e?

I have the following document:

\documentclass{article}
\usepackage[linesnumbered]{algorithm2e}% http://ctan.org/pkg/algorithm2e
\begin{document}
\begin{algorithm}
\SetAlgoLined
i = 1 + j\\
% I would like to add a \linebreak here
j = 1 + i\\
\end{algorithm}
\end{document}


This outputs:

I would like to have:

If I add \\ or \linebreak between i = 1 + j\\ and j = 1 + i\\ I get the following error message:

• As a workaround you can add \mbox{}\\ or may be easier to type (but less clean) ~\\. – Manuel Jul 20 '14 at 22:53
• @Manuel Indeed \mbox{}\\  and ~\\  do the trick (I had tried ~, forgot to add another  :/). Thanks! – Franck Dernoncourt Jul 20 '14 at 22:54

algorithm2e's line-ending macro is \;. From the algorithm2e documentation:

9.1 global code typesetting commands

\; marks the end of a line. Don’t forget it! By default, it prints a ‘;’. You can change this with \DontPrintSemicolon.

\documentclass{article}
\usepackage[linesnumbered]{algorithm2e}% http://ctan.org/pkg/algorithm2e
\DontPrintSemicolon
\begin{document}
\begin{algorithm}
$i = 1 + j$\;
\;
$j = 1 + i$
\end{algorithm}
\end{document}


Instead of the \DontPrintSemicolon trick you should use \BlankLine.

\documentclass{article}
\usepackage[linesnumbered]{algorithm2e}% http://ctan.org/pkg/algorithm2e
\DontPrintSemicolon
\begin{document}
\begin{algorithm}
$i = 1 + j$\;
\BlankLine
$j = 1 + i$
\end{algorithm}
\end{document}

• Welcome to TeX.SX! Could you add a screen shot in order to 'prove' that your solution works? – user31729 Feb 22 '15 at 15:49
• Running you code I get the image added to you post - thus this does not seem to answer the question posed. – Andrew Swann Feb 22 '15 at 15:57
• Sry. I just read the "blank line" and totaly overlooked that there should be an enumeration at the beginning of the line. So my answer is totaly wrong. Sry for that. – user1660514 Feb 22 '15 at 20:43
• Upvoting for \BlankLine since it plays nice with line numbering. – qweruiop Jun 1 '16 at 2:14
• This definitely looks better. – lonesome Aug 6 '17 at 3:07