1

I have come to this problem that I can not figure out the solution.

Error line11 ! Text line contains an invalid character

These are lines 1 to 16 do not see any invalid character

\documentclass[11pt,letterpaper,twoside,final]{article}
\usepackage[letterpaper]{geometry}
\usepackage[french,spanish,english]{babel}  
%\usepackage[T1]{fontec}
\usepackage[latin1]{inputenc}               
\usepackage{amsmath,amsthm,amssymb,latexsym}
\usepackage{bm}
\usepackage{dsfont}
\usepackage{graphics}
\usepackage{hyperref}
\usepackage[page]{appendix}
\usepackage{afterpage,caption}      
\usepackage{apacite}
\usepackage{threeparttablex}
\usepackage{booktabs,longtable}
\usepackage{graphicx,color}
  • 2
    Hi and welcome, are you later inputting any files? The reason is more likely in line 11 of one of those files. – Johannes_B May 12 '15 at 19:22
  • Dear @Johannes_B, Thanks for your quick response. Reading some other sources I have found that the problem is that the .aux file is corrupted and not replaced in compilation. I deleted all files .log .aux .dvi, etc., and it worked. Thanks for your answer. – Julio May 12 '15 at 20:21
2

The following file generates all byte positions with invalid category code setting in vanilla LaTeX:

\makeatletter
\count@=0
\@whilenum\count@<256\do{%
  \ifnum\catcode\count@=15 %
    \immediate\write16{Invalid character position: \the\count@}%
  \fi
  \advance\count@\@ne
}
\@@end

Result:

Invalid character position: 0
Invalid character position: 1
Invalid character position: 2
Invalid character position: 3
Invalid character position: 4
Invalid character position: 5
Invalid character position: 6
Invalid character position: 7
Invalid character position: 8
Invalid character position: 11
Invalid character position: 14
Invalid character position: 15
Invalid character position: 16
Invalid character position: 17
Invalid character position: 18
Invalid character position: 19
Invalid character position: 20
Invalid character position: 21
Invalid character position: 22
Invalid character position: 23
Invalid character position: 24
Invalid character position: 25
Invalid character position: 26
Invalid character position: 27
Invalid character position: 28
Invalid character position: 29
Invalid character position: 30
Invalid character position: 31
Invalid character position: 127

An invalid character error message can be analyzed the following way:

  1. Identification of the input file. This can be done by a careful analysis of the log file/output. TeX prints the file names inside parentheses and the closing parentheses means, the file is read and closed.

    TeX compiler options can also help, e.g. -file-line-error (TeX Live) or --c-style-errors (MiKTeX).

  2. The error message already contains the line number.

  3. Then the file can be inspected in a hex viewer/editor. There the error line can be looked for unusual/unexpected characters (for example with character codes shown above). A text viewer/editor is often not a good choice, because it might suppress some character codes (control characters, zero byte, invisible characters, ...).

  • Holy cow. I wonder if something like this exists in a utility package somewhere. If it doesn't, it certainly should! – Sean Allred May 12 '15 at 22:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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