CRu*_*yon 1 latex pdflatex sweave r-markdown cls
我正在使用特定于我的大学论文格式要求的文档类模板。这是一个学生几年前制作的,大学不维护它。制作模板的人没有附录(或者自从几年前制作以来附录格式已经改变),因为当我尝试制作附录时,格式不符合当前的格式要求。制作附录的标准方法不起作用,我在许多其他问题/帖子/博客/等中找到的许多建议也不起作用。
我正在使用 Rmarkdown 并通过 Sweave 从 .Rnw 文件编译 PDF。
以下是现有模板生成的内容。我提供了两个版本,一个版本的 \chapter{} 为空,另一个版本使用 \chapter{Appendices}。
我需要的是使目录看起来像:
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
Run Code Online (Sandbox Code Playgroud)
我需要文本以“附录 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\ }}
}
Run Code Online (Sandbox Code Playgroud)
我觉得蛮力解决方案很好(如果存在的话)。如果有人能够格式化模板,以便所有未来的硕士/博士生都可以包含附录,我将很乐意拉出并分支模板并链接到注释中的这个问题。
我在其他地方找到的这个解决方案对我有用:
\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}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
14871 次 |
| 最近记录: |