5

I am currently learning TikZ, and i see that when defining a style in the options of a tikzfigure i set it as:

<Name of the style>/.style={level distance=4.5cm,sibling angle=90}

I know the same can be realized using tikzstyle, but I see the /.popping up everywhere. Now I've looked in the TikZmanual, but I didn't seem to find any explanation on the meaning of this symbol.

  • 4
    Did you see the section of pgfkeys? ('Key management', page 875 in the current manual) – Joseph Wright Oct 19 '16 at 11:54
  • @JosephWright Great tip! I was looking for "/." of "Slash dot" in the index but that wasn't there :'(. – Nick Oct 20 '16 at 6:35
6

In unix based systems the items starting with a dot is hidden when listed. Note the famous website name Slashdot. I think, this is kind of an homage to or imitation of that behavior.

Usually the keys can be comprised of folder like structures, e.g., when you use \tikzset{line width=1pt} it is roughly equivalent to

\pgfkeys{/tikz/line width=1pt}

As you can see there are no dots involved. This is because line width is an exposed key of the tikz key family. However certain keys have their handlers very much like what hidden files in a folder serve. These are called handlers and start with a dot such as .style, .code, .value required and so on.

In combination, it looks like the dot belongs to the slash but it actually belongs to the handlers. Handlers are too long to be explained here but since you get the notation idea hopefully you can read about them a bit better in the manual.

For the \tikzstyle please have a look at Should \tikzset or \tikzstyle be used to define TikZ styles? and try to switch to \tikzset instead.

  • 1
    An answer and a tip in one, nice! Since I'm learing TikZ, I don't heave stubborn habits and can easilly apply this :). Now your tip is in contradiction with the (accepted) answer to the question you quoted, is there a reason for this? – Nick Oct 20 '16 at 6:40
  • Second follow up question (just to get a full answer for myself). If I write \tikzset{<name of style>/.style={<attributes>}}. Does this then mean that I for the style <name of style> give the different style <attributes>, of is it wrong to see it like that? – Nick Oct 20 '16 at 6:44
  • In the second comment is something I couldn't get the message but in the first I don't see the contradiction. Care to elaborate? – percusse Oct 20 '16 at 12:17
  • Wel the accepted answer in the question you are pointing to suggests the opposite of what you are saying. But never mind that, I get your point that \tikzset is more general. About the second comment, the subquestion there was ''What does \tikzset{<name of style>/.style={<attributes>}} do exactly?'' Does it set the style attributes (coupled to <name of style> to the given <atrributes>? Or does something else happen? – Nick Oct 24 '16 at 7:13

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.