I would like to add newlines inside a verbatim, through \directlua
. Why is there no newline in the first verbatim
?
\documentclass{article}
\usepackage{luacode,verbatim}
\begin{document}
\directlua{tex.print([[\unexpanded{\begin{verbatim}]]..'one\ntwo'..[[\end{verbatim}}]])}
\begin{verbatim}
one
two
\end{verbatim}
\end{document}
'one\ntwo'
is actually read from a JSON file, which I wrote to with Python, which used a\n
. Thanks to TeXnician's solution I now know I have to replace all occurences of'\n'
in the JSON by'\r'
, and then it works!