如何在 KOMA 脚本中创建高于章节但低于部分的层次标题

如何在 KOMA 脚本中创建高于章节但低于部分的层次标题

我正在使用 KOMA Script 处理一份法律文件,我需要为章节创建一个更高级别的标题,用“标题”而不是“章节”来代替,但没有编号,因为编号将按序数排列,并且使用单词而不是数字,即“第一个标题”、“第二个标题”等等...此外,其中一些“标题”会有一个名称,它应该是一个可选参数,例如“第四个标题:常设委员会”。

我知道 titlesec 存在,而且对于这种情况来说,它是一个很好的软件包,但由于我正在使用KOMA Script,我很确定在 中还有其他方法可以做到这一点KOMA Script,但我不知道是哪一种。有什么线索吗?

就目前而言,MWE 尝试可能如下:

 \documentclass[fontsize=12pt,paper=letter,headings=small,DIV=calc,headsepline=true,titlepage=on,BCOR=5mm,parskip=half*]{scrbook}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\begin{document}
\part[First Title]{First title: the title of this first title}

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
\end{document}

更新

为了响应展示我正在处理的文档(宪法)结构的请求,我添加了最具代表性的页面之一的图像。

Representative page of the Constitution

我遇到问题的部分是我已经提到的部分。我不知道这是我的国家或我所在语言的法律文件所特有的问题,还是全世界法律文件的共同特征,但我的印象是,它是结构相当不规则的文件,解决了同一文件中不同(和不同)形式的某些需求。

在这种情况下,我将宪法条款分为段落,将其他条款分为具有不同枚举顺序的部分(通常如此),有时除了部分之外,还有另一种覆盖部分的部分。


我的兴趣不在于纠正或标准化所有这些不一致之处,而在于将它们写下来,并按时间顺序展示宪法生效一个世纪以来起草过程中发生的变化(非常多)。

答案1

我只需重新定义\part以生成没有前缀行的章节样式的标题并更改计数器的输出part,例如

\documentclass[fontsize=12pt,paper=letter,headings=small,DIV=calc,headsepline=true,titlepage=on,BCOR=5mm,parskip=half*]{scrbook}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\newcommand*{\OrdWord}[1]{%
  \ifcase#1 0\or First\or Second\or Third\or Forth\else to large\fi
}
\renewcommand*{\thepart}{\OrdWord{\value{part}}}
\renewcommand*{\partformat}{\thepart~Title}
\renewcommand*{\addparttocentry}[2]{%
  \IfArgIsEmpty{#1}{%
    \addtocentrydefault{part}{}{#2}%
  }{%
    \addtocentrydefault{part}{#1~Titel}{}%
  }%
}
\RedeclareSectionCommand[style=chapter]{part}
\usepackage{lipsum}
\begin{document}
\tableofcontents
\part{: the title of this first title}

\lipsum
\part{~}
\lipsum

\end{document}

对于没有附加标题的部分,您必须使用\part{~}而不是,因为不会在目录中产生任何条目。请根据需要进行扩展。\part{}\part{}\OrdWord

如果chapter计数器应该与计数器的增加有关,part您可以添加

\RedeclareSectionCommand[counterwithin=part]{chapter}

另外,你可以定义一个新命令:

\documentclass[fontsize=12pt,paper=letter,headings=small,DIV=calc,headsepline=true,titlepage=on,BCOR=5mm,parskip=half*]{scrbook}[2017/12/04]
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\newcommand*{\OrdWord}[1]{%
  \ifcase#1 0\or First\or Second\or Third\or Forth\else to large\fi
}
\DeclareSectionCommand[style=chapter,level=-1,tocstyle=chapter,tocindent=0pt,tocnumwidth=6em]{Title}
\RedeclareSectionCommand[counterwithin=Title]{chapter}
\renewcommand*{\thechapter}{\arabic{chapter}}
\RedeclareSectionCommand[level=-2,toclevel=-2]{part}
\renewcommand*{\theTitle}{\OrdWord{\value{Title}}}
\renewcommand*{\Titleformat}{\theTitle~Title}
\renewcommand*{\addTitletocentry}[2]{%
  \IfArgIsEmpty{#1}{%
    \addtocentrydefault{Title}{}{#2}%
  }{%
    \addtocentrydefault{Title}{#1~Titel}{}%
  }%
}
\usepackage{lipsum}
\begin{document}
\tableofcontents
\Title{: the title of this first title}

\lipsum
\chapter{First Test Chapter in First Title}
\lipsum
\Title{~}
\lipsum
\chapter{First Test Chapter in Second Title}
\lipsum

\end{document}

第二个示例的输出(第一个类似):

Table of ContentsFirst TitleSecond Title

请注意,您需要最新的 KOMA 脚本对于第二个示例。您可以对 KOMA-Script 3.22 或 3.23 执行相同操作,但需要在命令声明时设置其他选项\Title,例如:

\DeclareSectionCommand[style=chapter,level=-1,pagestyle=plain,beforeskip=2em,innerskip=0pt,afterskip=1em,font=\huge,prefixfont=\huge,tocstyle=chapter,tocindent=0pt,tocnumwidth=6em]{Title}

相关内容