I've found the question Default value for a key defined with pgfkeys which works fine. But I would like to define an .is choice key with a default value, and I can't seem to get things to work.

I've tried something along the following lines

\def\ae@par@style{CIAO MOON}
  width/.store in=\ae@subcolumn@width,
  height/.store in=\ae@subcolumn@height,
  par style/.code/.default={\def\ae@par@style{HELLO WORLD}},
  par style/.is choice,
  par style/raggedright/.code={\let\ae@par@style\raggedright},


I've also tried setting the default value using

  par style/.default={\def\ae@par@style{HELLO WORLD}},


  par style/.default/.code={\def\ae@par@style{HELLO WORLD}},

But none of these have the desired effect.

How can I set a default value for a choice key?

1 Answer 1


Default for an is choice is one of the choices, so simply do this:

\pgfkeys{/tmp/.is choice}

This small example shows the expected behaviour:

\pgfkeys{/test/my choice/.is choice,
    /test/my choice/list/.code={\def\tmp{list}},
    /test/my choice/array/.code={\def\tmp{array}},


\pgfkeys{/test/my choice=array}

\pgfkeys{/test/my choice=list}

\pgfkeys{/test/my choice/.default=list}

\pgfkeys{/test/my choice=array}

\pgfkeys{/test/my choice}


Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.