首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >更改LaTex中的附录格式

更改LaTex中的附录格式
EN

Stack Overflow用户
提问于 2020-03-21 03:11:09
回答 1查看 5.9K关注 0票数 1

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

我正在使用Rmarkdown和编译的.Rnw文件通过斯威夫。

下面是现有模板生成的内容。我已经包含了两个版本,一个是\章节{}为空的版本,另一个是我使用\章节{附录}的版本。

我需要的是让TOC看起来像:

代码语言:javascript
复制
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”居中,并在页面顶部对齐(以及其他其他附录的其他)。我不能将"Appendices“作为标题-它需要直接跳到显示单个附录名称。

我已经粘贴了我认为是来自document类模板的相关部分。如果我没有包括一些重要的信息,请告诉我,我将编辑我的问题以包括这些信息。

代码语言:javascript
复制
% 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\ }}
}

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

EN

回答 1

Stack Overflow用户

发布于 2020-11-30 23:04:50

这个我found elsewhere为我工作的解决方案:

代码语言:javascript
复制
\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}
票数 3
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/60780283

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档