General ⇒ Page Headers in TOC, LOF, LOT
-
- Posts: 7
- Joined: Fri Apr 10, 2009 12:16 am
Page Headers in TOC, LOF, LOT
Hello. This might be a lot to ask in one post but here it goes...
How does one generate a TOC which contains the word "CHAPTER" without a page number just before the list of chapters. Example:
ACKNOWLEDGEMENT . . . . . . . . . . . . . . . . . . iii
LIST OF TABLES. . . . . . . . . . . . . . . . . . . vii
LIST OF FIGURES . . . . . . . . . . . . . . . . . . ix
CHAPTER
1. INTRODUCTION. . . . . . . . . . . . . . . . . . 1
And from here the TOC goes to the second page which needs a header with the word "CHAPTER" left justified and "Page" right justified.
Similarly, the LOF and LOT needs headers (FIGURE and Page, TABLE and Page) on the second and following pages while long figure or table titles have hangning indents if more than one line.
I am using a modified class file based on the Report class. All I've found to date is "\addcontentsline{toc}{xchapter}{CHAPTER}" but this doesn't build the headers on the next page and it generates a page number after the "CHAPTER" word.
Any help would be greatly appreciated.
How does one generate a TOC which contains the word "CHAPTER" without a page number just before the list of chapters. Example:
ACKNOWLEDGEMENT . . . . . . . . . . . . . . . . . . iii
LIST OF TABLES. . . . . . . . . . . . . . . . . . . vii
LIST OF FIGURES . . . . . . . . . . . . . . . . . . ix
CHAPTER
1. INTRODUCTION. . . . . . . . . . . . . . . . . . 1
And from here the TOC goes to the second page which needs a header with the word "CHAPTER" left justified and "Page" right justified.
Similarly, the LOF and LOT needs headers (FIGURE and Page, TABLE and Page) on the second and following pages while long figure or table titles have hangning indents if more than one line.
I am using a modified class file based on the Report class. All I've found to date is "\addcontentsline{toc}{xchapter}{CHAPTER}" but this doesn't build the headers on the next page and it generates a page number after the "CHAPTER" word.
Any help would be greatly appreciated.
NEW: TikZ book now 40% off at Amazon.com for a short time.

- Stefan Kottwitz
- Site Admin
- Posts: 10345
- Joined: Mon Mar 10, 2008 9:44 pm
Page Headers in TOC, LOF, LOT
Hi,
concerning headers have a look at the fancyhdr package and its documentation.
Instead of \addcontentsline you could use \addtocontents.
Stefan
concerning headers have a look at the fancyhdr package and its documentation.
Instead of \addcontentsline you could use \addtocontents.
Stefan
LaTeX.org admin
-
- Posts: 7
- Joined: Fri Apr 10, 2009 12:16 am
Page Headers in TOC, LOF, LOT
Stefan,
Thank you. I will read through the Fancy Header documentation.
I've tried the \addtocontents{toc}{CHAPTER} option but I receive errors. Where would this line be added?
Returns:
Thank you. I will read through the Fancy Header documentation.
I've tried the \addtocontents{toc}{CHAPTER} option but I receive errors. Where would this line be added?
Code: Select all
\tableofcontents
\listoftables
\listoffigures
\addtocontents{toc}{CHAPTER}
\newpage
\clearpage
\pagenumbering{arabic}
\include{Introduction}
Code: Select all
main.tex(5): Error: ! LaTeX Error: Something's wrong--perhaps a missing \item.
main.tex(5): Error: ! LaTeX Error: Something's wrong--perhaps a missing \item.
- Stefan Kottwitz
- Site Admin
- Posts: 10345
- Joined: Mon Mar 10, 2008 9:44 pm
Page Headers in TOC, LOF, LOT
Inserting a protected paragraph break should fix it:
Stefan
Code: Select all
\addtocontents{toc}{CHAPTER\protect\par}
LaTeX.org admin
-
- Posts: 7
- Joined: Fri Apr 10, 2009 12:16 am
Re: Page Headers in TOC, LOF, LOT
Thank you. That got it in there. But now it is indented. Is there a command which removes the indentation?
Thank you for all your help.
Thank you for all your help.
- Stefan Kottwitz
- Site Admin
- Posts: 10345
- Joined: Mon Mar 10, 2008 9:44 pm
Page Headers in TOC, LOF, LOT
Here's no indentation:
How's your code?
Stefan
Code: Select all
\documentclass[a4paper,10pt]{report}
\begin{document}
\tableofcontents
\addtocontents{toc}{CHAPTER\protect\par}
\chapter{Test}
\section{Section}
\end{document}
Stefan
LaTeX.org admin
-
- Posts: 7
- Joined: Fri Apr 10, 2009 12:16 am
Page Headers in TOC, LOF, LOT
Thank you. I actually ended up using
This has been very helpful.
Do you know how to make the real long entries in LOF and LOT single space and hanging indent when they wrap to next line?
My LOF Code from my class file. I can't seem to get it. I'm so new at all of this I'm probably doing it all wrong to begin with:
Code: Select all
\addtocontents{toc}{\noindent CHAPTER\protect\par}
Do you know how to make the real long entries in LOF and LOT single space and hanging indent when they wrap to next line?
My LOF Code from my class file. I can't seem to get it. I'm so new at all of this I'm probably doing it all wrong to begin with:
Code: Select all
%% ----------------------------
%% LIST OF FIGURES (LOF)
%% ----------------------------
\def\listoffigures{ %
\chapter*{\listfigurename} %
\vspace{-\baselineskip} %
\vspace{-0.27in} %
FIGURE\nobreak\hfill{Page}\par %
\begin{singlespace} % I added this line
\hangindent=1.5em % this one
\hangafter=1 % and this one
\addcontentsline{toc}{xchapter}{\listfigurename} %
\end{singlespace} % and then closed it with this.
% but it did nothing.
\@starttoc{lof}} %
\def\l@figure{\@dottedtocline{0}{1em}{1.6em}} %
\def\l@figure#1#2{ %
{\leftskip 1em\relax \rightskip \@tocrmarg \parfillskip -\rightskip
\parindent 1em\relax\@afterindenttrue %
\interlinepenalty\@M %
\leavevmode %
\@tempdima 1.6em\relax %
\advance\leftskip \@tempdima \null\nobreak\hskip -\leftskip
{#1}\nobreak %
\leaders\hbox{$\m@th \mkern \@dotsep mu\hbox{.}\mkern \@dotsep mu$}%
\hfill\nobreak %
\hb@xt@\@pnumwidth{\hfil\normalfont \normalcolor #2}%
\par}}
-
- Posts: 7
- Joined: Fri Apr 10, 2009 12:16 am
Page Headers in TOC, LOF, LOT
Wow. Just got it using this:
Code: Select all
%% ----------------------------
%% LIST OF FIGURES (LOF)
%% ----------------------------
%
\def\listoffigures{ %
\chapter*{\listfigurename} %
\vspace{-\baselineskip}
\vspace{-0.27in} %% adjustment
FIGURE\nobreak\hfill{Page}\par %
\addcontentsline{toc}{xchapter}{\listfigurename} %
\@starttoc{lof}}
\def\l@figure{\@dottedtocline{0}{1em}{1.6em}} %%%%%%%%%%%%%%% ADJUSTABLE! %%%%%%%%%%%%%%%%%
\def\l@figure#1#2
{
\begin{singlespace}
\hangindent=1.5em
\hangafter=1
{
\leftskip 1em\relax \rightskip \@tocrmarg \parfillskip -\rightskip
\parindent 1em\relax\@afterindenttrue
\interlinepenalty\@M
\leavevmode
\@tempdima 1.6em\relax
\advance\leftskip \@tempdima \null\nobreak\hskip -\leftskip
{#1}\nobreak
\leaders\hbox{$\m@th \mkern \@dotsep mu\hbox{.}\mkern \@dotsep mu$}%
\hfill\nobreak
\hb@xt@\@pnumwidth{\hfil\normalfont \normalcolor #2}%
\par
}
\end{singlespace}
}