如果我创建一个文件:
\documentclass{article}
\begin{document}
Hello
\directlua{tex.sprint("Yeahhh"+thisvariabledoesnotexist)}
\end{document}
%%% Local Variables:
%%% mode: latex
%%% TeX-engine: luatex
%%% End:
,还原文件,并在 emacs 中使用 Auctex 进行编译(C-c C-c LaTeX
),我这样做不是出现任何错误,但由于thisvariabledoesnotexist
不存在,它应该打印一个。
如果我检查 emacs 的日志,我可以看到:
Running `LaTeX' on `lettre_gutenberg' with ``lualatex --jobname=lettre_gutenberg -file-line-error --synctex=1 -interaction=nonstopmode lettre_gutenberg.tex''
This is LuaHBTeX, Version 1.15.0 (Web2C 2022/nixos.org)
restricted system commands enabled.
(./lettre_gutenberg.tex
LaTeX2e <2022-11-01> patch level 1
L3 programming layer <2022-12-17>
(/nix/store/6z1x24dwqp88qh769isg4y769w47d1x2-texlive-combined-2022/share/texmf/tex/latex/base/article.cls
Document Class: article 2022/07/02 v1.4n Standard LaTeX document class
(/nix/store/6z1x24dwqp88qh769isg4y769w47d1x2-texlive-combined-2022/share/texmf/tex/latex/base/size10.clo
luaotfload | db : Reload initiated (formats: otf,ttf,ttc); reason: File not found: "lmroman10-regular".))
(/nix/store/6z1x24dwqp88qh769isg4y769w47d1x2-texlive-combined-2022/share/texmf/tex/latex/l3backend/l3backend-luatex.def) (./lettre_gutenberg.aux)
(/nix/store/6z1x24dwqp88qh769isg4y769w47d1x2-texlive-combined-2022/share/texmf/tex/latex/base/ts1cmr.fd)[\directlua]:1: attempt to perform arithmetic on a string value
stack traceback:
[\directlua]:1: in main chunk.
l.7 ...ex.sprint("Yeahhh"+thisvariabledoesnotexist)}
[1{/nix/store/6z1x24dwqp88qh769isg4y769w47d1x2-texlive-combined-2022/share/texmf-var/fonts/map/pdftex/updmap/pdftex.map}] (./lettre_gutenberg.aux))
(see the transcript file for additional information)
406 words of node memory still in use:
3 hlist, 1 vlist, 1 rule, 2 glue, 3 kern, 1 glyph, 4 attribute, 48 glue_spec, 4 attribute_list, 1 write nodes
avail lists: 2:23,3:4,4:2,5:22,6:2,7:40,9:18
</nix/store/6z1x24dwqp88qh769isg4y769w47d1x2-texlive-combined-2022/share/texmf/fonts/opentype/public/lm/lmroman10-regular.otf>
Output written on lettre_gutenberg.pdf (1 page, 2869 bytes).
SyncTeX written on lettre_gutenberg.synctex.gz.
Transcript written on lettre_gutenberg.log.
TeX Output exited abnormally with code 1 at Fri Dec 22 22:38:19
因此错误确实存在,只是显然没有正确解析(尽管如此TeX exited abnormally
,emacs 仍然告诉我“格式化成功”)。您知道如何修复这个问题吗?
请注意,其他 LaTeX 错误类似ERROR: Undefined control sequence. \foo
将按预期打印。