更改LaTex中的附录格式

更改LaTex中的附录格式,latex,r-markdown,pdflatex,sweave,cls,Latex,R Markdown,Pdflatex,Sweave,Cls,我正在使用一个文档类模板,该模板特定于我所在大学的论文格式要求。这是一个学生几年前做的,学校没有保留它。制作模板的人没有附录(或者附录格式自几年前制作以来已经更改),因为当我尝试制作附录时,格式不符合当前的格式要求。制作附录的标准方法不起作用,我在几十个其他问题/帖子/博客等上找到的许多建议也不起作用 我正在使用Rmarkdown并通过Swave从.Rnw文件编译PDF 下面是现有模板生成的内容。我包括了两个版本,一个是\chapter{}为空,另一个是我使用\chapter{appendmen

我正在使用一个文档类模板,该模板特定于我所在大学的论文格式要求。这是一个学生几年前做的,学校没有保留它。制作模板的人没有附录(或者附录格式自几年前制作以来已经更改),因为当我尝试制作附录时,格式不符合当前的格式要求。制作附录的标准方法不起作用,我在几十个其他问题/帖子/博客等上找到的许多建议也不起作用

我正在使用Rmarkdown并通过Swave从.Rnw文件编译PDF

下面是现有模板生成的内容。我包括了两个版本,一个是\chapter{}为空,另一个是我使用\chapter{appendments}

我需要的是让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\ }}
}

暴力解决方案对我来说很好(如果存在的话)。如果有人能够设置模板的格式,以便所有未来的硕士/博士生都可以包含附录,我将很乐意将模板拉出来并分支,并在注释中链接到这个问题。

我为我工作的解决方案:

\appendix
\chapter*{Appendices}% If \appendix doesn't insert a \chapter
\addcontentsline{toc}{chapter}{Appendices}% Print Appendix in ToC
\setcounter{section}{0}% Reset numbering for sections
\renewcommand{\thesection}{\Alph{section}}% Adjust section printing (from here onward)
\section{First Appendix}
\section{Second Appendix}
\section{Third Appendix}