I'm really wanting to make use of LaTeX3's regular expressions package (l3regex) but am struggling to use LaTeX3 commands in general. Code that works on its own in the preamble fails when embedded in a macro. For example, why does this fail?
\documentclass[a4paper,10pt]{article}
\usepackage{expl3}
\newcommand* \blahblah[0] {%
\ExplSyntaxOn
\tl_set:Nn \l_my_one_tl { That~cat. }
\ExplSyntaxOff
}
\begin{document}
\blahblah
\end{document}
By contrast, if you take the contents of the \blahblah macro and put them outside of the \newcommand*, then everything works fine. There's something about being inside of the macro definition that's causing problems.
What am I missing?
\ExplSyntaxOn ... \ExplSyntaxOffhas to be outside the macro body. – Henri Menke Nov 01 '17 at 07:17\l_my_one_tloutside of the macro with\tl_new:N \l_my_one_tltoo. – Nov 01 '17 at 07:44