TransWikia.com

Unexpected latex error: Text line contains an invalid character

TeX - LaTeX Asked by RPavao on March 10, 2021

My latex started showing this error:

Error | line 3|! Text line contains an invalid character.

out of nowhere. Actually, it shows 100 of this errors, all in the same line.

I started to investigate and tried to test where the error could come from. In the end I ended with the following code:

documentclass[12pt,twoside]{report}
begin{document}
  Hello $1,2,3$.
end{document}

and the same error appears.
I tried to remove the documentclass but the same error appears.
Here’s a printscreen of the error(s);

image of the error(s)

If any of you guys would help me, this is driving me mad!

The log file:

LOG FILE : This is pdfTeX, Version 3.1415926-2.5-1.40.14 (MiKTeX 2.9
64-bit) (preloaded format=pdflatex 2015.6.27) 3 AUG 2015 17:47
entering extended mode

**main.tex (“C:UsersAdminDropboxMestradoTeseLatexMinhatesemain.tex”
LaTeX2e <2011/06/27> Babel and hyphenation
patterns for english, afrikaans, ancientgreek, ar abic, armenian,
assamese, basque, bengali, bokmal, bulgarian, catalan, coptic,
croatian, czech, danish, dutch, esperanto, estonian, farsi, finnish,
french, ga lician, german, german-x-2013-05-26, greek, gujarati,
hindi, hungarian, iceland ic, indonesian, interlingua, irish, italian,
kannada, kurmanji, latin, latvian, lithuanian, malayalam, marathi,
mongolian, mongolianlmc, monogreek, ngerman, n german-x-2013-05-26,
nynorsk, oriya, panjabi, pinyin, polish, portuguese, roman ian,
russian, sanskrit, serbian, slovak, slovenian, spanish, swedish,
swissgerm an, tamil, telugu, turkish, turkmen, ukenglish, ukrainian,
uppersorbian, usengl ishmax, welsh, loaded.

(“C:Program FilesMiKTeX2.9texlatexbasereport.cls” Document Class: >report 2007/10/19 v1.4h Standard LaTeX document class (“C:Program >FilesMiKTeX
2.9texlatexbasesize12.clo” File: size12.clo 2007/10/19 v1.4h Standard >LaTeX file (size option) ) c@part=count79
c@chapter=count80
c@section=count81
c@subsection=count82
c@subsubsection=count83
c@paragraph=count84
c@subparagraph=count85
c@figure=count86
c@table=count87
abovecaptionskip=skip41
belowcaptionskip=skip42
bibindent=dimen102 )

(“C:UsersAdminDropboxMestradoTeseLatexMinha tesemain.aux” !

Text line contains an invalid character. l.3 … A funny symbol that
I can’t read has just been input. Continue and I’ll forget it ever
happened. ! Text line contains an invalid character. l.3 … A funny
symbol that I can’t read has just been input. Continue and I’ll forget
it ever happened.

[… the same error over and over …]

! ==> Fatal error occurred, no output PDF file produced!

3 Answers

Sometimes I get such errors due to corrupted auxiliary files, e.g. a truncated *.aux or such due to killing pdflatex. Other source can be "invisible" garbage in the file, which can be e.g. control characters that snuck in, or even some hilarity like a terminal escape that goes back and overwrites some junk with spaces. Another possibility is that you have characters in the file that look normal, but aren't (e.g. modern systems display UTF-8 text with little trouble; a Greek omicron looks like Latin o, but they are different characters; unless you set the encoding up for UTF-8 you'll get grief). Practical solution: Delete all intermediate files and try again. If the problem persists, open the file and retype the offending line, deleting the original. Sometimes you'd need to rewrite a paragraph to fix this.

Update: Just had an infuriating round with pdflatex because somehow I inserted some strange character (looked like a apostrophe, but wasn't --- next to invisible).

Correct answer by vonbrand on March 10, 2021

My assumption is that the wrong input file is used. Instead of the source file, LaTeX is given a binary file, like a PDF file, for example.

Another option is a wrong encoding. There is some support for UTF-8. But UTF-16 and UTF-32 are not supported. The added zero bytes also cause these kind of error.

When TeX is running, it generates a file with extension .log. This log shows you the input files as well as the complete error messages. Please, update the question to include the .log file (at least from the start up to the first error messages, no need for all error messages).

Answered by Heiko Oberdiek on March 10, 2021

When I compile with documentclass{article}, it worked well. When I compile with your documentclass, it worked well. There may be problem with the compiler.

Answered by Vaman Kulkarni on March 10, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP