[luatex] Problem tex.print()-ing a verbatim block

Eduardo Ochs eduardoochs at gmail.com
Sat Jun 6 02:36:10 CEST 2020


Hello list,

if I run something like this from Lua

  tex.print([[
  \begin{verbatim}
  foo
    poo
      boo
  \end{verbatim}
  ]])

the newlines in the verbatim are converted to spaces... how do I fix
this?

I'm running Debian Stable and I've tried the test below - after the
line that says "snip-snip" - with the two versions of lualatex that I
have here. Thanks in advance!

  Eduardo Ochs
  http://angg.twu.net/dednat6.html


--snip--snip--

/usr/bin/lualatex --version
# -> This is LuaTeX, Version 1.07.0 (TeX Live 2019/dev/Debian)
/usr/local/texlive/2019/bin/x86_64-linux/lualatex --version
# -> This is LuaTeX, Version 1.10.0 (TeX Live 2019)

cat > test.tex <<'==='
\documentclass{article}
\begin{document}
\catcode`\^^J=10
\directlua{dofile "test.lua"}
Compare with:
\begin{verbatim}foo   poo     boo\end{verbatim}
\begin{verbatim}foo  poo    boo\end{verbatim}
\begin{verbatim}
foo
  poo
    boo
\end{verbatim}
\end{document}
===

cat > test.lua <<'==='
str = [[
\begin{verbatim}
foo
  poo
    boo
\end{verbatim}
]]
print(str)
tex.print(str)
===

lualatex test.tex
xpdf     test.pdf


More information about the luatex mailing list.