\nofiles

Synopsis:

\nofiles

Prevent LaTeX from writing any auxiliary files. The only output will be the .log and .pdf (or .dvi) files. This command must go in the preamble.

Because of the \nofiles command this example will not produce a .toc file.

\documentclass{book}
\nofiles
\begin{document}
\tableofcontents\newpage
\chapter{...}
  ...

LaTeX will not erase any existing auxiliary files, so if you insert the \nofiles command after you have run the file and gotten a .toc then the table of contents page will continue to show the old information.

© 2007–2018 Karl Berry
Public Domain Software
http://latexref.xyz/_005cnofiles.html