I want to use a TikZ environment inside an \ExplSyntaxOn... \ExplSyntaxOff
block.
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{xparse}
\usepackage{tikz}
\usetikzlibrary{positioning}
\ExplSyntaxOn
\NewDocumentCommand{\maketikz}{ O{,} m }{%
\begin{tikzpicture}[%
padding/.append style={inner sep=2px},%
node distance=2pt
]
\node[draw] {#2};
\end{tikzpicture}
}
\ExplSyntaxOff
\begin{document}
\maketikz[;]{Yes}
\end{document}
During the build process I get errors for the TikZ styles: I do not know the key '/tikz/padding/.appendstyle', to which you passed 'innersep=2px...
and I do not know the key '/tikz/nodedistance', to which you passed '2pt'...
.
Without \ExplSyntaxOn
it builds without any errors.
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{xparse}
\usepackage{tikz}
\usetikzlibrary{positioning}
\newcommand{\maketikz}[2][,]{
\begin{tikzpicture}[%
padding/.append style={inner sep=2px},%
node distance=2pt
]
\node[draw] {#2};
\end{tikzpicture}
}
\begin{document}
\maketikz[;]{Yes}
\end{document}
Where is my mistake?
~
, e.g.padding/.append~style={inner~sep=2px}
px
. Very likely it is not what you might think it to be.