
在我的 report.log 中,我有很多這樣的消息:
(/usr/share/texlive/texmf-dist/tex/generic/xstring/xstring.sty
(/usr/share/texlive/texmf-dist/tex/generic/xstring/xstring.tex
\integerpart=\count405
Invalid UTF-8 byte or sequence at line 35 replaced by U+FFFD.
\decimalpart=\count406
Invalid UTF-8 byte or sequence at line 79 replaced by U+FFFD.
Invalid UTF-8 byte or sequence at line 79 replaced by U+FFFD.
Invalid UTF-8 byte or sequence at line 83 replaced by U+FFFD.
Invalid UTF-8 byte or sequence at line 86 replaced by U+FFFD.
Invalid UTF-8 byte or sequence at line 102 replaced by U+FFFD.
Invalid UTF-8 byte or sequence at line 114 replaced by U+FFFD.
Invalid UTF-8 byte or sequence at line 120 replaced by U+FFFD.
Invalid UTF-8 byte or sequence at line 125 replaced by U+FFFD.
Invalid UTF-8 byte or sequence at line 147 replaced by U+FFFD.
Invalid UTF-8 byte or sequence at line 147 replaced by U+FFFD.
Invalid UTF-8 byte or sequence at line 147 replaced by U+FFFD.
Invalid UTF-8 byte or sequence at line 182 replaced by U+FFFD.
Invalid UTF-8 byte or sequence at line 182 replaced by U+FFFD.
Invalid UTF-8 byte or sequence at line 182 replaced by U+FFFD.
Invalid UTF-8 byte or sequence at line 183 replaced by U+FFFD.
Invalid UTF-8 byte or sequence at line 184 replaced by U+FFFD.
不幸的是,提到的行號與我的文件中的內容不對應report.tex
。如何正確定位這些錯誤?
這是我的.latexmkrc
:
system ("mkdir -p build/figures");
@default_files = ('report.tex');
@cus_dep_list = (@cus_dep_list, "glo gls 0 makenomenclature");
sub makenomenclature {
system("makeindex $_[0].glo -s nomencl.ist -o $_[0].gls"); }
@generated_exts = (@generated_exts, 'glo');
# Custom dependency and function for nomencl package
add_cus_dep( 'nlo', 'nls', 0, 'makenlo2nls' );
sub makenlo2nls {
system( "makeindex -s nomencl.ist -o \"$_[0].nls\" \"$_[0].nlo\"" );
}
$out_dir = 'build';
$pdflatex = 'xelatex --synctex=1 -interaction=nonstopmode -shell-escape';
$latex = 'latex --synctex=1 -interaction=nonstopmode -shell-escape';
答案1
查看日誌片段
(/usr/share/texlive/texmf-dist/tex/generic/xstring/xstring.sty
(/usr/share/texlive/texmf-dist/tex/generic/xstring/xstring.tex
\integerpart=\count405
Invalid UTF-8 byte or sequence at line 35 replaced by U+FFFD.
您會看到(
asxstring.sty
被打開,然後 (
asxstring.tex
被打開,因為錯誤訊息中沒有任何行號與目前開啟的檔案堆疊中的最新檔案)
相關 。xstring.tex
該文件確實有非 ascii 註釋,但在其當前版本中(至少在 texlive 2022 中),它被正確編碼為 UTF-8 並開始:
% !TeX encoding = UTF-8
% Ce fichier contient le code de l'extension "xstring"
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
\def\xstringname {xstring} %
\def\xstringversion {1.84} %
% %
\def\xstringdate {2021/07/21} %
第 35 行,您看到的第一個錯誤是:
\newcount\decimalpart% compteurs utilisés par xstring
評論中帶有 UTF-8 e-acute