Closed Qrrbrbirlbel closed 1 month ago
According to the docs of \pgfkeysdefnargs{<key>}{<arg count>}{<code>}
and /.code n args={<arg count>}{<code>}
, it seems to me this difference is intentional, hence expected.
\pgfkeysdefnargs
https://github.com/pgf-tikz/pgf/blob/44f8137449b34f62bc6371bd442ae5cc98f60f18/doc/generic/pgf/pgfmanual-en-pgfkeys.tex#L616\pgfkeys-defnargs
and -defargs{<key>}{<arg pattern>}{<code>}
https://github.com/pgf-tikz/pgf/blob/44f8137449b34f62bc6371bd442ae5cc98f60f18/doc/generic/pgf/pgfmanual-en-pgfkeys.tex#L634-L638/.code n args
https://github.com/pgf-tikz/pgf/blob/44f8137449b34f62bc6371bd442ae5cc98f60f18/doc/generic/pgf/pgfmanual-en-pgfkeys.tex#L1046-L1048Maybe the doc of \pgfkeysdefnargs
can be enhanced to explicitly mention that, while similar to \pgfkeysdef
, the final argument patten of \pgfkeysdefnargs
constructed from <arg count>
is not delimited by \pgfeov
at the end.
Doc of
\pgfkeysdefnargs
https://github.com/pgf-tikz/pgf/blob/44f8137449b34f62bc6371bd442ae5cc98f60f18/doc/generic/pgf/pgfmanual-en-pgfkeys.tex#L616
Ah, I've missed the text after the example and read only the first sentence:
https://github.com/pgf-tikz/pgf/blob/44f8137449b34f62bc6371bd442ae5cc98f60f18/doc/generic/pgf/pgfmanual-en-pgfkeys.tex#L1038-L1039
where it simply says it works “like /.code
”.
Maybe the doc of
\pgfkeysdefnargs
can be enhanced to explicitly mention that, while similar to\pgfkeysdef
, the final argument patten of\pgfkeysdefnargs
constructed from<arg count>
is not delimited by\pgfeov
at the end.
It certainly surprised me since I was under the impression everything is delimited in PGFKeys (it kind of still is, of course, because the main /.@cmd
still uses \pgfeov
but forwards the argment to /.@@body
without it).
I agree, it seems intentional – to allow spaces between arguments, I guess.
Brief outline of the bug
Keys defined by
\pgfkeysdefnargs
(i.e..code n args
/.style n args
) are not delimited by\pgfeov
at the end while keys defined with\pgfkeysdefargs
(all others) are.Suggested fix is to include
\pgfeov
in the.@args
as well as in the call to.@@body
:Though, I admit, I don't understand why these get such special treatment with their own
.@@body
value. Can't this be done directly with\pgfkeys(e)defargs
so that it does exactly the same as if we'd have written\pgfkeysdefargs{/key}{#1#2…}{<body>}
?Minimal working example (MWE)
prints
leaving
CDEF
in the input stream. (Inside a TikZ Picture this leads to “Missing character” warnings.)