我的 Tex 文件中的一些 UTF-8 字符有问题。尽管我以 UTF-8 保存文件,并且我的文本编辑器 (Atom) 可以正确显示所有字符,但 LaTeX 会抛出如下错误:
[no file]:824: Package inputenc Error: Unicode character Δ (U+394) [...tes $(x,y)$ are $x=x_0+Δx$ and $y=y_0+Δ]
[no file]:857: Package inputenc Error: Invalid UTF-8 byte sequence. [ # calculate ω]
[no file]:857: Package inputenc Error: Invalid UTF-8 byte 137. [ # calculate ω]
[no file]:889: Package inputenc Error: Unicode character θ (U+3B8) [...ce $r$. It was previously at an angle $θ]
[no file]:889: Package inputenc Error: Unicode character ω (U+3C9) [...ngle $θ$ and is now at an angle $θ + ω]
[no file]:976: Package inputenc Error: Invalid UTF-8 byte sequence. [ # calculate ω]
我尝试使用 utf(和 utfx)包但无济于事:
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
以下是整个文件的内容:https://pastebin.com/dzzLtUmB。
由于格式是生成的,所以看起来可能有点粗糙。
我能做些什么来修复这个问题吗?
答案1
如果我添加draft
乳胶,则乳胶不会在缺失的数字处停止,由于数学模式标记不正确,会出现几个错误,并且需要重新定义一些 utf8 字符,但您不会收到错误
[no file]:976: Package inputenc Error: Invalid UTF-8 byte sequence. [ # calculate ω]
我怀疑你有一个较旧的 latex 版本,并且在 UTF8 解码器中遇到了错误,可能
https://github.com/latex3/latex2e/pull/83
确保你拥有最新的乳胶。
[draft]
添加跳过丢失的图像后,其余警告是
$ grep -i 'invalid\|error' bb251.log | sort | uniq
! Package amsmath Error: Erroneous nesting of equation structures;
! Package inputenc Error: Unicode character Δ (U+0394)
! Package inputenc Error: Unicode character θ (U+03B8)
! Package inputenc Error: Unicode character ω (U+03C9)
LaTeX Font Warning: Command \large invalid in math mode on input line 659.
LaTeX Font Warning: Command \large invalid in math mode on input line 788.
LaTeX Font Warning: Command \large invalid in math mode on input line 792.
LaTeX Font Warning: Command \large invalid in math mode on input line 794.
LaTeX Font Warning: Command \large invalid in math mode on input line 820.
LaTeX Font Warning: Command \large invalid in math mode on input line 822.
LaTeX Font Warning: Command \large invalid in math mode on input line 900.
LaTeX Font Warning: Command \large invalid in math mode on input line 904.
LaTeX Font Warning: Command \large invalid in math mode on input line 908.
LaTeX Font Warning: Command \large invalid in math mode on input line 916.
LaTeX Font Warning: Command \large invalid in math mode on input line 920.
LaTeX Font Warning: Command \large invalid in math mode on input line 922.
LaTeX Font Warning: Command \large invalid in math mode on input line 926.
LaTeX Font Warning: Command \large invalid in math mode on input line 928.
LaTeX Font Warning: Command \large invalid in math mode on input line 932.
LaTeX Font Warning: Command \large invalid in math mode on input line 934.