1

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):

enter image description here

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):

enter image description here

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

6
  • Do you happen to have \usepackage{parskip} in the preamble, or have you set the \parskip length to some value above zero? Commented Mar 23, 2016 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 Commented Mar 23, 2016 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? Commented Mar 23, 2016 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. Commented Mar 23, 2016 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
    Commented Mar 23, 2016 at 11:28

1 Answer 1

2

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:

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .