我遇到了这个问题,但无法找到解决办法。
错误 line11 !文本行包含无效字符
这些是第 1 至 16 行,没有看到任何无效字符
\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}
答案1
以下文件在 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
结果:
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
无效字符错误消息可以按照以下方式分析:
识别输入文件。这可以通过仔细分析日志文件/输出来完成。TeX 将文件名打印在括号内,右括号表示文件已读取并关闭。
TeX 编译器选项也可以提供帮助,例如
-file-line-error
(TeX Live)或--c-style-errors
(MiKTeX)。错误消息中已包含行号。
然后可以在十六进制查看器/编辑器中检查文件。可以在错误行中查找不寻常/意外的字符(例如上面显示的字符代码)。文本查看器/编辑器通常不是一个好的选择,因为它可能会隐藏一些字符代码(控制字符、零字节、不可见字符等)。