2

In the following example, the key formatting has the initial default value apmep.

\pgfkeys{
    /test/.is family, /test,
    formatting/.initial = apmep
}

I would also like that the value of the key formatting can only belong to the set of values {apmep, basic, design}. Is it possible ?

projetmbc
  • 13,315

1 Answers1

3

You seem to want to create a multiple-choice key. That is done using the .is choice handler:

\documentclass{article}

\usepackage{pgfkeys}
\pgfkeys{
    /test/.is family,
    /test,
      formatting/.is choice,
      formatting/.cd,
        apmep/.code  = \showtokens{apmep},
        basic/.code  = \showtokens{basic},
        design/.code = \showtokens{design}
}
\pgfkeys{/test/formatting = basic}
\pgfkeys{/test/formatting = oops}
\begin{document}
\end{document}

(I've just added some arbitrary code on here so something happens.)

Joseph Wright
  • 259,911
  • 34
  • 706
  • 1,036