[Tex/LaTex] Incorrect vertical white space between paragraphs due to figure

floatsspacing

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?

Best Answer

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