我想自定义目录(KOMA-Script 类 scrbook)。我想 (1) 减少章节条目之间的间距,(2) 缩进章节条目,(3) 使部分条目的字体更大。如何实现?我阅读了 KOMA-Script 指南,但对其中的选项感到困惑tocbasic
。
\documentclass{scrbook}
\KOMAoptions{paper=
128.5mm:198.4mm, %(5,06" x 7,91") %ziel
DIV=9, %ziel kleines buch
fontsize=12pt,
}
%%%% Sprache
\usepackage[german]{babel} %scheint
%%%% table of content
\setcounter{tocdepth}{0} % 1 gibt parts und chapter und sections
%%% schrift fuer alle eintraege
\setkomafont{disposition}{\rmfamily\normalcolor}
%conflict with specific settings
%
%%for table of content
\setkomafont{partentry}{\mdseries\scshape\lowercase} %\LARGE loop
\setkomafont{chapterentry}{\mdseries\scshape\lowercase}
%
\usepackage{fontspec}
%%%%% FONTS
\newfontfamily{\titlefont}{CormorantGaramond} %for the titles
\begin{document}
\frontmatter
\tableofcontents
\mainmatter
\part{ Philosophie}
\chapter{ \textit{Vom Schreiben}}
Man spricht davon, dass es heute schwierig sei zu schreiben.
\end{document}
答案1
要么使用\DeclareTOCStyleEntry
\DeclareTOCStyleEntry[
entryformat=\mdseries\scshape\LARGE,
pagenumberformat=\normalfont\normalsize
]{tocline}{part}
\DeclareTOCStyleEntry[
indent=2em,
beforeskip=0pt plus .2pt,
entryformat=\scshape
]{tocline}{chapter}
或\RedeclareSectionCommand
(相同选项但带有前缀toc
):
\RedeclareSectionCommand[
tocentryformat=\mdseries\scshape\LARGE,
tocpagenumberformat=\normalfont\normalsize
]{part}
\RedeclareSectionCommand[
tocindent=2em,
tocbeforeskip=0pt plus .2pt,
tocentryformat=\scshape
]{chapter}
补充说明:不要在或\lowercase
的第二个参数中使用,因为它们不是字体更改命令。\setkomafont
\addtokomafont
\lowercase
建议:
\documentclass{scrbook}
\KOMAoptions{
paper=128.5mm:198.4mm,
DIV=9,
fontsize=12pt
}
\usepackage[ngerman]{babel}% ngerman
\usepackage{fontspec}
%\newfontfamily{\titlefont}{CormorantGaramond}% \titlefont is already defined!
\setkomafont{disposition}{\rmfamily\normalcolor}
\RedeclareSectionCommand[
tocentryformat=\mdseries\scshape\LARGE,
tocpagenumberformat=\normalfont\normalsize
]{part}
\renewcommand*{\addparttocentry}[2]{%
\addtocentrydefault{part}{\lowercase{#1}}{\lowercase{#2}}%
}
\RedeclareSectionCommand[
tocindent=2em,
tocbeforeskip=0pt plus .2pt,
tocentryformat=\scshape
]{chapter}
\newcommand*{\originaladdchaptertocentry}{}
\let\originaladdchaptertocentry\addchaptertocentry
\renewcommand*{\addchaptertocentry}[2]
{\originaladdchaptertocentry{#1}{\lowercase{#2}}}
\begin{document}
\frontmatter
\tableofcontents
\mainmatter
\part{ Philosophie}
\chapter{\textit{Vom Schreiben}}
Man spricht davon, dass es heute schwierig sei zu schreiben.
\chapter{Weiteres Kapitel}
\end{document}
答案2
即使不建议在 KOMA-Script 类中使用,但我发现tocloft
包裹易于使用且高效,可在短时间内获得书籍的良好目录。我从未遇到过与课程结合的问题scrbook
。
你可以使用这样的方法:
\usepackage{tocloft}
\setlength{\cftaftertoctitleskip}{0cm}
\renewcommand{\cftdot}{\normalfont\normalsize.}
\setlength{\cftbeforepartskip}{0.5cm}
\setlength{\cftpartnumwidth}{1em}
\renewcommand{\cftpartdotsep}{\cftnodots}
\renewcommand{\cftpartfont}{\mdseries\scshape\large}
\renewcommand{\cftpartpagefont}{\normalfont}
\setlength{\cftbeforechapskip}{0.1cm}
\setlength{\cftchapindent}{1em}
\renewcommand{\cftchapdotsep}{\cftnodots}
\renewcommand{\cftchapfont}{\mdseries\scshape}
\renewcommand{\cftchappagefont}{\normalfont}