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 apologize for the unspecified and broad question but I have no way to be specific. I'm looking to generate the TOC and List of Figure, List of Table according to the format required by my school.

enter image description here

enter image description here

I have been trying with titlesec but I can't get some details working. Specifically the followings:

  • no bold-face;

  • The line 'CHAPTER Page' has to appear on every page of the ToC. Same with the line 'Figure Page' for the LoF and 'TABLE Page' for the LoT;

  • Single spacing between chapter and its section but double spacing between chapters

  • If the title is more than one line long, it should follow the format in Figure 2.1, i.e there are spaces before 1884

share|improve this question
    
Which document class are you using? –  Gonzalo Medina Jun 16 '12 at 16:54
    
As your four issues cover four separate problems, please remove three of them from this question and post them as new questions. This way, other users looking for help can find solutions more easily. (The fact that they're all for the same project you're working on doesn't really matter here.) Also don't forget to provide a minimal working example (MWE) for each question. Before posting, make sure the questions haven't been asked on here already via searching. –  doncherry Jun 16 '12 at 16:57
    
@GonzaloMedina I'm using \documentclass[a4paper, 12pt]{report} –  knguyen Jun 16 '12 at 17:14
    
Can you switch to the book document class? –  Gonzalo Medina Jun 16 '12 at 17:27
    
How should a regular chapter heading look like? –  Gonzalo Medina Jun 16 '12 at 18:08

2 Answers 2

up vote 14 down vote accepted

Here's a possible solution.

  1. I used the titletoc and tocloft packages to customize the ToC, LoF and LoT titles and entries as required. Firther customization might be required for the titles, but this might depend on the general layout for the chapter titles and this information was not provided in the question.
  2. The tocbibind packge was used to automatically include the LoF and the LoT in the table of contents.
  3. The afterpage package can be used to produce the corresponding headings in every page of the ToC, the LoF and the LoT; since these lists typically span few pages, one can use

    \addtocontents{toc}{\protect\afterpage{tocheading}}
    \addtocontents{lof}{\protect\afterpage{lofheading}}
    \addtocontents{lot}{\protect\afterpage{lotheading}}
    

    respectively, in the appropriate locations in the body of the document.

  4. I used the book document class (instead of using report) to profit from the \frontmatter, \mainmatter (and \backmatter) commands.

The code:

\documentclass{book}
\usepackage{titletoc}
\usepackage{tocloft}
\usepackage[nottoc]{tocbibind}
\usepackage{afterpage}

% Change the name of the ToC
\AtBeginDocument{%
\renewcommand\contentsname{Table of Contents}}

% Headings for every page of ToC, LoF and Lot
\newcommand\tocheading{\par\bigskip\MakeUppercase{\chaptername}\hfill Page\par}
\newcommand\lofheading{\par\bigskip\figurename\hfill Page\par}
\newcommand\lotheading{\par\bigskip\MakeUppercase{\tablename}\hfill Page\par}

% Centering titles for the ToC, Lof and Lot
\renewcommand{\cfttoctitlefont}{\hfill\normalfont\MakeUppercase}
\renewcommand{\cftaftertoctitle}{\hfill}
\renewcommand{\cftloftitlefont}{\hfill\normalfont\MakeUppercase}
\renewcommand{\cftafterloftitle}{\hfill}
\renewcommand{\cftlottitlefont}{\hfill\normalfont\MakeUppercase}
\renewcommand{\cftafterlottitle}{\hfill}

% Chapter entries formatting for frontmatter chapters
\newcommand\frontmatterchaptoc{%
\titlecontents{chapter}
  [1.5em]{\addvspace{\baselineskip}}
  {\contentslabel{1.5em}\MakeUppercase}
  {\hspace*{-1.5em}\MakeUppercase}
  {\titlerule*[1pc]{.}\contentspage}
}

% Chapter entries formatting for mainmatter chapters
\newcommand\mainmatterchaptoc{%
\titlecontents{chapter}
  [5em]{\addvspace{\baselineskip}}
  {\contentslabel{3em}\hspace*{-1em}\MakeUppercase}
  {\MakeUppercase}
  {\titlerule*[1pc]{.}\contentspage}
}

% Section, subsection, table and figure entries formatting
\titlecontents{section}
  [7em]{}{\hspace{-1em}}{}{\titlerule*[1pc]{.}\contentspage}
\titlecontents{subsection}
  [7.5em]{}{\hspace{-1em}}{}{\titlerule*[1pc]{.}\contentspage}
\titlecontents{figure}
  [5em]{}
  {\contentslabel{3em}\hspace*{-1em}}{}
  {\titlerule*[1pc]{.}\contentspage}
\titlecontents{table}
  [5em]{}
  {\contentslabel{3em}\hspace*{-1em}}{}
  {\titlerule*[1pc]{.}\contentspage}

\begin{document}

\frontmatter
\frontmatterchaptoc % activation of chapter entries formatting in the frontmatter

\chapter{Acknowledgements}

\cleardoublepage
\tableofcontents
\cleardoublepage
\addtocontents{lof}{\lofheading}% add heading to the first page in LoF
\listoffigures
\cleardoublepage
\addtocontents{lot}{\lotheading}% add heading to the first page in LoT
\listoftables
\cleardoublepage

\mainmatter
\addtocontents{toc}{\tocheading}% add heading to the first page in ToC, after frontmatter entries

\mainmatterchaptoc% activation of chapter entries formatting in the mainmatter

\chapter{Introduction}
\section{Section One One}
\begin{figure}
\centering
A
\caption{Test figure one}
\label{fig:test}
\end{figure}
\chapter{Policy divergence and traditional research}
\section{Section Two One}
\begin{figure}
\centering
A
\caption{William Adolphe Bouguereau, \emph{Youth of Bacchus}  (initial sketch), 1884}
\label{fig:wab}
\end{figure}
\subsection{Section Two One One}

\end{document}

An image of the obtained ToC:

enter image description here

an Image of the obtained LoF:

enter image description here

share|improve this answer
    
WOW. This is awesome. Thank you so much for taking time with my problem. I'm getting this error when I compile. Package tocloft Note: The document has chapter divisions. ! LaTeX Error: Command \c@lofdepth already defined. Or name \end... illegal, see p.192 of the manual. I'm using these packages pastebin.com/2C4A2dQC (due to limit character) –  knguyen Jun 16 '12 at 22:32
2  
@knguyen you're using the obslote subfigure package (in fact, you are loading it twice in the preamble); this package shouldn't be used anymore; you can use subfig or even better, subcaption instead. –  Gonzalo Medina Jun 17 '12 at 1:23

If your TOC/etc ends up taking multiple pages, use \addtocontents{toc}{\protect\flushleft\protect\afterpage{tocheading}} to override TOC default indenting.

Hoping to save future thesis editors some Googling time.

share|improve this answer
1  
Using \afterpage would isolate the heading fix to only the following page. What if the ToC spans 3 (or more) pages? –  Werner Mar 5 at 21:59
    
I had this exact problem. The "ugly" hack I ended up using was compiling it once, seeing which chapter heading was the last one on page 2 (or 3, etc), then throwing in another one of these commands after the \chapter call. It will correctly format the TOC as desired, but the behavior will change if the document gets significantly longer/shorter in places. It's not pretty, but it works. I would welcome a more elegant solution if anyone has one. –  user47384 Mar 7 at 0:53
    
A better way would be to use everyshi or atbegshi which is executed at every \shipout to insert content (perhaps using afterpage). Then, once the ToC is completed, to stop the insertion. For example, see Table of Contents with headings on every page. –  Werner Mar 7 at 2:45

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.