Next: , Previous: , Up: Table of contents etc.   [Contents][Index]

25.1.2 \addtocontents



Add text, which may be text or formatting commands, directly to the auxiliary file with extension ext. This is most commonly used for the table of contents so that is the discussion here, but this also applies to the list of figures and list of tables.

This will put some vertical space in the table of contents after the ‘Contents’ header.


The \addtocontents command has two arguments. Both are required.


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


The text, and possibly commands, to be written.

The sectioning commands such as \chapter use the \addcontentsline command to store information. This command creates lines in the .toc auxiliary file containing the \contentsline command (see \addcontentsline). In contrast, the command \addtocontents puts material directly in that file.

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

Unofficial LaTeX2e reference manual