Closed hmenke closed 3 years ago
With current implementation, to successfully pass foo
to key /test
, one has to use four extra pair of braces \pgfkeys{/test={{{{foo}}}}}
, which is rather inconvenient.
Since this only happens to keys defined by <key>/.style n args={1}{...}
(although this kind of usage is fully avoidable), how about specially treat #2 == 1
in definition of \pgfkeysdefnargs@
? For example,
diff --git a/tex/generic/pgf/utilities/pgfkeys.code.tex b/tex/generic/pgf/utilities/pgfkeys.code.tex
index f2288175..6d1027db 100644
--- a/tex/generic/pgf/utilities/pgfkeys.code.tex
+++ b/tex/generic/pgf/utilities/pgfkeys.code.tex
@@ -717,7 +717,11 @@
% (with expansion of '#1'):
\edef\pgfkeys@tempargs{\noexpand\pgfkeysvalueof{#1/.@@body}}%
\def\pgfkeys@temp{\pgfkeysdef{#1}}%
- \expandafter\pgfkeys@temp\expandafter{\pgfkeys@tempargs##1}%
+ \ifnum#2=1\relax
+ \expandafter\pgfkeys@temp\expandafter{\pgfkeys@tempargs{##1}}%
+ \else
+ \expandafter\pgfkeys@temp\expandafter{\pgfkeys@tempargs##1}%
+ \fi
#5{#1/.@body}{#3}%
}
PS: In your example, it seems \pgfset
should be \pgfkeys
.
That's a good idea. Can you submit that as a PR?
Version: 3.1.5b
pgfkeys
will strip braces around single arguments, e.g.will result in
This is totally expected when you know that
/.style
handlers are implemented in terms of/.code
handlers and usual TeX argument brace stripping applies. However, this is not mentioned clearly in the manual.