pgfkeys seems to have no problem with leading spaces. For instance, adapting the solution from How to create a command with key values?, I can define a key text= as follows:
\pgfkeys{ % <-- NOTE: Space here is ok
/MyMacro/.is family,
/MyMacro,
default MyMacro options/.style={ % <-- NOTE: Space here is ok
text={},
},
text/.store in = \Text,
}
and things work as desired. However, when I attempt to actuall use this key I need to supress the leading space:
\MyMacro{% <-- How to eliminate requiring this?
text={Some Text},
}%
I would be nice to not require that additional %. Is there an easy to way to do that?
Note:
This a only a minor inconvenience, so easy to live with, but thought I should ask in case I am missing something. Also, options in
tikzpictureandaxisenvironment don't have these issue, so am thinking that there is some switch that can resolve this.However, no need to spend too much valuable procastingting time solving this issue -- plus I have a few other real problems realted to
pgfkeysso you can procastinate on those if desired (just gotta build the MWE).
Code:
\documentclass{article}
\usepackage{tikz}
\pgfkeys{ % <-- NOTE: Space here is ok
%% https://tex.stackexchange.com/a/34318/4301
/MyMacro/.is family,
/MyMacro,
default MyMacro options/.style={ % <-- NOTE: Space here is ok
text={},
},
text/.store in = \Text,
}
\newcommand{\MyMacro}[1]{%
\pgfkeys{/MyMacro/.cd, default MyMacro options, #1}%
\Text
}%
\begin{document}
\MyMacro{% <-- How to eliminate requiring this?
text={Some Text},
}%
\end{document}