我正在尝试创建目录,但我希望文本“附录”的字体大小与部分(调查)相同。我怎样才能增加字体大小?此外,我尝试过\addcontentsline{toc}{part}{Appendices}
,但标题为“调查附录”(失败了...),而且我似乎无法更改cftpartpresnum
。这是我的 MWE:
\documentclass[openany]{book}
\usepackage[margin=1in, headheight=4em]{geometry}
\geometry{letterpaper} % ... or a4paper or a5paper or ...
\usepackage{calc}
%% Rename "Part" to "Investigation" and append that label to the table of
%% contents
\renewcommand{\partname}{Investigation}
\renewcommand{\chaptername}{Investigation \Roman{part} --- Part}
\renewcommand{\thepart}{\Roman{part}:}
\makeatletter\@addtoreset{chapter}{part}\makeatother%
\usepackage{tocloft}
\renewcommand{\cftpartpresnum}{Investigation }
\let\cftoldpartfont\cftpartfont
\renewcommand{\cftpartfont}{\cftoldpartfont\cftpartpresnum}
\renewcommand{\cftpartaftersnumb}{:}
\setlength{\cftpartnumwidth}{\widthof{\textbf{Investigation \textrm{IV}:}}}
\renewcommand{\cftchappresnum}{Part}
\renewcommand{\cftchapaftersnum}{ -- }
\setlength{\cftchapnumwidth}{\widthof{\textbf{Part B --}}}
\setcounter{tocdepth}{0}
%% Change formatting of the part so that things can be on the same page
\usepackage{titlesec}
\titleclass{\part}{top} % make part like a chapter
\titleformat{\part}[display]{\centering\normalfont\Huge\bfseries}{\partname\ \thepart}{0pt}{\huge}
\usepackage[toc,page,title]{appendix}
%% Remove headers from blank pages
\usepackage{emptypage}
\begin{document}
\frontmatter
\tableofcontents
\chapter*{My maddness}
What can I say, I'm on a Tolkien kick.
\mainmatter
\part{The Hobbit}
\chapter{Bilbo Baggins}
\chapter{Thorin, Oin, Gloin, and the nine}
\chapter{The dragon under the mountain}
\part{The fellowship of the Ring}
\chapter{Frodo}
\chapter{Sam}
\chapter{Merry}
\chapter{Pippin}
\part{The two towers}
\chapter{Gandalf the White}
\chapter{Gimli}
\chapter{Legolas}
\part{Return of the King}
\chapter{Aragorn}
\chapter{Mount Doom}
\chapter{Who cares?}
\appendix
\begin{appendices}
\chapter{Concerning Hobbits}
\chapter{Maps}
\end{appendices}
\end{document}
另外,如果附录标签中的 A 和 B 前面的“部分”消失,那就太好了。但每次只解决一个问题。
答案1
我找到了答案这个问题并在这里应用它。
- 我删除了附录包
\appendix
我添加了下面的宏的重新定义\makeatletter \g@addto@macro\appendix{% \addtocontents{toc}{% \protect\renewcommand{\protect\cftpartpresnum}{}% \protect\renewcommand{\protect\cftchappresnum}{\appendixname\space}% \protect\setlength{\protect\cftchapnumwidth}{\widthof{\textbf{Appendix B --}}} }% } \makeatother
然后我在最后添加了这一行:
\appendix
\addcontentsline{toc}{part}{Appendices}
\chapter{Concerning Hobbits}
\chapter{Maps}
\end{document}