Why is Latex creating in certain situations a huge gap between the title and the text?

I am new to Latex and quite confused why the gap between the title and the text has on certain pages a higher distance as usual.

I don't think its a good idea to show you the entire code. Here is an extract of it:

\newline Als Beschleunigungssensor wurde in der konstruktiven Auslegung ein MEMS-Sensor verwendet. Diese werden besonders häufig in Fahrzeugen montiert, um Druck und Beschleunigungen zu ermitteln. Da die Algorithmenentwicklung unabhängig der Hardware gestaltet wird, werden technischen Eigenschaften der Hardware und mögliche Einschränkungen zunächst nicht vorgestellt.
\newpage
\subsection{Wälzlager}
\label{sec:Wälzlager}
Der nachfolgende Abschnitt beschreibt die prinzipielle Notwendigkeit einer Lagerung in technischen Systemen. Dabei wird insbesondere der Aufbau von Wälzlager, ihre Wirkweise und mögliche Wälzlagerschäden vorgestellt, da das Lagersystem an der vorliegenden Radnabe, welches durch den zu entwickelnden Algorithmus zu überwachen ist, aus Wälzlager besteht.
\newline\newline

• You've probably got large figures or unbreakable boxes so TeX is trying to fill the page by stretching vertical glue. You log file likely complains about underfull \vbox. – campa Feb 19 at 10:24
• Without seeing your document and its configuration it is hard to say. It can be because of justified bottom combined with for example [H] float plaments. FOr example your \newline\newline certainly should never be used in the text, tht just indicates that you're doing something wrong – daleif Feb 19 at 10:25

This is only a guess as you don't even show the involved pages but I can reproduce something similar (though not as extreme) with

\documentclass{book}

\usepackage{graphicx}
\usepackage{lipsum}

\begin{document}

\section{Foo}
\lipsum[1-2]

\begin{figure}
\includegraphics[width=\linewidth]{example-image}
\end{figure}

\section{Baz}
\lipsum[3]

\end{document}


and the log will complain about

Underfull \vbox (badness 10000) has occurred while \output is active


Because of the big picture TeX tries to fill the page by stretching the vertical glue. If you have many big unbreakable boxes (like parbox or minipage) or (more likely) big figures and abuse the H floating placement, you will encounter this problem quite often.

You could issue \raggedbottom in the preamble, such that TeX does not tries to fill the pages uniformly, but before that there are other things to try, like don't using the H placing option unless your life depends on it. Furthermore, the six lines of code you've shown contain one \newpage and three \newlines. The former might be acceptable but the latter is suspicious, and as daleif pointed out in his comment \newline\newline should never be used.

• Thank you very much! – Adam Feb 19 at 10:55