如何引用具有相应零件编号的部分(TOC 冲突)

如何引用具有相应零件编号的部分(TOC 冲突)

环境:

我正在写一篇论文,它由两部分组成,这两部分必须完全独立,但使用相同的结构,即两者都包含例如“数据”章节。因此,章节按照部分编号(罗马)进行编号,例如第 I.3 章或第 II.2 章。下面的 MWE 执行此操作并设置标题(感谢 esdd,页眉中的部件编号 + 章节 (scrlayer-scrpage))。

问题:

不幸的是,使用此解决方案会对目录产生影响,因为较高零件编号(从 II 开始)的空格似乎消失了,例如:“II.2Heading on level 0”,其中“2”和“H”之间缺少“ ”。有办法解决这个问题吗?

电流输出(toc):

目录冲突

不幸的是,我不太熟悉如何操作目录(并且在所有章节名称前添加‘\’似乎不正确),因此我非常感谢大家的帮助!

梅威瑟:

\documentclass{book}

\usepackage{blindtext}
\usepackage[markcase=used]{scrlayer-scrpage}

%headers setup
\providepairofpagestyles{thesisSimple}{%
\clearpairofpagestyles
\automark[chapter]{chapter}
\ihead{\headmark}
\ohead[\pagemark]{\pagemark}
}
\ifoot{}
\ofoot{}
\pagestyle{thesisSimple}
\providepairofpagestyles[thesisSimple]{thesis}{%
\automark*[section]{}%
}
\providepairofpagestyles[thesisSimple]{review}{%
\ofoot[\shorttitle/\authorname]{\shorttitle/\authorname}
\ifoot[\today]{\today}
}
\pagestyle{thesis}

%adjust chapter names to include part number for uniqueness
\renewcommand\thechapter{\thepart.\arabic{chapter}} %following the suggestion of esdd

\begin{document}

\tableofcontents

\part{First part}
\blinddocument

\part{Second part}
\blinddocument

\end{document}

答案1

一种可能性是tocbasic

\documentclass{book}
\usepackage{blindtext}
\usepackage[markcase=used]{scrlayer-scrpage}

%headers setup
\providepairofpagestyles{thesisSimple}{%
\clearpairofpagestyles
\automark[chapter]{chapter}
\ihead{\headmark}
\ohead[\pagemark]{\pagemark}
}
\ifoot{}
\ofoot{}
\pagestyle{thesisSimple}
\providepairofpagestyles[thesisSimple]{thesis}{%
\automark*[section]{}%
}
\providepairofpagestyles[thesisSimple]{review}{%
\ofoot[\shorttitle/\authorname]{\shorttitle/\authorname}
\ifoot[\today]{\today}
}
\pagestyle{thesis}

%adjust chapter names to include part number for uniqueness
\renewcommand\thechapter{\thepart.\arabic{chapter}} %following the suggestion of esdd

\usepackage{tocbasic}
\DeclareTOCStyleEntry[numwidth=2.3em]{tocline}{chapter}
\DeclareTOCStyleEntry[indent=2.3em,numwidth=2.8em]{tocline}{section}
\DeclareTOCStyleEntry[indent=5.1em,numwidth=3.7em]{tocline}{subsection}

\begin{document}
\tableofcontents
\part{First part}
\blinddocument
\part{Second part}
\blinddocument
\end{document}

在此处输入图片描述


另一种可能性是包tocloft

\documentclass{book}
\usepackage{blindtext}
\usepackage[markcase=used]{scrlayer-scrpage}

%headers setup
\providepairofpagestyles{thesisSimple}{%
\clearpairofpagestyles
\automark[chapter]{chapter}
\ihead{\headmark}
\ohead[\pagemark]{\pagemark}
}
\ifoot{}
\ofoot{}
\pagestyle{thesisSimple}
\providepairofpagestyles[thesisSimple]{thesis}{%
\automark*[section]{}%
}
\providepairofpagestyles[thesisSimple]{review}{%
\ofoot[\shorttitle/\authorname]{\shorttitle/\authorname}
\ifoot[\today]{\today}
}
\pagestyle{thesis}

%adjust chapter names to include part number for uniqueness
\renewcommand\thechapter{\thepart.\arabic{chapter}} %following the suggestion of esdd

\usepackage[titles]{tocloft}
\setlength{\cftchapnumwidth}{2.3em}
\setlength{\cftsecindent}{2.3em}
\setlength{\cftsecnumwidth}{2.8em}
\setlength{\cftsubsecindent}{5.1em}
\setlength{\cftsubsecnumwidth}{3.7em}

\begin{document}
\tableofcontents
\part{First part}
\blinddocument
\part{Second part}
\blinddocument
\end{document}

相关内容