# LaTeX does not generate the aux file

I am executing the following command in the terminal, but that does not generate the *.aux file:

pdflatex main.tex


Why is it not generating the main.aux file?

• The auxiliary file is not written, if \nofiles was used or if the compilation finishes (on purpose or because of error) before \begin{document} . – Heiko Oberdiek Jul 19 '16 at 20:55
• Why was this tagged as latex3 ? – user31729 Jul 19 '16 at 20:56
• @HeikoOberdiek, thanks \nofile was the issue. Thank you :) – J4cK Jul 19 '16 at 21:03
• @ChristianHupfer latex3 was tagged by mistake :( – J4cK Jul 19 '16 at 21:04
• Are you using the res document class, perhaps? – Werner Jul 20 '16 at 1:39

The writing of the .aux files in LaTeX is controlled by switch \if@filesw (w short for writable). The command \nofiles sets the switch to false to prevent the rewriting of the auxiliary files.
The main .aux file is opened for writing in \begin{document}. If the LaTeX job does not reach this point, for example, because of an error or on purpose, the auxiliary files are also not written.
• not that it matters (or is documented anywhere) but I think @filesw is short for file - switch not files - writable :-) – David Carlisle Jul 19 '16 at 22:09
• so if \nofiles command is not there, writing will happen by default or not? – vipin8169 Apr 15 at 20:25
• @vipin8169 The .aux files are written by default unless turned off. – Heiko Oberdiek Apr 16 at 21:18
• @vipin8169 There are lots of possible reasons: no LaTeX format, an hidden \nofiles or \@fileswfalse, end of the TeX job before \begin{document} is executed, option setting (-output-directory in TeX Live) with a different output directory, ... – Heiko Oberdiek Apr 17 at 23:09