Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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

\tcbset{noparskip/.style={before....}}

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

\aellettset{myexamquestion/.style={....}}
share|improve this question
    
As far as I know this comes from tikz: ...{name/.style} defines a special style for an element name, defined in the package for the usage with tikz. The meaning on name should be explained in the package documentation. (tcolorbox for example loads tikz) –  Kurt Dec 29 '12 at 2:10
    
@Kurt. In the tikz manual, I see examples of this syntax, but no where where it's explained. I'm mostly interested in knowing how I could write my own code defining and using a similar syntax. –  A.Ellett Dec 29 '12 at 2:12
    
You can see the explanation in Section 12.4 of the pgf manual –  hpesoj626 Dec 29 '12 at 2:21
    
@hpesoj626. Thanks. I think that's what I needed. –  A.Ellett Dec 29 '12 at 2:26
    
I'll turn my comment into an answer. –  hpesoj626 Dec 29 '12 at 3:26

1 Answer 1

up vote 6 down vote accepted

As mentioned by Kurt, 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.

\tikzset{<options>}

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.

Edit

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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