Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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
share|improve this question
1  
Welcome to TeX.sx! –  Peter Jansson Apr 4 '13 at 20:49
    
Which document class are you using? –  Gonzalo Medina Apr 4 '13 at 21:35
    
report. I'm editing to include more info. –  Jeremiah Apr 4 '13 at 21:57

1 Answer 1

up vote 4 down vote accepted

One possibility is to use \titlecontents from the titletoc package.

Remarks:

  • Notice that the titletoc option for the appendix 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 from tocloft were patched (with the help of the etoolbox 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}

enter image description here

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.

share|improve this answer
    
Sorry, I forgot to mention I'm using the report document class. This doesn't quite work. I'll play with it and see what I can come up with. Thanks –  Jeremiah Apr 4 '13 at 21:54
1  
@Jeremiah I've updated my answer. Please take into account the remarks. –  Gonzalo Medina Apr 5 '13 at 1:02
    
Sorry I disappeared, family. This works great!! –  Jeremiah Apr 5 '13 at 13:03
1  
@Jeremiah No problem. So, you need, at some point in your document, to revert to the standard style for the chapter ToC entries (no upper case, boldfaced, dotless entries)? –  Gonzalo Medina Apr 5 '13 at 13:06
    
Thanks, I edited that remark out when I figured it out. For the record @Gonzalo was answering this question - I need to revert back to the previous style. –  Jeremiah Apr 5 '13 at 13:09

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.