Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I am writing my latex document in TexMaker and suddenly in one of the thousands of compilations I make there is a error and I cant get rid of it. The error is:

! Text line contains an invalid character.

The "funny" thing is that the error is in line 2, where I haven't changed anything for weeks and it turn out that there are 100 errors like this in the compilation, each of them with 1 more invalid character. Starts with one and then every error gives +1 character more to the string. Weird.

Has anyone had this error before? It is clear that the error is not because of the invalid character, it doesn't exist! Any ideas?

share|improve this question
1  
Perhaps the whole log could be useful, but I don't think it is worth to include it in the question. Can you upload it to some pastebin site and give the url in a comment? –  JLDiaz Nov 30 '12 at 11:28
1  
@JLDiaz I actually can't copy paste the part where the invalid characters appear in the log file, but this is the log file: pastebin.com/YBYDpBxJ In the end there are 100 of invalid character –  Ander Biguri Nov 30 '12 at 11:35
2  
You have removed the essential information. However it seems that the problem is in the .aux file. Delete it and retry. –  egreg Nov 30 '12 at 11:39
1  
@Ander_Biguri Ok, the log didn't help much, but apparently the invalid chars are in the file Memoria.aux and not in Memoria.tex. Try removing that file. –  JLDiaz Nov 30 '12 at 11:40
2  
Actually YES! I removed the .aux and everything works. Thanks. Post your comment as answer so I can accept it! PD: i didnt remove the important info, I just cant copy it, windows doesnt allow me hehe –  Ander Biguri Nov 30 '12 at 11:41
show 1 more comment

2 Answers

up vote 15 down vote accepted

The following comes from the .log file you reported:

("C:\Documents and Settings\ander.biguri\Escritorio\Memoria\LaTeX\Memoria.aux"
! Text line contains an invalid character.
l.2 ! Text line contains an invalid character.

This means that the invalid character is found in the .aux file. Remove the file and retry.

Errors during a compilation may, sometimes, cause a corruption of the .aux file that is rewritten each time. The removal is a safe operation, which has the only consequence that some more LaTeX runs are needed for synchronizing cross references.

share|improve this answer
    
Thank you so much! I almost thought my thesis was dead! –  user32517 Jun 19 '13 at 19:57
    
Problem source in my LaTEX :aux(2) ! Text line contains an invalid character. Solution: This means that the invalid character is found in the .aux file. Remove the file and retry. Thanks guys: –  user32958 Jun 28 '13 at 17:25
add comment

The following line of the error message (which you haven't shown) should show the character for example

! Text line contains an invalid character.
l.7 \begin{document}^^?

In fact I think in the default setup that is the only invalid character (delete, U+007F). So You need to delete the delete character.

Possibly your file has been saved in an incorrect encoding?

share|improve this answer
    
the characters are shown as small squares, and I am not able to copy them! But where should i delete the Delete character? the error is in line 2, where there has been nothing changed for the previous thousands of compilations. Also there is not 1 error of those, but 100 and the amount of "squares" in the errors goes uo by one each error. so error 45 has 45 squares as invalid character –  Ander Biguri Nov 30 '12 at 11:38
2  
see egreg's answer, now you have posted the log file, it shows the character is in the aux file so you can simply delete the file and latex will regenerate it. Also even if it shows as a small square it could have been identified had you pasted it in to your question, even though missing glyphs look the same they retain their original character code internally, even on this web page. –  David Carlisle Nov 30 '12 at 11:59
add comment

protected by Martin Scharrer Jun 29 '13 at 17:20

Thank you for your interest in this question. Because it has attracted low-quality answers, posting an answer now requires 10 reputation on this site.

Would you like to answer one of these unanswered questions instead?

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