[OS X TeX] How to show \printindex, \printglossary, \listoftables, \listoffigures in \tableofcontents
Bruno Voisin
bvoisin at mac.com
Mon Apr 25 09:00:26 EDT 2005
Le 25 avr. 05, à 14:15, Ueliisa a écrit :
> How can I make entries from \printindex, \printglossary,
> \listoftables, \listoffigures, ... in the \tableofcontents
Not easily: you have to redefine these commands such that they add an
entry to the .toc file where all TOC entries are stored. Namely, you
have to add inside \listoffigures the line:
\addcontentsline{toc}{chapter}{\listfigurename}
and inside \listoftables:
\addcontentsline{toc}{chapter}{\listtablename}
and similarly for the index and glossary.
How to do this: locate inside
/Library/teTeX/share/texmf.tetex/tex/latex/base/ the file where these
commands are defined (normally report.cls for a report, book.cls for a
book), copy the definition, sandwiched between \makeatletter ...
\makeatother, in your document's preamble, and add the required line
inside it. In case you're using report.cls, that should be:
\makeatletter
\newcommand\listoffigures{%
\if at twocolumn
\@restonecoltrue\onecolumn
\else
\@restonecolfalse
\fi
\addcontentsline{toc}{chapter}{\listfigurename} % <<<<< this is
the required bit
\chapter*{\listfigurename}%
\@mkboth{\MakeUppercase\listfigurename}%
{\MakeUppercase\listfigurename}%
\@starttoc{lof}%
\if at restonecol\twocolumn\fi
}
\newcommand\listoftables{%
\if at twocolumn
\@restonecoltrue\onecolumn
\else
\@restonecolfalse
\fi
\addcontentsline{toc}{chapter}{\listtablename} % <<<<< this is the
required bit
\chapter*{\listtablename}%
\@mkboth{%
\MakeUppercase\listtablename}%
{\MakeUppercase\listtablename}%
\@starttoc{lot}%
\if at restonecol\twocolumn\fi
}
\makeatother
In case you're using a different document class, or other packages that
modify \listofigures or \listoftables, you've got to take the
modifications into account. For example, one of my documents contains
(don't copy these definitions for you, as they assume the hyperref
package is used, and they include other modifications as well to
achieve a specific page layout):
\makeatletter
\renewcommand{\listoffigures}
{\thispagestyle{plain}
\global\@topnum=0
\setboolean{@afterindent}{false}
\renewcommand{\@currentHref}{listfigureanchor}
\hyper at anchorstart{\@currentHref}\hyper at anchorend
\addcontentsline{toc}{chapter}{\listfigurename} % <<<<< this is the
required bit
\@makeschapterhead{\centering\listfigurename}
\@afterheading\vspace{10pt}
\markboth{\MakeUppercase\listfigurename}
{\MakeUppercase\listfigurename}
\@starttoc{lof}}
\renewcommand{\listoftables}
{\thispagestyle{plain}
\global\@topnum=0
\setboolean{@afterindent}{false}
\renewcommand{\@currentHref}{listtableanchor}
\hyper at anchorstart{\@currentHref}\hyper at anchorend
\addcontentsline{toc}{chapter}{\listtablename} % <<<<< this is the
required bit
\@makeschapterhead{\centering\listtablename}
\@afterheading\vspace{10pt}
\markboth{\MakeUppercase\listtablename}
{\MakeUppercase\listtablename}
\@starttoc{lot}}
\makeatother
As I said, not easy for beginners ! There may be packages, that I don't
know, doing all this for you or offering this as an option. The LaTeX
Companion is one place where to find such information.
HTH,
Bruno Voisin
--------------------- Info ---------------------
Mac-TeX Website: http://www.esm.psu.edu/mac-tex/
& FAQ: http://latex.yauh.de/faq/
TeX FAQ: http://www.tex.ac.uk/faq
List Post: <mailto:MacOSX-TeX at email.esm.psu.edu>
More information about the MacOSX-TeX
mailing list