Menu

HowTo_ParagraphNonRunin

How to display \paragraph on a line of its own instead of as a run-in headline

By default, the headings of \paragraph and \subparagraph in the KOMA-Script classes are formatted as so-called run-in headlines, as in the standard classes. This means that the headings are not placed as separate lines above the following paragraph, but as an introduction at the beginning of the paragraph:

Figure: A page with the default display from \section to \subparagraph.

The name of the commands \paragraph and \subparagraph is derived from this.

In some cases, however, it is desired that the headings are also formatted as free-standing instead, i.e. as a kind of \subsubsubsection. With the KOMA-Script classes, this is quite simple with the help of \RedeclareSectionCommand. The command has a runin attribute, which can be set to false. However, you should then also change the setting afterskip, as otherwise a negative space may be inserted after the heading and the text after the heading may cover it. In addition, the setting afterindent=false should be explicitly specified to deactivate indentation of the paragraph after the heading:

\documentclass{scrartcl}
\usepackage{blindtext}

\RedeclareSectionCommand[%
 runin=false,% not runin
 afterskip=0.5\baselineskip plus 0.5\baselineskip minus 0.25\baselineskip,% space below the heading
 afterindent=false,% no indent after the heading
]{paragraph}
\RedeclareSectionCommand[%
 runin=false,% not runin
 afterskip=0pt,% no space below the heading
 indent=0pt,% no indent of the heading
 afterindent=false% no indent after the heading
]{subparagraph}

\begin{document}
\section{section}
We have a section starting with \verb|\section|.
\subsection{Subsection}
We have here a subsection starting with \verb|\subsection|.
\subsubsection{Subsubsection}
\blindtext
\paragraph{Paragraph}
\blindtext
\subparagraph{Subparagraph}
\blindtext
\end{document}

Figure: A page with \section to \subparagraph freestanding.

Incidentally, if the levels \paragraph and \subparagraph are also to be numbered, the counter secnumdepth must be changed accordingly, for example

\setcounter{secnumdepth}{\paragraphnumdepth}% numbering including \paragraph

or

\setcounter{secnumdepth}{\subparagraphnumdepth}% numbering including \subparagraph

However, it should be noted that deep numbering should be avoided for stylistic reasons. It is also recommended that you limit yourself to a maximum of three heading levels (beside \part).

Of course, the reverse approach would also be conceivable, for example formatting \subsubsection as a runin headline. To do this, set runin=true and adjust beforeskip, afterskip and, if necessary, afterindent according to your own wishes.


Related

Wiki (English): HowTo_Headings
Wiki (English): HowTo_SectionPrefix

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.