MWE
\documentclass[paper=a4]{scrartcl}
\usepackage{lipsum}
\begin{document}
\section{a}
\lipsum[1-2]
\section{b}
\lipsum[3-4]
\subsection{c}
\lipsum[5]
\end{document}
The example above will break the paragraph in the subsection c
in half.
I would like latex to, when it needs a page break,
- Break at the subsection level(or whatever the deepest sectioning level in that location was)
- If there are multiple subsections on that page and breaking at that level will make the document require another break at a paragraph later on(because it would shift everything), try to break at an upper level(section, subsection) instead.
Is there a package or a configuration setting that would supply this algorithm? Or if I were to place pagebreak
commands in some clever way, would it achieve this effect, semi-automatically?
Or in other words, I want latex to leave space at the bottom instead of splitting paragraphs, and I am also wondering if it can be clever about this by breaking a section early to avoid having to break a subsection later on. The latter part is also important, only achieving the former is relatively easy.
I know that I can do this by inserting a \newpage
etc. above the \subsection{c}
line, I am not looking for the plain breaks.
Please feel free to share a solution even if it is specific to a rendering engine or a different latex implementation.
Thanks in advance.