为什么 \subsubsubsection 对 \documentclass{scrbook} 不起作用以及我该如何强制使用它?
有一个 MWE:
\documentclass{scrbook}
\setcounter{secnumdepth}{3}
\begin{document}
\chapter{Chapter}
\section{Section}
\subsection{Subsection}
\subsubsection{Subsubsection}
\subsubsubsection{Subsubsubsection}
\end{document}
使用此 MWE 会出现错误:“未定义的控制序列 \subsubsubsection”,并且 pdf 如下所示:
但是我需要最后一行“1.1.1.1.1. Subsubsubsection”。
答案1
更新(需要 KOMA-Script 版本 3.26b)
下面的原始答案仍然是正确的。但是有新的命令\RedeclareSectionCommands
、新的选项runin
和afterindent
。并且使用为新的部分级别预定义了一些选项style=section
。
建议 1:将新部分级别声明subsubsubsection
为显示标题
\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}
建议2:重新定义paragraph
为显示标题:
\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}
原始答案
您可以声明一个新的部分级别subsubsubsection
。但随后您必须重新声明paragraph
并subparagraph
调整其级别等:
\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}
如果不使用\paragraph
作为 runin 标题,则可以paragraph
使用正值重新声明节级别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}
答案2
最简单的方法是使用\paragraph
并重新定义其格式:
\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}
答案3
如果您想保留\paragraph
原样\subparagraph
,那么您只需要新的级别编号,然后可以定义\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}