我希望 KOMA 有 2 种子小节样式:一种从新行开始,一种从同一行开始 ( \subsubsectionS
)。我以为这样可行,但实际上不行:
\RedeclareSectionCommand[%
beforeskip=0.75\baselineskip plus 2pt minus 1pt,%
afterskip=-3ex,%
runin=true, % text on same line
]{subsubsection}
\let\subsubsectionS\subsubsection % subsubsection on Same line
\RedeclareSectionCommand[%
beforeskip=0.75\baselineskip plus 2pt minus 1pt,%
afterskip=0.01mm,%
runin=false, % text on same line
]{subsubsection}
答案1
不幸的是,问题中没有 MWE,而且我不知道是否subsubsection
和subsubsectionS
应该具有相同的级别并且应该使用相同的计数器。
\RedeclareSectionCommand
根据第二个参数中的节级别的名称重新定义其他宏。因此您的解决方案无法起作用。
您必须使用\DeclareNewSectionCommand
来定义subsubsectionS
。
\documentclass{scrartcl}
\usepackage{blindtext}
\RedeclareSectionCommand[%
beforeskip=0.75\baselineskip plus 2pt minus 1pt,%
afterskip=0pt,%
runin=false,
]{subsubsection}
\DeclareTOCStyleEntry[
level:=subsubsection,
indent:=subsubsection,
numwidth:=subsubsection
]{tocline}{subsubsectionS}
\DeclareNewSectionCommand[%
style=section,
level=\subsubsectionnumdepth,
counterwithin=subsection,
beforeskip=0.75\baselineskip plus 2pt minus 1pt,%
afterskip=-3ex,%
runin=true, % text on same line
indent=0pt
]{subsubsectionS}
\makeatletter
\let\c@subsubsectionS\c@subsubsection% use the same counter as subsubsection
\let\cl@subsubsectionS\cl@subsubsection% use the same reset list as subsubsection
\makeatother
\begin{document}
\tableofcontents
\section{A section}
\subsection{A subsection}
\subsubsection{A subsubsection}\blindtext
\subsubsectionS{A subsubsectionS}\blindtext
\subsection{Next subsubsection}
\subsubsectionS{Another subsectionS}\blindtext
\subsubsection{Another subsection}\blindtext
\end{document}
评论::
可选参数中的语法仅在 KOMA-Script 版本 3.27 中可用。但您也可以通过\DeclareTOCStyleEntry
定义设置style
、level
和。然后它们都被赋予前缀,indent
并且必须指定显式值。这也适用于较旧的 KOMA-Script 版本。numwidth
\DeclareNewSectionCommand
toc
\DeclareNewSectionCommand[%
style=section,
level=\subsubsectionnumdepth,
counterwithin=subsection,
beforeskip=0.75\baselineskip plus 2pt minus 1pt,%
afterskip=-3ex,%
runin=true, % text on same line
indent=0pt,
tocstyle=tocline,
toclevel=\subsubsectiontocdepth,
tocindent=3.8em,
tocnumwidth=3.2em
]{subsubsectionS}