[texhax] Re: Changing "Contents" to "Table of Contents"

Nelson H. F. Beebe beebe at math.utah.edu
Wed May 21 08:49:47 CEST 2003


Dexter Cahoy <d_cahoy at yahoo.com> asks about changing the name
"Contents" to "Table of Contents" in a LaTeX document, and
Radhakrishnan CV <cvr at river-valley.org> correctly responded with

>> \renewcommand\contentsname{Table of Contents}

It is useful, however, to learn how to answer such questions from the
LaTeX source files themselves.

Somewhere in your TeX tree are files named latex.ltx (the core
definitions of LaTeX 2e) and various class files, like article.cls,
which build upon those definitions.

In the TeXLive 7 tree, they are found in the path

	.../texmf/tex/latex/base/

In this case, \tableofcontents is likely to be found in the
document-specific class file, since it is a feature of only certain
document types, and absent from others (letters, slides, ...).

A search for \tableofcontents in article.cls turns up

	\newcommand\tableofcontents{%
	    \section*{\contentsname
		\@mkboth{%
		   \MakeUppercase\contentsname}{\MakeUppercase\contentsname}}%
	    \@starttoc{toc}%
	    }

from which it is evident that \tableofcontents expands to an
unnumbered section heading whose text is \contentsname.

A further search in that file turns up

	\newcommand\contentsname{Contents}

from which the solution above immediately follows.

The source code documentation is present in .dtx files in the tree; in
this case, classes.dtx.  Copy that file into a temporary location, run
LaTeX 2e on it twice (for up-to-date cross-references), and then run a
DVI file viewer on classes.dvi: Section 8.1, p. 48, documents how the
Table of Contents works.

I encourage LaTeX beginners to delve into the LaTeX source files: this
is, after all, a completely open system, and there is much to be
learned by examination of its source code.

Books can provide an answer as well: The LaTeX Companion on p. 31,
Table 2-3, lists the wrappers for all of the default sectional names.

A detailed bibliography of (650+) TeX-related books and articles is
available on the Web at

	http://www.math.utah.edu/pub/tex/bib/texbook3.html

Coverage is intended to be complete: if you know of a publication that
belongs there, and isn't, please let me know.

-------------------------------------------------------------------------------
- Nelson H. F. Beebe                    Tel: +1 801 581 5254                  -
- Center for Scientific Computing       FAX: +1 801 581 4148                  -
- University of Utah                    Internet e-mail: beebe at math.utah.edu  -
- Department of Mathematics, 110 LCB        beebe at acm.org  beebe at computer.org -
- 155 S 1400 E RM 233                       beebe at ieee.org                    -
- Salt Lake City, UT 84112-0090, USA    URL: http://www.math.utah.edu/~beebe  -
-------------------------------------------------------------------------------


More information about the texhax mailing list