11

Why does \subsubsubsection not work for \documentclass{scrbook} and how can I force it anyway?

There is a MWE:

\documentclass{scrbook}
\setcounter{secnumdepth}{3}
\begin{document}
\chapter{Chapter}
\section{Section}
\subsection{Subsection}
\subsubsection{Subsubsection}
\subsubsubsection{Subsubsubsection}
\end{document}

With this MWE a get an error: "undefined control sequence \subsubsubsection" and the pdf looks like this:

enter image description here

But I need "1.1.1.1.1. Subsubsubsection" in the last line.

8
  • 3
    \paragraph is the next level after \subsubsection. Set the secnumdepth to 4, if you want it numbered as well.
    – Troy
    Commented Mar 2, 2017 at 16:06
  • I have the same problem and I use \paragraph{} or \subsubsection*{}.
    – domi
    Commented Mar 2, 2017 at 16:06
  • 2
    See this, and this..
    – Troy
    Commented Mar 2, 2017 at 16:07
  • 1
    @Troy The questions aims at KOMA-script. The solutions you are refering to seem to require a standard documentclass. Years ago I used the alnumsec package for the additional level, but maybe KOMA-script supports additional levels out of the box now.
    – Keks Dose
    Commented Mar 2, 2017 at 16:12
  • 1
    @samcarter That's not the issue. The questions are different, the older questions use standard classes, this one a KOMA-script class. The answers here are not a hack into the internals of LaTeX, but use a well documented feature of KOMA-script.
    – Keks Dose
    Commented Mar 3, 2017 at 12:16

3 Answers 3

16

Update (needs KOMA-Script version 3.26b)

The original answer below is still correct. But there are the new command \RedeclareSectionCommands, the new options runin and afterindent. And there are some options predefined for new section levels using style=section.

Suggestion 1: Declaring new section level subsubsubsection as a displayed title

\documentclass{scrbook}

\DeclareNewSectionCommand[
  style=section,
  counterwithin=subsubsection,
  afterskip=1.5ex plus .2ex,
  beforeskip=3.25ex plus 1ex minus .2ex,
  afterindent=false,
  level=\paragraphnumdepth,
  tocindent=10em,
  tocnumwidth=5em
]{subsubsubsection}
\setcounter{secnumdepth}{\subsubsubsectionnumdepth}
\setcounter{tocdepth}{\subparagraphtocdepth}

\RedeclareSectionCommands[
  level=\numexpr\subsubsubsectionnumdepth+1\relax,
  toclevel=\numexpr\subsubsubsectiontocdepth+1\relax,
  increaselevel
]{paragraph,subparagraph}
\RedeclareSectionCommand[
  counterwithin=subsubsubsection,
  tocindent=12em,
  tocnumwidth=6em
]{paragraph}
\RedeclareSectionCommand[
  tocindent=14em,
  tocnumwidth=7em
]{subparagraph}

\usepackage{lipsum}% only for dummy text
\begin{document}
\tableofcontents
\chapter{Chapter}
\section{Section}
\subsection{Subsection}
\subsubsection{Subsubsection}
\subsubsubsection{Subsubsubsection}
\lipsum[1-2]
\end{document}

Suggestion 2: Redefining paragraph as a displayed title:

\documentclass{scrbook}

\RedeclareSectionCommand[
  afterskip=1.5ex plus .2ex,
  afterindent=false
]{paragraph}
\setcounter{secnumdepth}{\paragraphnumdepth}
\setcounter{tocdepth}{\paragraphtocdepth}

\usepackage{lipsum}% dummy text
\begin{document}
\tableofcontents
\chapter{Chapter}
\section{Section}
\subsection{Subsection}
\subsubsection{Subsubsection}
\paragraph{Paragraph}
\lipsum[1-2]
\end{document}

Original answer

You can declare a new section level subsubsubsection. But then you have to redeclare paragraph and subparagraph to adjust the its levels etc.:

\documentclass{scrbook}

\DeclareNewSectionCommand[
  style=section,
  counterwithin=subsubsection,
  font=\normalsize,
  afterskip=1.5ex plus .2ex,
  beforeskip=-3.25ex plus -1ex minus -.2ex,
  indent=0pt,
  level=4,
  tocstyle=section,
  toclevel=4,
  tocindent=10em,
  tocnumwidth=5em
]{subsubsubsection}
\setcounter{secnumdepth}{\subsubsubsectionnumdepth}
\setcounter{tocdepth}{\subsubsubsectiontocdepth}

\RedeclareSectionCommand[
  level=5,
  counterwithin=subsubsubsection,
  toclevel=5,
  tocindent=12em,
  tocnumwidth=6em
]{paragraph}
\RedeclareSectionCommand[
  level=6,
  toclevel=6,
  tocindent=14em,
  tocnumwidth=7em
]{subparagraph}

\usepackage{lipsum}% only for dummy text
\begin{document}
\tableofcontents
\chapter{Chapter}
\section{Section}
\subsection{Subsection}
\subsubsection{Subsubsection}
\subsubsubsection{Subsubsubsection}
\lipsum[1-2]
\end{document}

enter image description here


If do not use \paragraph as a runin title, you can redeclare section level paragraph using a positive value for afterskip:

\documentclass{scrbook}

\RedeclareSectionCommand[
  afterskip=1.5ex plus .2ex,
  beforeskip=-3.25ex plus -1ex minus -.2ex
]{paragraph}
\setcounter{secnumdepth}{\paragraphnumdepth}
\setcounter{tocdepth}{\paragraphtocdepth}

\usepackage{lipsum}% dummy text
\begin{document}
\tableofcontents
\chapter{Chapter}
\section{Section}
\subsection{Subsection}
\subsubsection{Subsubsection}
\paragraph{Paragraph}
\lipsum[1-2]
\end{document}

enter image description here

6

The easiest way is to use \paragraph and to redefine its formatting:

\documentclass{scrbook}
\setcounter{secnumdepth}{5}

\RedeclareSectionCommand[
    counterwithin=subsubsection,
    toclinefill=\hfill,
    tocindent=3.5ex,
    tocnumwidth=1ex,
    tocdynnumwidth=true, 
    tocraggedentrytext=true,
    tocentryformat=\fontintoc\itshape,
    tocpagenumberformat=\fontintoc,
    beforeskip=10pt,%
    afterskip=1pt,
    font=\normalfont\itshape
    ]{paragraph}



    \begin{document}

\chapter{Chapter}
\section{Section}
\subsection{Subsection}
\subsubsection{Subsubsection}
\paragraph{Subsubsubsection}
\end{document}

enter image description here

5

If you want to leave \paragraph and \subparagraph as is, then you need only new level numbers for it and can then define \subsubsubsection:

\documentclass{scrbook}
\RedeclareSectionCommand[level=6,toclevel=6]{subparagraph}
\RedeclareSectionCommand[level=5,toclevel=5]{paragraph}    
\DeclareSectionCommand[
  style=section,
  counterwithin=subsubsection,
  font=\normalsize,
  afterskip=1ex plus .2ex,
  beforeskip=-3.25ex plus -1ex,
  indent=0pt,
  level=4,
  tocstyle=section,
  toclevel=4,
  tocindent=10em,
  tocnumwidth=5em
]{subsubsubsection}

\setcounter{secnumdepth}{\subsubsubsectionnumdepth}
\setcounter{tocdepth}{\subsubsubsectiontocdepth}

\usepackage{lipsum}% only for dummy text
\begin{document}
    \tableofcontents
    \chapter{Chapter}
    \section{Section}
    \subsection{Subsection}
    \subsubsection{Subsubsection}
    \subsubsubsection{Subsubsubsection}
    \lipsum[1-2]
\paragraph{foo} \lipsum[1]
\subparagraph{bar} \lipsum[1]
\end{document}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .