latexdiff 的编码问题

latexdiff 的编码问题

发现后latexdiff,我想尝试一下,但很快就遇到了一个似乎是编码问题的问题。请考虑以下两个非常简单的示例文件(没有特殊字符):

\documentclass{scrartcl}

\begin{document}
Hello StackExchange.
This is \LaTeX.
\end{document}

第二:

\documentclass{scrartcl}

\begin{document}
Hallo StackExchange.
Hier ist \LaTeX.
\end{document}

然后我运行以下命令(无论如何,utf8 应该是默认编码):

latexdiff -e utf8 helloSE1.tex helloSE2.tex > helloSEdiff.tex

输出文件生成正确,但我收到很多警告,例如:

Unescaped left brace in regex is deprecated, passed through in regex;

首先,当我尝试helloSEdiff.tex使用 Texmaker 打开时,它告诉我无法使用默认编码读取此文件,我需要选择 UTF-16。因此,我可以打开它,但是当我运行pdflatex它时,它只会给出:

! Undefined control sequence.
l.1 \^^@
        d^^@o^^@c^^@u^^@m^^@e^^@n^^@t^^@c^^@l^^@a^^@s^^@s^^@{^^@s^^@c^^@r^^@...

如果这很重要的话,我正在使用 TeX Live 2016。

答案1

我的 Windows 机器上也存在同样的编码问题。我通过使用 notepad++ 打开 tex 文件、转到Encoding tab>Encode in UTF-8-BOM然后保存文件来解决这个问题。然后我就能够在 TexMaker 中打开和编译 tex 文件了。

相关内容