General ⇒ Page Headers in TOC, LOF, LOT
-
- Posts: 7
- Joined: Fri Apr 10, 2009 12:16 am
Page Headers in TOC, LOF, LOT
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.
Learn LaTeX easily with newest books:
The LaTeX Beginner's Guide: 2nd edition and perfect for students writing a thesis
The LaTeX Cookbook: 2nd edition full of practical examples for mathematics, physics, chemistry, and more
LaTeX Graphics with TikZ: the first book about TikZ for perfect drawings in your LaTeX thesis
- Stefan Kottwitz
- Site Admin
- Posts: 10358
- Joined: Mon Mar 10, 2008 9:44 pm
Page Headers in TOC, LOF, LOT
concerning headers have a look at the fancyhdr package and its documentation.
Instead of \addcontentsline you could use \addtocontents.
Stefan
-
- Posts: 7
- Joined: Fri Apr 10, 2009 12:16 am
Page Headers in TOC, LOF, LOT
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: 10358
- Joined: Mon Mar 10, 2008 9:44 pm
Page Headers in TOC, LOF, LOT
Code: Select all
\addtocontents{toc}{CHAPTER\protect\par}
-
- Posts: 7
- Joined: Fri Apr 10, 2009 12:16 am
Re: Page Headers in TOC, LOF, LOT
Thank you for all your help.
- Stefan Kottwitz
- Site Admin
- Posts: 10358
- Joined: Mon Mar 10, 2008 9:44 pm
Page Headers in TOC, LOF, LOT
Code: Select all
\documentclass[a4paper,10pt]{report}
\begin{document}
\tableofcontents
\addtocontents{toc}{CHAPTER\protect\par}
\chapter{Test}
\section{Section}
\end{document}
Stefan
-
- Posts: 7
- Joined: Fri Apr 10, 2009 12:16 am
Page Headers in TOC, LOF, LOT
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
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}
}