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?

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

1 Answer 1


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.

  • 3
    not that it matters (or is documented anywhere) but I think @filesw is short for file - switch not files - writable :-) Jul 19, 2016 at 22:09
  • so if \nofiles command is not there, writing will happen by default or not? Apr 15, 2020 at 20:25
  • @vipin8169 The .aux files are written by default unless turned off. Apr 16, 2020 at 21:18
  • @HeikoOberdiek where are they written to? i could not find them in the folder which contained the .tex file Apr 17, 2020 at 7:12
  • @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, ... Apr 17, 2020 at 23:09

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .