付録の書式をカスタマイズする必要がある - 目次とテキストの両方

付録の書式をカスタマイズする必要がある - 目次とテキストの両方

私は大学の論文フォーマット要件に固有のドキュメントクラステンプレートを使用しています(utexastheses.cls)。これは数年前に学生が作成したもので、大学では管理されていません。テンプレートを作成した人は付録を持っていませんでした (または、付録のフォーマットが数年前に作成されてから変更されています)。付録を作成しようとすると、フォーマットが現在のフォーマット要件に準拠していないためです。付録を作成するための標準的なアプローチは機能せず、他の多くの質問/投稿/ブログなどで見つけた多くの提案も機能しません。

私は Rmarkdown を使用しており、Sweave 経由で .Rnw ファイルから PDF をコンパイルしています。

以下は、既存のテンプレートで生成されるものです。\chapter{} が空白のバージョンと、\chapter{Appendices} を使用するバージョンの 2 つが含まれています。

使うときは

\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

必要なのは、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\ }}
}

強引な解決策でも構いません (もし存在するなら)。将来の修士課程/博士課程の学生全員が付録を含めることができるようにテンプレートをフォーマットできる人がいれば、喜んでテンプレートをプルして分岐させ、メモにこの質問へのリンクを貼ります。

答え1

ここで必要な解決策を見つけました:付録のカスタム目次

それはまさに私が必要としていたものではありませんでしたが、ほんの少しの変更を加えるだけで、何をすべきかがわかるほどには近かったです。

関連情報