# Incorrect vertical white space between paragraphs due to figure

When inserting a figure in my latex document at a position where the figure cannot be placed precisely (e.g. at the bottom of a page in the pdf document), Latex nevertheless inserts white space between the two paragraphs around the figure. This is an MWE:

\newline \lipsum[100]

\begin{figure}
\centering
\includegraphics{path/to/fig}
\caption{This is a figure.}\label{fig:sample}
\end{figure}

\lipsum[100]


The output is shown below (the figure is placed on the following page):

Inserting \raggedbottom (see e.g. this link) to the preamble already gives a smaller spacing between the paragraphs, see below (again with the figure on the next page):

However, I do not succeed in removing the white space entirely. How could this be solved?

• Do you happen to have \usepackage{parskip} in the preamble, or have you set the \parskip length to some value above zero? – Torbjørn T. Mar 23 '16 at 8:42
• please always post the complete document that produces the image so that people can test answers. you can use example-image as th eimage name as that image is already in most tex installations – David Carlisle Mar 23 '16 at 8:56
• @DavidCarlisle: Thanks for the tip. Will keep in mind for the following requests. However, example-image did not work on my pc. @TorbjørnT.: I am using the memoir class, that apparently emulates the parskip package. Adding \setlength{\parskip}{0pt} in the preamble solves the issue. Could you make a full answer of it so I can accept it? – user2416984 Mar 23 '16 at 9:16
• if I change the version in my answer to memoir and add \nonzeroparskip instead of the parskip package I still don't get the doubled space. – David Carlisle Mar 23 '16 at 9:21
• The presence of a figure environment between paragraphs has no effect on the vertical spacing bewteen them; probably, you are deceived by the fact that, if you remove the figure, the page builder is able to find a better page break and, consequently, the space between those paragraphs is not stretched that much. Are those the only two paragraphs that happen to fall within that particular page? – GuM Mar 23 '16 at 11:28

The posted fragment does not produce the image shown (the \newline would generate an error and there is only one paragraph after the figure)

If I complete it to a document as follows

\documentclass{article}
\usepackage{graphics,lipsum,parskip}
\begin{document}

x
\newline \lipsum[100]

\begin{figure}[p]
\centering
\includegraphics{example-image}
\caption{This is a figure.}\label{fig:sample}
\end{figure}

\lipsum[98-100]

\end{document}


Then the spacing is as expected: