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 align my TOC, so that the appendices and other appendix type chapters are aligned by the numbers, rather than the start of the chapter headings.

So in the situation below, case A is the default, the A's and B's are not aligned. I would like them aligned as demonstrated in case B.

Sample Output

Does anyone know how to do this?

NB: The red lines are not part of the problem, merely to illustrate the current alignment...

Trying to fish the relevant code out of about 20 pages of other code, this is what I think is the relevant parts. You can see that Appendix is the Same as Exhibit in the sense that they are bot appendixes, but with different chapter names and reset number counters.

CODE TO ADD TOC.

\pagestyle{empty}
\cleardoublepage
\setlength{\cftbeforechapskip}{7pt}
\setlength{\cftbeforesecskip}{0pt}
\begin{spacing}{0.9}    
        \let\orignumberline\numberline
        \tableofcontents            
        \vspace{1em}    

        \let\chapter=\subsection            
        \renewcommand{\cftfigfont}{\small Fig }
        \renewcommand*{\addvspace}[1]{}
        \listoffigures

        \let\chapter=\subsection        
        \renewcommand{\cfttabfont}{\small Tab } 
        \renewcommand*{\addvspace}[1]{} 
        \listoftables
\end{spacing}

CODE TO ADD EXHIBIT.

\noappendicestocpagenum
\renewcommand{\appendixtocname}{List of Exhibits}
\renewcommand{\appendixname}{Exhibit}
\renewcommand{\setthesection}{\roman{section}}
\renewcommand{\setthesubsection}{\roman{subsection}}

\begin{appendices}
    \setcounter{chapter}{0}
    \renewcommand{\thechapter}{\Alph{chapter}}
    \renewcommand{\thesection}{\thechapter.\roman{section}}
    \renewcommand{\thesubsection}{\thesection.\roman{subsection}}

    \chapter{Mathematical Proofs}

        %Text Removed Here....
\end{appendices}

CODE TO ADD APPENDIX.

\renewcommand{\appendixname}{Appendix}
\begin{appendices}
    \setcounter{chapter}{0}
    \pagestyle{detailed}
    \chapter{Data - The Quick Brown Fox}
    \lettrine{D}{ata} Summary Goes Here.
    \lipsum[1]
    \newpage

    \chapter{Data - Jumped Over the Lazy Dog}
    \lettrine{D}{ata} Summary Goes Here.
    \lipsum[1]
    \newpage
\end{appendices}
share|improve this question
    
Since such is not the default way the TOC is printed, you should add the code you're using. –  egreg Dec 30 '12 at 14:27
    
@egreg I have updated the post. –  Nicholas Hamilton Dec 30 '12 at 17:45
    
are you still interested by this problem? is your class the memoir class? are you using package tocloft? –  user700902 Feb 25 '13 at 18:35
    
Not memoir class, using book class, using tocloft. –  Nicholas Hamilton Mar 5 '13 at 5:39
    
@ADP Has there been progress on this question? Could you complete the code to a full MWE? –  Qrrbrbirlbel Mar 14 '13 at 21:27
show 2 more comments

1 Answer

Here's a possible solution using the titletoc package and \contentspush to add the labels before the numbering, producing the desired alignment:

\documentclass{book}
\usepackage{titlesec}
\usepackage{titletoc}
\usepackage{appendix}

\noappendicestocpagenum
\renewcommand{\appendixtocname}{List of Exhibits}
\renewcommand{\appendixname}{Exhibit}
\renewcommand{\setthesection}{\roman{section}}
\renewcommand{\setthesubsection}{\roman{subsection}}

\begin{document}
\tableofcontents

\chapter{Regular Chapter One}
\chapter{Regular Chapter Two}

\titlecontents{chapter}
  [5.5em]{\addvspace{10pt}\bfseries}
  {\contentslabel[\contentspush{\appendixname~\thecontentslabel}]{0.6em}}
  {\hspace*{-0.6em}}{\hfill\contentspage}
\renewcommand\thesection{\thechapter.\roman{section}}
\begin{appendices}
\chapter{Mathematical Proofs}
\section{Euler's Formula}
\section{de Moivre's Theorem}
\end{appendices}

\renewcommand{\appendixname}{Appendix}

\titlecontents{chapter}
  [5.5em]{\addvspace{10pt}\bfseries}
  {\contentslabel[\contentspush{Appendix~\thecontentslabel}]{0.6em}}
  {\hspace*{-0.6em}}{\hfill\contentspage}
\begin{appendices}
\setcounter{chapter}{0}
\chapter{Data - The Quick Brown Fox}
\chapter{Data - Jumped Over the Lazy Dog}
\end{appendices}

\end{document}

enter image description here

Changes to the entries font are easy and were not the core of this question, so I didn't do them.

share|improve this answer
add comment

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.