2

I want to put some systematic code at beginning and at the end of a luacode environment.

Why this doesn't work.

\documentclass{article}

\usepackage{xparse,luacode}

\NewDocumentEnvironment{LTG}{%
        \begin{luacode}
    }{%
        \end{luacode}
}

\begin{document}

essai

\end{document}
5

\NewDocumentEnvironment needs at least an empty {} argument specifier -- this is missing in the OP.

The classical \newenvironment does not require the classical argument specifier brackets [] at all, it can be omitted then.

The error here would occur with basically any code following the environment name bracket, i.e. {LTG}, making xparse believe, that \begin{luacode} is the argument specifier, which must fail here of course.

\documentclass{article}

\usepackage{xparse,luacode}

\NewDocumentEnvironment{LTG}{}{%
 \begin{luacode}
 }{%
  \end{luacode}
 }

\begin{document}

essai

\end{document}
  • Please don't ask whether the luacode inside such an environment is useful at all ;-) – user31729 May 16 '16 at 18:09

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.