章节编号是罗马数字,我希望它们右对齐。tocloft 包与 KOMA 脚本配合得不好。
另外,我希望只在章节号后面加一个点。节和小节号后面不加点
即 I.1 第 1 节,而非 I.1. 第 1 节
低于
\documentclass{scrbook}
\usepackage[english]{babel}
\renewcommand{\thechapter}{\Roman{chapter}}
\begin{document}
\tableofcontents
\chapter{Chapter 1}
\section{Section 1}
\subsection{Subsection 1}
\section{Section 2}
\chapter{Chapter 2}
\chapter{Chapter 3}
\end{document}
答案1
这里有一个建议,至少需要 KOMA-Script 版本 3.22。
\documentclass[
numbers=noenddot% no dot at the end of numbers like section, figure, ...
]{scrbook}[2017/01/03]% needs at least version 3.22
\usepackage[english]{babel}
\renewcommand{\thechapter}{\Roman{chapter}}
\usepackage{xpatch}
\xpatchcmd\chapterformat{\autodot}{.}{}{\PatchFailed}% dot after chapter in document header
\xpatchcmd\chaptermarkformat{\autodot}{.}{}{\PatchFailed}% dot after chapter in page header
\RedeclareSectionCommand[%
tocdynnumwidth,
tocentrynumberformat=\chapterentrynumberformat% sets the format of the chapter numbers in ToC
]{chapter}
\newcommand\chapterentrynumberformat[1]{% define the new format for the chapter numbers in ToC
\renewcommand\autodot{.}% dot after chapter
\hfill#1\enspace% align chapter numbers right
}
\usepackage{blindtext}% dummy text
\begin{document}
\tableofcontents
\blinddocument
\chapter{Chapter 2}
\chapter{Chapter 3}
\end{document}
运行三次即可获得