
I want to change the alignment of the appendices. I'm using
\documentclass[12pt]{report}
...
\usepackage{titletoc}
\usepackage[toc,titletoc]{appendix}
\usepackage{tocloft}
\renewcommand{\cftchapleader}{\cftdotfill{\cftdotsep}} % for chapters
\renewcommand{\cftchapfont}{\uppercase}
\renewcommand{\cftchappagefont}{}
\renewcommand{\cfttoctitlefont}{\hfill\uppercase}
\renewcommand{\cftaftertoctitle}{\hfill}
\setlength{\cftbeforetoctitleskip}{-3em}
\renewcommand{\cftloftitlefont}{\hfill\uppercase}
\renewcommand{\cftafterloftitle}{\hfill}
\setlength{\cftbeforeloftitleskip}{-3em}
\renewcommand{\cftlottitlefont}{\hfill\uppercase}
\renewcommand{\cftafterlottitle}{\hfill}
\setlength{\cftbeforelottitleskip}{-3em}
I'm having to modify a couple other things. This is what I have.
APPENDICES................. 10
APPENDIX A ................ 13
APPENDIX B ................ 15
This is what I need.
APPENDICES................. 10
APPENDIX A ............. 13
APPENDIX B ............. 15
Responder1
One possibility is to use \titlecontents
from the titletoc
package.
Remarks:
Notice that the
titletoc
option for theappendix
package is no longer needed.\uppercase
is a TeX command that shouldn't be used in LaTeX documents; one can use\MakeUppercase
instead; however, both these commands receive an argument, so the use of\uppercase
(or\MakeUppercase
) as it was being done in the example provided in the question will produce errors.Notice also that some of the original settings were replaced for some redefinitions and patches in my answer; in particular, I used a redefinition of
\l@chapter
to use the dotted leaders and to style the chapter entries using upper case. The internal commands\@cftmaketoctitle
,\@cftmakeloftitle
, and\@cftmakelottitle
fromtocloft
were patched (with the help of theetoolbox
package) to use upper case fonts for the titles of the ToC, LoF, and LoT, respectively.
The code:
\documentclass{report}
\usepackage[toc]{appendix}
\usepackage{titletoc}
\usepackage{tocloft}
\usepackage{etoolbox}
\usepackage{textcase}
\makeatletter
\renewcommand*\l@chapter[2]{%
\ifnum \c@tocdepth >\m@ne
\addpenalty{-\@highpenalty}%
\vskip 1.0em \@plus\p@
\setlength\@tempdima{1.5em}%
\begingroup
\parindent \z@ \rightskip \@pnumwidth
\parfillskip -\@pnumwidth
\leavevmode
\advance\leftskip\@tempdima
\hskip -\leftskip
\MakeTextUppercase{#1}\nobreak\leaders\hbox{$\m@th
\mkern \@dotsep mu\hbox{.}\mkern \@dotsep
mu$}\hfill
\nobreak\hb@xt@\@pnumwidth{\hss #2}\par
\penalty\@highpenalty
\endgroup
\fi}
\patchcmd{\@cftmaketoctitle}{\cfttoctitlefont\contentsname}{\cfttoctitlefont\MakeUppercase{\contentsname}}{}{}
\patchcmd{\@cftmakeloftitle}{\cftloftitlefont\listfigurename}{\cftloftitlefont\MakeUppercase{\listfigurename}}{}{}
\patchcmd{\@cftmakelottitle}{\cftlottitlefont\listtablename}{\cftlottitlefont\MakeUppercase{\listtablename}}{}{}
\makeatother
\renewcommand{\cfttoctitlefont}{\hfill}
\renewcommand{\cftaftertoctitle}{\hfill}
\setlength{\cftbeforetoctitleskip}{-3em}
%
\renewcommand{\cftloftitlefont}{\hfill}
\renewcommand{\cftafterloftitle}{\hfill}
\setlength{\cftbeforeloftitleskip}{-3em}
%
\renewcommand{\cftlottitlefont}{\hfill}
\renewcommand{\cftafterlottitle}{\hfill}
\setlength{\cftbeforelottitleskip}{-3em}
\begin{document}
\tableofcontents
\chapter{Test Regular Chapter}
\begin{appendices}
\titlecontents{chapter}[10em]
{\addvspace{10pt}}
{\contentslabel[\MakeUppercase{\appendixname~\thecontentslabel}]{8em}\MakeUppercase}
{\hspace*{-8em}}{\titlerule*[.754em]{.}\contentspage}
\chapter{First Test Appendix}
\chapter{Second Test Appendix}
\end{appendices}
\end{document}
As a final remark, (and just as a suggestion), I think that it would be better to use small capitals instead of upper case fonts for the entries in the ToC; this would also have an additional advantage: the implementation would be considerably easier.