Menu

HowTo_CenterHeading

How to center or right-justify headings instead of left-justifying them

In novels, but also in older mostly humanities works, headings are often centered. Nowadays, however, headings are usually left-aligned. In KOMA-Script, however, this default can easily be changed by redefining \raggedsection.

\documentclass{scrreprt}

\usepackage{blindtext}

\letraggedsection\centering}

\begin{document}
\blinddocument
\end{document}

As the example shows, \raggedsection refers not only to the headings of the \section statement, but by default to all levels. Of course, instead of normal centering, you can also create right-aligned headings, for example. With the help of the package ragged2e even hyphenation can be enabled:

\documentclass{scrreprt}

\usepackage{ragged2e}
\usepackage{blindtext}

\let\raggedsection\RaggedLeft

\begin{document}
\chapter{Here we get a chapter heading with hyphenation}
\blindtext{5}

\blinddocument
\end{document}

However, as the example hopefully illustrates, hyphenation in headings is rather problematic, so I would recommend \raggedleft rather than \RaggedLeft here.

In some cases, centering or right-justification is desired only for chapter headings. KOMA-Script provides another statement \raggedchapter for this purpose:

\documentclass{scrreprt}

\usepackage{blindtext}

\let\raggedchapter\raggedleft

\begin{document}
\blinddocument
\end{document}

However, it seems strange to use different alignment for different headings in very similar formatting. Classical typography also clearly advises against combining differently asymmetrical typesetting or symmetrical and asymmetrical typesetting. However, it can make sense to give chapter headings a different look in general and, for example, place the number in the margin with a color background.


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.