如何在每行末尾获得回车符(Lualatex)?
\documentclass{article}
\usepackage[nolinks,forget]{qrcode}%
\begin{document}
\newcommand{\Space}[0]{\ }%
\newcommand{\CarriageReturn}[0]{\?}%
\qrset{height=2.5cm}
\qrcode[version=5]{
\directlua{
for i,p in ipairs( table.pack(1,2,3) )
do
tex.sprint (tostring(p),"\Space line \Space then \Space carriage \Space return" \CarriageReturn)
end
}
}%
% Doesn't work: tex.sprint([[\noexpand\newline]])
% Doesn't work: \CarriageReturn
% Doesn't work: empty line
\end{document}
答案1
您可以使用它在文档中\noexpand\n
打印换行符(\n
在 lua 字符串中) 。调整您的示例,我们得到以下内容:\directlua
\documentclass{article}
\usepackage[nolinks,forget]{qrcode}%
\begin{document}
\newcommand{\Space}[0]{\ }%
\qrset{height=2.5cm}
\qrcode[version=5]{
\directlua{
for i,p in ipairs( table.pack(1,2,3) )
do
tex.sprint (tostring(p),"\Space line \Space then \Space carriage \Space return\noexpand\n")
end
}
}%
\end{document}