TransWikia.com

Need to Customize Appendix Formatting - both in TOC and Text

TeX - LaTeX Asked by CRunyon on May 17, 2021

I am using a document class template that is specific to my university’s dissertation formatting requirements (the utexastheses.cls). It was made by a student a few years ago, and the university does not maintain it. Whoever made the template did not have an appendix (or the appendix formatting has changed since it was made a few years ago), because when I try to make an appendix the formatting does not comply with current formatting requirements. The standard approaches to making an appendix do not work, nor do many of the suggestions I’ve found on dozens of other questions / posts / blogs / etc.

I am using Rmarkdown and compiling the PDF from a .Rnw file via Sweave.

Below is what is produced by the existing template. I have included two versions, one where the chapter{} is blank, and one where I use chapter{Appendices}.

When I use

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

I get the following:
toc1
text1

When I use:

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

I get the following:
toc2
text2

What I need is to have the TOC to look like:

 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

And I need the text to start with just “Appendix A” centered and justified at the top of the page (and so on for each other other appendices). I cannot have “Appendices” as a header – it needs to jump straight to displaying the individual appendix names.

I’ve pasted what I believe are the relevant bits from the document class template; the entire template can be found here. If I have not included some important information, please let me know and I will edit my question to include that information.

% 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{{%
  centeringheadingsize
  % print "Chapter N"
  @chapappspacethechapter
  parnobreak
  vskip.25baselineskip
  @makeschapterhead{#1}
}}
% star-chapter variation
def@makeschapterhead#1{{
  centeringheadingsize
  % prevent page break between following lines at all costs
  interlinepenalty=10000
  bfseries #1parnobreak
  vskipbaselineskip
}}

% toc/lot/lof heading configuration
setlength{cftbeforetoctitleskip}{z@}
setlength{cftaftertoctitleskip}{.25baselineskip}
renewcommand{cfttoctitlefont}{headingsizebfserieshspace*{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
  clearpagepagenumbering{arabic}
}

newcommand{makeappendix}{%
  appendix
  % ensure that the TOC picks up the redefined value of @chapapp
  addtocontents{toc}{protectrenewcommandprotectcftchappresnum{@chapapp }}
}

A brute force solution is fine by me (if one exists). If someone is able to format the template so all future masters/doctoral students can include appendices, I’ll gladly pull and branch the template and link to this question in the notes.

One Answer

I found the solution I needed here: Custom ToC for appendices

It wasn't exactly what I needed, but close enough that I could figure out what I needed to do with only a few small changes.

Answered by CRunyon on May 17, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP