I am trying to learn pgfkeys based on the example code shown in How to create a command with key values?. Everything seems to be working as expected except that the code is sensitive to a blank line before the first parameter. Is there any way to get rid of this so that both beautiful and ugly work in the MWE below? (I was expecting this to already by answered, but a search did not seem to find it...)
\documentclass[10pt]{article}
\usepackage{pgfkeys}
\pgfkeys{ /mycmd/.is family, /mycmd,
default/.style = {cmdOpt = {}},
cmdOpt/.estore in = \mycmdOpt}
\newcommand\mycmd[1][]{%
\pgfkeys{/mycmd, default, #1}%
Hello \mycmdOpt World.
}
\begin{document}
\mycmd[cmdOpt = beautiful];
\mycmd[
cmdOpt = ugly];
\end{document}
EDIT:
Note that there are two workarounds that I know of:
\mycmd[%
cmdOpt = ugly];
and
\mycmd[,
cmdOpt = ugly];
I was hoping for something that would not require either of these...
\csname...\endcsnamepair so you need to create the key starting with a/to define thepath. Otherwise a whitespace character becomes the key root. – percusse Apr 26 '18 at 15:26#1– percusse Apr 26 '18 at 15:32