6

I would like to automate the creation of some beamer slides using LuaLaTeX. These are my first steps with LuaLaTeX so please excuse my ignorance.

\documentclass{beamer}

\begin{document}

\directlua{
  for i=0, 5 do
    tex.print("\unexpanded{\\begin{frame}}")
    tex.print("Math: $x_{" .. i .. "}$")
    tex.print("\unexpanded{\\end{frame}}")
  end
}

\end{document}

The example compiles and gives the expected result; 6 frames with x_0,1,2,3,5 on it.

I'm a bit unhappy about the additional \unexpands and \s before \begin and \end.

Is there a dedicated LuaTeX command that just inserts latex code 1:1 to the document?

1

a short \frame{..} is possible

\documentclass{beamer}

\begin{document}

\directlua{
  for i=0, 5 do
    tex.print("\string\\frame{")
    tex.print("Math: $x_{" .. i .. "}$")
    tex.print("}")
  end
}

\end{document}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.