Keys can be set a default value by the handler /.default in pgfkeys. However, when this is used, the name of the key has to be in the list of \pgfkeys(e.g. \pgfkeys{mykey}). My question is: how to make a key get a default value when this key is not in the list of \pgfkeys. Here is my code example for illustration.



\pgfkeys{} % I want to get a typeset of "3" for example

  • This is only an example. There maybe many options in terms of "key=value" in a macro, but user need not specify every option when calling this macro. For those option arguments that do not appear in the list of \pgfkeys, I want to give them default values. – lyl May 19 '18 at 2:08
  • That is to say, not all options argument have to appear in the macro calling which has more than one optional arguments in terms of "key=value". – lyl May 19 '18 at 2:20
  • Thank you marmot for your good info. I think my example is poor which do not explain my real purpose. Yet I just find a solution to my question at tex.stackexchange.com/questions/85754/… . – lyl May 19 '18 at 2:40
  • To be honest I do not really understand the point of your question. Could you please clarify what you mean with "is not in the list of pgfkeys"? Undefined keys which should have a default? – TeXnician May 19 '18 at 7:56
  • @TeXnician There is a macro, for example, \mycmd, it should be call like this: \mycmd[key1=val1,key2=val2,key3=val3,...]{...}. However in many cased, it's unnessessory to specify all these keys. May be \mycmd[key2=val2]{...} is enough in which key1, key3,...keyn have their default values. – lyl May 19 '18 at 9:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.