# algorithm2e and extra vertical spaces

## Solution

The comment below of David Carlisle gives the solution.

## Problem

With the code below, I can add extra vertical spaces where I want but not everywhere. My problem is that the compilation complains by saying the following ugly things even if at the end the job ii done. How can I do to make back peace between me and my LaTeX compiler ?

## Hurting log messages ;-)

./extra_vertical_space.tex:9: LaTeX Error: There's no line here to end.

See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.
...

l.9     \\

?


## MMWE (Minimal Merly Working Example)

\documentclass[a4,11pt]{article}
\usepackage[french, vlined]{algorithm2e}

\begin{document}

\begin{algorithm}[H]
\KwData{some datas}
\vspace{0.4em}
\\
\Begin{
\vspace{0.4em}
\\
Step 1
\\
Step 2
\\
\vspace{0.4em}
\\
\While{one condition is true}{
\vspace{0.4em}
\\
... and so on.
}
}
\end{algorithm}

\end{document}

• never use \\  at the beginning or end of a paragraph  \vspace{0.4em}\\  will always give the error you state, if you want a bigger space just give a bigger space eg \vspace{1.5\baselineskip – David Carlisle Jan 16 '17 at 8:12
• That does the job ! – projetmbc Jan 16 '17 at 10:30

You could use the setspace package to increase the linespacing.

\documentclass{article}
\usepackage[french,vlined]{algorithm2e}
\usepackage{setspace}

\begin{document}

\begin{algorithm}
\begin{doublespace}
\KwData{some datas}
\Begin{
Step 1\;
Step 2\;
\While{one condition is true}{
... and so on.\;
}
}
\end{doublespace}
\end{algorithm}

\end{document}
`

• I have updated my question to indicate that the spacing are changed in some places and not every where. Your code remains useful. – projetmbc Jan 16 '17 at 10:29