LuaLatex y TikZ

LuaLatex y TikZ

Tengo algunas dificultades con LuaLatex y TikZ. ¿Pueden algunos explicarme qué está mal con el siguiente MWE?

\documentclass{amsart}

\usepackage{luacode} % read this somewhere, doesn't change anything.
\usepackage{tikz}

\begin{document}

\section{Some sections}
  Some random text.

  \directlua{ tex.print([=[
    \begin{tikzpicture}[thick]
      \draw (0,0) to (1,1);
    \end{tikzpicture}]=])
  }

\end{document}

El mismo tipo de código Lua funciona cuando se usa desde un script externo. Pero así da

! Undefined control sequence.
\GTS@RemoveLeft ...{}{}\GTS@Nil }\edef \GTS@Token

Respuesta1

Una codificación alternativa con luacode:

\documentclass{article}
\usepackage{luacode}
\usepackage{tikz}

\begin{document}
\luaexec{
tp=tex.print
tp("\\begin{tikzpicture}[thick]")
tp("\\draw (0,0) to (1,1);")
tp("\\end{tikzpicture}")
}
\end{document}

información relacionada