I'm working on a rather large (200 pages) document.

Once or twice a day, I get a compile error which references a line that does not exist in my code. That is, the line does exist, but the error references contents that are slightly different from what the file actually contains.

The last such error was:

! Undefined control sequence.
l.166 \subsecction

Line 166 of file experiments.tex contains that exact line, but without the double c and the newline:


I'm using the continuous option of Latexmk. On failure, it automatically recompiles just fine after that error, without me having to change a file (!). If I clean the build dir and then rebuild, no such error occurs. I've configured Latexmk with a $failure_cmd that prints the tail of the log and so catched the eror, but I haven't been able to catch full the log.

This is not a showstopper for me since on a recompile the error always goes away: however it's quite disturbing. I'm at a loss as to how to provide more info.

I can't share the full document and wouldn't know how to provide a MWE for this issue, since it is not a deterministic error.

These are the packages I've loaded. I've also mounted the $out_dir to a RAM drive. I am using the book class and LuaLaTeX/Latexmk, on Kubuntu, TeX Live package:

texlive/cosmic,cosmic,now 2018.20180824-1 all TexLive

  • 2
    Are these reproducible errors? If so, can you post an MWE and the details of your work flow?
    – user194703
    Jan 21, 2020 at 4:09
  • 1
    Are you sure that the line number refers to you main tex and not e.g to the toc file? Jan 21, 2020 at 7:10
  • 4
    The newline in the error message is normal, tex always adds them after an unknown command. If you are using lualatex you shouldn't use \special{dvipdfmx:config z 0} in your document - that is a xelatex setting. And you should better use backend=biber. But beside this it is quite impossible to debug your problem. Jan 25, 2020 at 21:26
  • 3
    I have seen this from time to time as well (I don't use continuous compilation) and always assumed that it was caused by starting the compilation and then - while TeX is processing the file - saving the file to the disk again with a (small) change. If this happens in a way that the bytes in the file are shifted close to the position TeX just read, then that could explain why TeX reads \subsecction where the file only has \subsection. Unfortunately, I know nothing about how TeX reads files, so I don't know if my made-up theory holds water.
    – moewe
    Jan 26, 2020 at 6:04
  • 1
    My humble tip is cleverref. Even though its great, this package sometimes misbehaves too. Jan 26, 2020 at 12:13


You must log in to answer this question.

Browse other questions tagged .