Add an entry to the file specified by ext. Usually ext is one of toc for the table of contents, lof for the list of figures, or lot for the list of tables.

The following will result in an ‘Appendices’ line in the table of contents.


It will appear at the same indentation level as the sections, will be in boldface, and will be assigned the page number associated with the point where it appears in the input file.

The \addcontentsline command writes information to the file root-name.ext. It writes that information as the text of the command \contentsline{unit}{text}{num}, where num is the current value of counter unit. The most common case is the table of contents and there num is the page number of the first page of unit.

This command is invoked by the sectioning commands \chapter, etc., and also by \caption inside a float environment. But it is also used by authors. For example, in a book to have the preface unnumbered, you may use the starred \chapter*. But that does not put in table of contents information, so you can enter it manually, as here.


In the .toc file LaTeX will put the line \contentsline {chapter}{\numberline {}Preface}{3}; note the page number ‘3’.

All of the arguments for \addcontentsline are required.


Typically one of the strings toc for the table of contents, lof for the list of figures, or lot for the list of tables. The filename extension of the information file.


A string that depends on the value of the ext argument:


For the table of contents, this is the name of a sectional unit: part, chapter, section, subsection, etc.


For the list of figures: figure.


For the list of tables: table.


The text of the entry. You must \protect any commands that are fragile (see \protect).

The \addcontentsline command has an interaction with \include (see \include & \includeonly). If you use them at the same level, as with \addcontentsline{...}{...}{...}\include{...} then lines in the table of contents can come out in the wrong order. The solution is to move \addcontentsline into the file being included.

If you use a unit that LaTeX does not recognize, as here


then you don’t get an error but the formatting in the table of contents will not make sense.

© 2007–2018 Karl Berry
Public Domain Software