In tikz, the macro \draw
accept a optical argument of parameters separated with comma, e.g.
\draw[->, red] (0, 0) -- (1, 1)
I have a self defined macro, in which I want to pass a macro as this optional parameter, i.e. sth like
\def\p{->, red}
\draw[\p] (0, 0) -- (1, 1)
However, I get a ERROR: Package pgf Error: Arrow end type ``>, red'' unknown.
which is the same error with
\draw[{{->, red}}] (0, 0) -- (1, 1)
I think it is because the argument is passed as a single character
and failed to be separated.
Is there a way to do it correctly? (i.e. "unquote" the curly bracket before passing it to the \draw
macro.)
In my particular case, I use xkeyval package to define my macro according to this. Therefore I have to pass the argument through a macro.
(Any tikz specific work around is also helpful. THX)