The following code
\documentclass{article}
\usepackage{kantlipsum}
\usepackage[ngerman,english]{babel}
\begin{document}
\section{Foo}
\kant[1]
\begin{itemize}
\item
\item
\item
\item
\item
\end{itemize}
\kant[2]
\begin{itemize}
\item
\item
\item
\item
\end{itemize}
% \selectlanguage{ngerman}
\section{Baz}
\kant[1]
\end{document}
produces the output
When uncommenting the \selectlanguage
instruction (and also using \begin{otherlanguage}
) the second section is pushed to the second page. I noticed this in a document with itemize
s in it, like I've shown here, and I did not manage to reproduce the problem by using text only.
My (wild) guess is that the whatsit node introduced by the \write
directive issued by \selectlanguage
interferes with the vertical glue introduced by itemize
and \section
. In fact, writing
\makeatletter\write\@auxout{\relax}\makeatother
instead of \selectlanguage
leads to the same problem.
Is my guess right? And more importantly, can I do something against it? In the real use case the section heading involves a \...name
which changes with the language. As I workaround I could use \foreignlanguage
in the section title but I'd like to know if there are better ways.