Menu

HowTo_SingleLinePart

How to print the headings of the part level (\part) without a prefix line

In scrartcl, the headings of the part level are the only ones that are output with a prefix line, i.e. where "Part" followed by the number is always on a separate line. If you want this heading to be output like the headings of the section level, you can simply change the style:

\RedeclareSectionCommand[style=section]{part}

However, by default, no space is inserted after the number, as this would not make sense for a prefix line. Therefore, \partformat must also be changed:

\documentclass{scrartcl}
\usepackage[english]{babel}
\usepackage{blindtext}

% \part with line break after the number and hanging indent like \section
\RedeclareSectionCommand[style=section]{part}
\renewcommand*{\partformat}{\partname~\thepart\autodot\ }

\begin{document}

\part{Example Heading on Level  \partnumdepth{} (part)}
\blinddocument

\end{document}

If the heading text is multi-line, as in the example, this solution uses a hanging indent just like \section. If this hanging indent is to be omitted, a solution without changing the style is recommended:

\documentclass{scrartcl}
\usepackage[english]{babel}
\usepackage{blindtext}

% \part without hanging indent but also without line break after the number
\renewcommand*{\partheadmidvskip}{\enskip}
\setkomafont{partprefix}{\usekomafont{part}}

\begin{document}

\part{Example Heading on Level  \partnumdepth{} (part)}
\blinddocument

\end{document}

If you define headings yourself with \DeclareNewSectionCommand, you should note that, unlike the first solution, this second solution also has an effect on other headings in the part style, as \partheadmidvskip is a statement from the part style and not only from the \part command.

The second solution works not only for scrartcl, but also for scrbook and scrreprt:

\documentclass{scrbook}
\usepackage[english]{babel}
\usepackage{blindtext}

% \part without hanging indent but also without line break after the number
\renewcommand*{\partheadmidvskip}{\enskip}
\setkomafont{partprefix}{\usekomafont{part}}

\begin{document}

\part{Example Heading on Level  \partnumdepth{} (part)}
\blinddocument

\end{document}

For scrbook or scrreprt, you should replace style=section with style=chapter when using the first solution, but then you would no longer automatically have a separate page with a blank back:

\documentclass{scrbook}
\usepackage[english]{babel}
\usepackage{blindtext}

% \part like \chapter
\RedeclareSectionCommand[style=chapter]{part}
\renewcommand*{\partformat}{\partname~\thepart\autodot\ }

\begin{document}

\part{Example Heading on Level \partnumdepth{} (part)}

\blindtext

\end{document}

However, as long as \part is always followed by \chapter and option open=right (this is the default setting for scrbook) is used, this is not a problem because \chapter then takes care of the empty back:

\documentclass{scrbook}
\usepackage[english]{babel}
\usepackage{blindtext}

% \part like \chapter
\RedeclareSectionCommand[style=chapter]{part}
\renewcommand*{\partformat}{\partname~\thepart\autodot\ }

\begin{document}

\part{Example Heading on Level \partnumdepth{} (part)}

\blinddocument

\end{document}

Otherwise you may have to insert \cleardoubleoddpage yourself:

\documentclass[open=any]{scrbook}
\usepackage[english]{babel}
\usepackage{blindtext}

% \part like \chapter
\RedeclareSectionCommand[style=chapter]{part}
\renewcommand*{\partformat}{\partname~\thepart\autodot\ }

\begin{document}

\tableofcontents

\cleardoubleoddpage% So that the part is on a right-hand side.
\part{Example Heading on Level \partnumdepth{} (part)}
\cleardoubleoddpage% So that the part has a blank back.

\blinddocument

\end{document}

It should be noted that when using the chapter style for \part headings, these naturally also take the chapterprefix option into account. It is therefore not possible in this way to set the \part headings without a prefix line and the \chapter headings with a prefix line. Strictly speaking, however, this would make little sense anyway.


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.