Menu

HowTo_EvenPartPage

How to ensure that new parts in a book start on the left-hand pages and chapters on the right-hand pages

It may seem strange, but at some point I actually had the wish to always start a new part for a special book on a left-hand page, so that the following chapter on the right-hand page then forms a double page together with the part.

Actually, KOMA-Script, neither scrbook nor scrreprt, provides for a new part to always start on the left-hand page. This is mainly due to typographical tradition. Nevertheless, it can be achieved. KOMA-Script offers some so-called do-hooks. These were created long before the generic hooks in LaTeX. One of these hooks is heading/preinit/part. It is executed so early within \part that the choice of whether to insert a vacate page has not yet been made. We can therefore provide a left-hand page ourselves at this point and switch off open=right:

\AddtoDoHook{heading/preinit/part}
  {\cleardoubleevenpage\KOMAoptions{open=any}\csname @gobble\endcsname}

The \csname @gobble\endcsname is needed to silently use the argument that each do-hook receives.

This means that we already have the part heading on the left-hand side. However, the open=any would have a global effect, so that chapters would no longer generally start on right-hand pages. So we have to switch open=right back on at a suitable point. So that the effect is not limited to \chapter, but also reaches \cleardoublepage, for example, we do not do this via \AddtoDoHook{heading/preinit/chapter}, but redefine \partheademptypage. This macro normally creates an empty page after the part heading in the double-page typesetting with open=right. We do not need this page, so we can simply replace the definition:

\renewcommand*{\partheademptypage}{\KOMAoptions{open=right}}

This results in:

\documentclass{scrbook}

\AddtoDoHook{heading/preinit/part}
  {\cleardoubleevenpage\KOMAoptions{open=any}\csname @gobble\endcsname}
\renewcommand*{\partheademptypage}
  {\KOMAoptions{open=right}}

\usepackage{lipsum}
\begin{document}
\tableofcontents
\part{Should start on the left}
\addchap{Should start on the right}
\lipsum[1-4]
\chapter{Should start on the right}
\lipsum[1-5]
\addpart{Should start on the left}
\chapter{Should start on the right}
\lipsum[1-4]
\chapter{Should start on the right}
\lipsum[1-5]
\end{document}
\part*{Should start on the left}
\chapter{Should start on the right}
\lipsum[1-4]
\chapter{Should start on the right}
\lipsum[1-5]
\end{document}

As the example shows, do-hook and \partheademptypage are also executed by \addpart and \part*.


Related

Wiki (English): HowTo_Headings

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.