I am using pgfkeys
as variables of a newcommand for TikZ pictures. I can transfer numerical values and simple math correctly. However, some math expressions are not transferred to the command. A MWE is provided below.
Why an equality expression and the \unitfrac
are not working?
\documentclass[]{standalone}
\usepackage{units}
\usepackage{siunitx}
\usepackage{tikz}
\pgfkeys{/mycom/.is family, /mycom,
default/.style={text = $?$},
text/.estore in = \mytext}
\newcommand{\mycom}[1][]{
\pgfkeys{/mycom, default, #1}
%some tikx command to display the math
\draw (0,0) node{\mytext};
}
\begin{document}
\begin{tikzpicture}
%\mycom[text = aa] % Does work
%\mycom[text = $5x$] % Does work
%\mycom[text = $5x+6$] % Does work
%\mycom[text = $5x=6$] % Does not work
%\mycom[text = $\unitfrac[10]{kN}{m}$] % Does not work
%\mycom[text = $\si{\kilo\newton/\meter}$] % Does work
\end{tikzpicture}
\end{document}
\per
instead of/
in\si
, and say\sisetup{per-mode=symbol}
to get a/
in the output.