Xelatex 编译器的 Latex 运行时错误

问题描述

环境:ubuntu18.04 + texlive-2020 + texstudio

我已经成功安装了 texlive 并通过使用 latex -v 进行测试来确定; xelatex -v,他们工作得很好。在 texstudio 中,我使用 latex、pdflatex、xelatex 和 lualatex 路径完成了我的 texstudio 配置。

这是我的乳胶代码,很容易阅读:

\documentclass{article}

\usepackage{xeCJK}

\begin{document}
    
    hello,你好
    
\end{document}

但是,当我使用 xelatex 进行编译时,出现了这样的错误:(我使用 pdflatex 编译器构建它并且没有中文也能正常工作。)

expl3.sty error: line 148

File ended while scanning use of \__sys_tmp:w. { \sys_load_backend:n { } }

Missing number,treated as zero. { \sys_load_backend:n { } }

Missing = inserted for \ifnum. { \sys_load_backend:n { } }

Missing number,treated as zero. { \sys_load_backend:n { } }

xeCJK.sty error:

TeX capacity exceeded,sorry [save size=80000]. \xeCJKResetCharClass

我看到了 expl3.sty 第 148 行的代码片段:

{ \sys_load_backend:n { } }

既没有括号错误也没有语法错误,这个错误是怎么产生的?(超出的错误可能是其他错误引起的,我相信。) 我的乳胶构建日志:

(/usr/local/texlive/2020/texmf-dist/tex/xelatex/xecjk/xeCJK.sty
(/usr/local/texlive/2020/texmf-dist/tex/latex/l3kernel/expl3.sty
Package: expl3 2021-01-09 L3 programming layer (loader) 

(/usr/local/texlive/2020/texmf-dist/tex/latex/l3backend/l3backend-xetex.def
File: l3backend-xetex.def 2020-01-29 L3 backend support: XeTeX

(|extractbb --version))
Runaway argument?
\q_stop <\__int_eval:w \c_zero_int \__int_eval_end: \exp_after:wN \use_ii:nnn \
ETC.
! File ended while scanning use of \__sys_tmp:w.
<inserted text> 
                \par 
l.148   { \sys_load_backend:n { } }
                                   
I SUSPECT you have forgotten a `}',causing me
to read past where you wanted me to stop.
I'll try to recover; but if the error is serIoUs,you'd better type `E' or `X' Now and fix your file.

! Missing number,treated as zero.
<to be read again> 
                   \__kernel_tl_set:Nx 
l.148   { \sys_load_backend:n { } }
                                   
A number should have been here; I inserted `0'.
(If you can't figure out why I needed to see a number,look up `weird error' in the index to The TeXbook.)

! Missing = inserted for \ifnum.
<to be read again> 
                   \__kernel_tl_set:Nx 
l.148   { \sys_load_backend:n { } }
                                   
I was expecting to see `<',`=',or `>'. Didn't.

! Missing number,look up `weird error' in the index to The TeXbook.)

)
Package: xeCJK 2020/10/19 v3.8.6 typesetting CJK scripts with XeLaTeX

(/usr/local/texlive/2020/texmf-dist/tex/latex/l3packages/l3keys2e/l3keys2e.sty
Package: l3keys2e 2020-10-27 LaTeX2e option processing using LaTeX3 keys
)
(/usr/local/texlive/2020/texmf-dist/tex/latex/l3packages/xtemplate/xtemplate.st
y
Package: xtemplate 2020-10-27 L3 Experimental prototype document functions
\l__xtemplate_tmp_dim=\dimen139
\l__xtemplate_tmp_int=\count181
\l__xtemplate_tmp_muskip=\muskip16
\l__xtemplate_tmp_skip=\skip49
) (/usr/local/texlive/2020/texmf-dist/tex/latex/l3packages/xparse/xparse.sty
Package: xparse 2020-10-27 L3 Experimental document command parser

(/usr/local/texlive/2020/texmf-dist/tex/latex/l3packages/xparse/xparse-generic.
tex))
\l__xeCJK_tmp_int=\count182
\l__xeCJK_tmp_Box=\Box47
\l__xeCJK_tmp_dim=\dimen140
\l__xeCJK_tmp_skip=\skip50
 (/usr/local/texlive/2020/texmf-dist/tex/latex/ctex/ctexhook.sty
Package: ctexhook 2020/10/19 v2.5.5 Document and package hooks (CTEX)
)
\g__xeCJK_space_factor_int=\count183
\l__xeCJK_begin_int=\count184
\l__xeCJK_end_int=\count185
\c__xeCJK_CJK_class_int=\XeTeXcharclass1
\c__xeCJK_FullLeft_class_int=\XeTeXcharclass2
\c__xeCJK_FullRight_class_int=\XeTeXcharclass3
\c__xeCJK_HalfLeft_class_int=\XeTeXcharclass4
\c__xeCJK_HalfRight_class_int=\XeTeXcharclass5
\c__xeCJK_normalSpace_class_int=\XeTeXcharclass6
\c__xeCJK_CM_class_int=\XeTeXcharclass7
\c__xeCJK_HangulJamo_class_int=\XeTeXcharclass8

! TeX capacity exceeded,sorry [save size=80000].
<argument> ..._xeCJK_begin_int =\l__xeCJK_tmp_int 
                                                  \int_incr:N \l__xeCJK_begi...
l.656 \xeCJKResetCharClass
                          
If you really absolutely need more capacity,you can ask a wizard to enlarge me.

 
Here is how much of TeX's memory you used:
 973 strings out of 477220
 23745 string characters out of 5830450
 300467 words of memory out of 5000000
 20745 multiletter control sequences out of 15000+600000
 403438 words of font info for 28 fonts,out of 8000000 for 9000
 1348 hyphenation exceptions out of 8191
 67i,0n,75p,234b,80001s stack positions out of 5000i,500n,10000p,200000b,80000s
No pages of output.

所以我的问题是:

  1. 什么是\sys_load_backend,是关键字吗?
  2. expl3.sty 文件损坏了吗?如果是,我该如何解决
  3. 最糟糕的情况:我需要重置 texlive 吗?虽然我已经这样做了两次:(

解决方法

我通过将TexLive添加到TexStudio对路径的理解中解决了这个问题:

  1. 从“选项”下拉菜单中打开“配置 TeXstudio...”。
  2. 选中“显示高级选项”。
  3. 转到“构建”部分。
  4. 在“Build Options”中,在“Commands ($PATH)”字段中填写 TeXLive bin 目录。
,

我也在 win10 上使用了 miktex 安装程序版本,但遇到了与 @Mark 相同的错误。我的解决办法很简单:以管理员权限运行Texworks。这将解决问题。

,

我在 win10 上使用 miktex 便携式,但遇到了相同的错误。这是我发现的:

  1. \sys_load_backend 并不重要,重要的是 __sys_tmp:w。此代码可以在文件 l3backend-xetex.def 中找到并引导解决方案,见下文
  2. 不,expl3.sty 没有损坏。此文件的出现只是一种现象,与错误及其原因无关。
  3. 我认为安装不需要重置;我的错误日志文件给了我这个额外的信息,导致了真正的原因:

文件:l3backend-xetex.def 2021-03-18 L3 后端支持:XeTeX ())
失控的论点? Der Befehl "extractbb" ist entweder falsch geschrieben oder konnte ni\ETC。 !扫描使用 __sys_tmp:w 时文件结束。

l3backend-xetex.def__sys_tmp:w 并且非常接近它的 extractbb.exe 调用,显然找不到在我的便携式安装中。我以他的方式修复了它:将extractbb.exe的完整路径添加到您的Windows系统环境变量中(对应于unix中的等价物)。然后它不再完全便携,但至少它可以工作。希望这将被修复...