我正在使用特定于我大学论文格式要求的文档类模板。它是一个学生几年制作的,大学不维护它。制作模板的人没有附录(或者自从几年前制作后,附录格式发生了变化),因为当我尝试制作附录时,格式不符合当前的格式要求。制作附录的标准方法不起作用,我在其他几十个问题/帖子/博客/等上找到的许多建议也不起作用。
我正在使用 Rmarkdown 并通过 Sweave 从 .Rnw 文件编译 PDF。
以下是现有模板生成的内容。我包含了两个版本,一个是 \chapter{} 是空白的,一个是我使用 \chapter{Appendices}。
我需要的是让 TOC 看起来像:
Appendices 128
Appendix A The CATE as a ratio of covariances .............. 128
Appendix B CATE in Morgan and Winship (2014) ............... 130
Appendix C Data-Generating Syntax .......................... 132
Appendix D Estimator Syntax ................................ 136
我需要文本以“附录 A”开头,并在页面顶部居中并对齐(对于其他附录,依此类推)。我不能将“附录”作为标题 - 它需要直接跳转到显示各个附录名称。
我已经粘贴了我认为来自文档类模板的相关部分。如果我没有包含一些重要信息,请告诉我,我将编辑我的问题以包含该信息。
% table of contents configuration
\RequirePackage[nottoc]{tocbibind}
\RequirePackage{tocloft}
\renewcommand{\contentsname}{Table of Contents} % default: Contents
\renewcommand{\cftdotsep}{0.25} % default: 4.5
% Prefix chapter numbers with "Chapter " and add space as needed
\renewcommand{\cftchappresnum}{\@chapapp\ }
\newlength{\cftchappresnum@width}
\settowidth{\cftchappresnum@width}{\cftchappresnum}
\addtolength{\cftchapnumwidth}{\cftchappresnum@width}
% chapter heading configuration
% simplified version of the original from report.cls
\def\@makechapterhead#1{{%
\centering\headingsize
% print "Chapter N"
\@chapapp\space\thechapter
\par\nobreak
\vskip.25\baselineskip
\@makeschapterhead{#1}
}}
% star-chapter variation
\def\@makeschapterhead#1{{
\centering\headingsize
% prevent page break between following lines at all costs
\interlinepenalty=10000
\bfseries #1\par\nobreak
\vskip\baselineskip
}}
% toc/lot/lof heading configuration
\setlength{\cftbeforetoctitleskip}{\z@}
\setlength{\cftaftertoctitleskip}{.25\baselineskip}
\renewcommand{\cfttoctitlefont}{\headingsize\bfseries\hspace*{\fill}}
\renewcommand{\cftaftertoctitle}{\hspace*{\fill}}
% copy toc to lot
\setlength{\cftbeforelottitleskip}{\cftbeforetoctitleskip}
\setlength{\cftafterlottitleskip}{\cftaftertoctitleskip}
\renewcommand{\cftlottitlefont}{\cfttoctitlefont}
\renewcommand{\cftafterlottitle}{\cftaftertoctitle}
% copy toc to lof
\setlength{\cftbeforeloftitleskip}{\cftbeforetoctitleskip}
\setlength{\cftafterloftitleskip}{\cftaftertoctitleskip}
\renewcommand{\cftloftitlefont}{\cfttoctitlefont}
\renewcommand{\cftafterloftitle}{\cftaftertoctitle}
\newcommand{\maketableofcontents}{%
\clearpage
\tableofcontents
\clearpage
\listoftables
\clearpage
\listoffigures
\clearpage\pagenumbering{arabic}
}
\newcommand{\makeappendix}{%
\appendix
% ensure that the TOC picks up the redefined value of \@chapapp
\addtocontents{toc}{\protect\renewcommand\protect\cftchappresnum{\@chapapp\ }}
}
蛮力解决方案对我来说很好(如果存在的话)。如果有人能够格式化模板,以便所有未来的硕士/博士生都可以包含附录,我很乐意将模板拉出并分支,并在笔记中链接到这个问题。