Using TeXWorks and TeXLive, usually errors display the relevant text, and I can go find the problem. Of course, it would be nice if there were a button I could click to go there, but it's not crippling. However, I now have a large document, and suddenly, I get the following error, with no clue about where in the document it is failing:


Package hyperref Message: Driver (autodetected): hpdftex.


! Undefined control sequence.
l.75 \@writefil


I don't have a previous version saved, so finding this could be an extremely tedious process of deleting sections until I find the relevant one. Is there anything I can do?

  • Don't you have (more or less) unlimited undo in your editor? – Bernard Jul 12 '14 at 14:00
  • 1
    A previous compilation must have stopped unexpectedly and written something into the auxiliary file. Delete the .aux file and try again. – Paul Gessler Jul 12 '14 at 14:03

The line right before the error message


shows that the error is happening inside an auxiliary file.

\@writefile is a LaTeX kernel command, \@writefil is a truncated version. Perhaps a previous run was aborted for some reason and the auxiliary file got closed with open write buffers.

Delete QuickFlippedLessons2.aux and try again.

| improve this answer | |
  • Do you know of anything that could cause the aux file to still appear intact but for this error to come about? I've having a very similar error about an undefined \@writef, but I can open the .aux file and see a complete line. I can ask a new question, of course, but since you mentioned "the auxiliary file got closed with open write buffers", I wonder if some elaboration on that might clear anything up. – Joshua Taylor Sep 22 '14 at 1:19
  • @JoshuaTaylor There is a contradiction: The file cannot stop at \@writef and show the full line at the same time. Either there are different .aux files or different times. – Heiko Oberdiek Sep 22 '14 at 3:14
  • Yes, it's quite puzzling. I'm compiling from within emacs via auctex, getting the error that the aux file ends with \@writef, and yet when I open it up, it clearly doesn't end there. Your mention of open buffers made me wonder if somehow pdflatex was reading the file before everything got flushed out. – Joshua Taylor Sep 22 '14 at 3:22
  • @JoshuaTaylor LaTeX reads the .aux file in \begin{document}, then the file is opened for writing, finally it is closed and read again in \end{document}. Therefore you have to figure out, when which .aux file is read with \@writef. If \nofiles is specified, LaTeX won't write the `.aux file. Also try compiling the file on the command line to exclude that emacs/aucTeX is interfering. – Heiko Oberdiek Sep 22 '14 at 3:26
  • Thank you for your attention to this; I've tracked it down to something with beamer's article modes, and I've managed to get rid of the problem. It seems to be a case where the error message doesn't really line up with what the problem actually is. When I get a few moments, I'll try to work up an MWE and post a question about it (along with the solution, though it doesn't really explain the particular error message). Again, thank you for your attention to this! – Joshua Taylor Sep 22 '14 at 4:19

The () in the console or log file indicate included files. So this error is happening while LaTeX is processing the QuickFlippedLessons2.aux file. The l. at the beginning of the line indicates the line number. So this is telling you that there is an undefined control sequence \@writefil on line 75 of QuickFlippedLessons2.aux.

Now .aux files are automatically created during a prior LaTeX run, and read at \begin{document} of the current run. Unless you are intentionally writing to the .aux file, my guess is that you had a prior aborted LaTeX run that only partially wrote something to the .aux file.

If that is the case, hitting enter at this error will command LaTeX to continue compiling as best it can. If this is the only problem, the run will succeed and the .aux file will be correctly written, and the error will go away in future runs.

Alternatively, you can delete the .aux file and recompile. The first run will write the .aux file correctly.

(Heiko beat me by a minute, but I'll keep the post since I tried to go into more detail.)

| improve this answer | |
  • thanks! gave priority to the first answer but upchecked both. Hopefully this will solve it. – Dov Jul 12 '14 at 20:58

Not the answer you're looking for? Browse other questions tagged or ask your own question.