以下 MWE 使 lualatex 在我的计算机上陷入无限循环:
\documentclass{minimal}
\usepackage{luacode}
\begin{luacode*}
start = {42};
\end{luacode*}
\begin{document}
\directlua{tex.sprint(tostring(start))}
\end{document}
似乎我需要一个名为的变量start
,并且需要打印一个数组;然后我得到了这个:
This is LuaTeX, Version 1.10.0 (TeX Live 2019/Debian)
restricted system commands enabled.
(./test.tex
LaTeX2e <2020-02-02> patch level 2
L3 programming layer <2020-02-14>
(/usr/share/texlive/texmf-dist/tex/latex/base/minimal.cls
Document Class: minimal 2001/05/25 Standard LaTeX minimal class
) (/usr/share/texlive/texmf-dist/tex/lualatex/luacode/luacode.sty
(/usr/share/texlive/texmf-dist/tex/generic/iftex/ifluatex.sty
(/usr/share/texlive/texmf-dist/tex/generic/iftex/iftex.sty))
(/usr/share/texlive/texmf-dist/tex/luatex/luatexbase/luatexbase.sty
(/usr/share/texlive/texmf-dist/tex/luatex/ctablestack/ctablestack.sty)))
(/usr/share/texlive/texmf-dist/tex/latex/l3backend/l3backend-pdfmode.def)
(./test.aux) (/usr/share/texlive/texmf-dist/tex/latex/base/ts1cmr.fd)
之后什么都没发生,我无法使用 Ctrl+C 退出该进程;我需要使用 Ctrl+\ 来终止它。GDB 说 lua 卡在这里:
…
#4 0x00007f0ce05c2f9f in ?? () from /usr/lib/x86_64-linux-gnu/libtexlua53.so.5
#5 0x00007f0ce05b956e in lua_pcallk ()
from /usr/lib/x86_64-linux-gnu/libtexlua53.so.5
#6 0x0000555a19f5f21b in lua_node_filter ()
#7 0x0000555a19f78970 in line_break ()
#8 0x0000555a19eb23c9 in end_graf ()
#9 0x0000555a19eb2429 in ?? ()
#10 0x0000555a19eb07f1 in main_control ()
#11 0x0000555a19eacdfa in main_body ()
#12 0x0000555a19e562c2 in main ()
我有 LuaTeX 版本 1.10.0(TeX Live 2019/Debian)
这是另一个有问题的例子:
\documentclass{minimal}
\usepackage{luacode}
\begin{luacode*}
start = "";
\end{luacode*}
\begin{document}
\directlua{tex.sprint(tostring({42}))}
\end{document}
但这有效:
\documentclass{minimal}
\usepackage{luacode}
\begin{luacode*}
star = "";
\end{luacode*}
\begin{document}
\directlua{tex.sprint(tostring({42}))}
\end{document}