# Extra vertical space between two paragraphs added by figure

Compiling the following code

\documentclass{article}

\usepackage{lipsum}

\begin{document}
\lipsum[1] aaa aaa aaa aaa aaa aaa aaa aaa aaa  aaa aaa aaa aaa aaa aaa aaa
aaaa

\lipsum[1]
\end{document}


returns two paragraphs as expected.

But if a figure is placed after the first paragraph,

\documentclass{article}

\usepackage{lipsum}

\begin{document}
\lipsum[1] aaa aaa aaa aaa aaa aaa aaa aaa aaa  aaa aaa aaa aaa aaa aaa aaa
aaaa
\begin{figure}
\caption{A}
\end{figure}

\lipsum[1]
\end{document}


LaTeX inserts a vertical space between the two paragraphs.

If a %-character is added at the end of the first paragraph or a blank line is added before the figure, the vertical space disappears and the ouptut matches the first one. This only seems to happen if the first paragraph ends in a full line.

Why does this happen and should therefore every float be preceded with a blank line?

## 1 Answer

It is not really related to figure you see the same from here

\documentclass{article}

\usepackage{lipsum}

\begin{document}
\lipsum[1] aaa aaa aaa aaa aaa aaa aaa aaa aaa  aaa aaa aaa aaa aaa aaa aaa
aaaa \mbox{}

\lipsum[1]
\end{document}


It is not actually vertical space, it is an extra all white line of the first paragraph (you can most easily see the difference if a page break occurs as this is a paragraph line it is not dropped at the top of a page, as vertical space would be.

The primitive end-of-paragraph process does one \unskip to remove a space at the end of a paragraph which usually comes from the end of line, but you have space-emptybox-space so you end up with space-emptybox at the end, then you were unlucky and got a linebreak at the space, so leaving the box on its own.

Actually with figure you get a vadjust node not a box, but it has the same effect.

• Thank you very much for this detailed explanation! So, do you recommend to precede every figure with a blank line? Dec 15, 2020 at 14:08
• @EuklidAlexandria easiest rule is don't precede it with a horizontal space. So precede it with either a blank line or (for a mid-paragraph figure) add \begin{figure} directly to the preceding word, or on a new line with a % at the end of the preceding line). These rules are quite general and would apply to \index{..} as well more or less any "no visible effect" command. Dec 15, 2020 at 14:24