I'm finding the following preference loading syntax popping up a lot in the newer packages:

From tikz

\tikzset{help lines/.style=very thin}

From tcolorbox


I assume this has something to do with LaTeX3, but I don't know where to go to read up on this and better understand the syntax. I've looked at expl3 but didn't find anything helpful there (truthfully, my head was spinning a bit just trying to understand the new syntax there).

Could someone point me in the right direction for a reference?

For example, reading the documentation of xkeyval helped immensely in creating my own environments to which I could pass key values.

How would I start writing my own code like


1 Answer 1


This "preference loading syntax comes from tikz. tcolorbox loads the package tikz. You can do this procedure with any tikz-based packages like

  • the tkz-collection (tkz-base, tkz-euclide, etc.),
  • chemfig,
  • tikz-timing
  • hf-tikz
  • mdframed (loads tikz when needed, additionally defines tikzsetting option that passes options to \tikzset),

The explanation for this syntax can be found in Section 12.4 of the pgf manual (for both version 2.10 and the 2.10-CVS versions). I quote from the manual (version 2.10):

Many commands and environments of Tik Z accept options. These options are so-called key lists. To process the options, the following command is used, which you can also call yourself. Note that it is usually better not to call this command directly, since this will ensure that the effect of options are local to a well-defined scope.


This command will process the options using the \pgfkeys command, documented in detail in Section 55, with the default path set to /tikz. Under normal circumstances, the options will be lists of comma-separated pairs of the form key = value, but more fancy things can happen when you use the power of the pgfkeys mechanism, see Section 55 once more. When a pair key = value is processed, the following happens:

  1. If the key is a full key (starts with a slash) it is handled directly as described in Section 55.
  2. Otherwise (which is usually the case), it is checked whether /tikz/ key is a key and, if so, it is executed.
  3. Otherwise, it is checked whether /pgf/ key is a key and, if so, it is executed.
  4. Otherwise, it is checked whether key is a color and, if so, color = key is executed.
  5. Otherwise, it is checked whether key contains a dash and, if so, arrows = key is executed.
  6. Otherwise, it is checked whether key is the name of a shape and, if so, shape = key is executed.
  7. Otherwise, an error message is printed. Note that by the above description, all keys starting with /tikz and also all keys starting with /pgf can be used as key s in an options list.


As mentioned by Paul Gaborit in comment for tikz, Chapter 55, Key Management, contains the complete reference for the \tikzset options. There is a direct link to this chapter from Section 12.4. In my copy of the version 2.10-CVS, it is found in Chapter 63.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .