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.

  • 3
    \paragraph is the next level after \subsubsection. Set the secnumdepth to 4, if you want it numbered as well. – Troy Mar 02 '17 at 16:06
  • I have the same problem and I use \paragraph{} or \subsubsection*{}. – domi Mar 02 '17 at 16:06
  • 2
    See this, and this.. – Troy Mar 02 '17 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 Mar 02 '17 at 16:12
  • @KeksDose True. It's not an exact duplicate, but I figured since the solution was the same.. – Troy Mar 02 '17 at 16:14
  • How can you mark a question as a duplicate, when answers here and there have completely different solutions? – Keks Dose Mar 03 '17 at 11:33
  • @KeksDose Just because the solutions are different does not mean that they are wrong. http://tex.stackexchange.com/a/186982/36296 works perfectly well for the MWE of this question. – samcarter_is_at_topanswers.xyz Mar 03 '17 at 12:11
  • 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 Mar 03 '17 at 12:16

3 Answers3

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

esdd
  • 85,675
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

Keks Dose
  • 30,892
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}