需要自訂附錄格式 - 目錄和文本

需要自訂附錄格式 - 目錄和文本

我正在使用特定於我的大學論文格式要求的文檔類別範本(utexastheses.cls)。它是幾年前由一名學生製作的,大學不維護它。製作模板的人沒有附錄(或自從幾年前製作以來附錄格式已經改變),因為當我嘗試製作附錄時,格式不符合當前的格式要求。製作附錄的標準方法不起作用,我在許多其他問題/帖子/部落格/等中找到的許多建議也不起作用。

我正在使用 Rmarkdown 並透過 Sweave 從 .Rnw 檔案編譯 PDF。

以下是現有範本產生的內容。我提供了兩個版本,一個版本的 \chapter{} 為空,另一個版本使用 \chapter{Appendices}。

當我使用

\appendix
\chapter{}
\section{The CATE as a ratio of covariances}

我得到以下資訊: 目錄1 文字1

當我使用時:

\appendix
\chapter{Appendices}
\section{The CATE as a ratio of covariances}

我得到以下資訊: 目錄2 文字2

我需要的是讓目錄看起來像:

 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\ }}
}

我覺得蠻力解決方案很好(如果有的話)。如果有人能夠格式化模板,以便所有未來的碩士/博士生都可以包含附錄,我會很樂意拉出並分支模板並連結到註釋中的這個問題。

答案1

我在這裡找到了我需要的解決方案:附錄的自訂目錄

這並不完全是我所需要的,但足夠接近,我只需進行一些小的更改就可以弄清楚我需要做什麼。

相關內容