I have a LaTeX document that was compiling fine until this evening. I was playing around with synctex and latexmk when I noticed the error, but I'm not sure what is causing it.

There are over 100 of the following errors when pdflatex gives up:

! Text line contains an invalid character.
l.18 ...^^@^^@^^@^^@^^@^^@^^@^^@^^@^^@^^@^^@^^@^^@

Wasn't sure what those were. I noticed line 18 was blank in TextMate. But in Editra, I see that it is full of NULL characters.

Weirdest thing I've seen. Plus, I can't delete these characters. Anyone know where to start debugging?

  • I've suggested closing this question as it seems like a very localised and particular problem that is unlikely to arise for others.
    – Alan Munn
    Mar 5 '11 at 2:58
  • @Alan: That is fair. Is closing the same as deleting? One thing I did notice is that ^^@ wasn't showing anything useful in my Google searches, so identifying that as the NULL character might be helpful to those who doesn't know.
    – jrhorn424
    Mar 5 '11 at 18:09
  • Closing keeps the question visible. However just accepting your answer (in a day) should (imo) be good enough.
    – Caramdir
    Mar 5 '11 at 18:20
  • No, closed questions don't get deleted unless they are exact duplicates of other questions, which isn't the case here. So the question will remain if it is in fact closed. (Also enough people have to vote to close it.)
    – Alan Munn
    Mar 5 '11 at 18:26
  • Possible duplicate of (or related in some way to) Compiler gives hundreds of "invalid character" suddenly Can they be linked somehow?
    – JLDiaz
    Dec 5 '12 at 10:10

The reason it was only affecting this file is because I had run latexmk -pvc and backgrounded the process. When it hit an error, I wasn't notified, but the shell exited with "a broken pipe", or so Growl told me.

Once I killed the processes that were continuously running in the background, constantly recompiling the document, the null characters disappeared from the aux file and the document compiled correctly.

I feel like such a doofus. I definitely won't be making this mistake again.

  • It's great that you posted this answer. Can you please also accept it so that the system knows that the problem is solved? Mar 5 '11 at 8:35
  • @Hendrik I will accept it. SX is telling me I have to wait one more day, first. :)
    – jrhorn424
    Mar 5 '11 at 18:08
  • 1
    Oh my, only now I got it fully: The system won't let you if you don't wait 48 hours first. Thanks for letting me know. Mar 6 '11 at 17:04

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