# Syntax for the node command

Look at the two diagrams at the top of page 50 and the diagram at the top of page 220 in the manual at the following web site. http://mirrors.rit.edu/CTAN/graphics/pgf/base/doc/pgfmanual.pdf I have two questions about these diagrams.

For the diagram on page 50, here is the code.

\begin{tikzpicture}

[place/.style={circle,draw=blue!50,fill=blue!20,thick},
transition/.style={rectangle,draw=black!50,fill=black!20,thick}]
\node at (0,2) [place] {};
\node at (0,1) [place] {};
\node at (0,0) [place] {};
\node at (1,1)[transition] {};
\node at(-1,1)[transition] {};

\end{tikzpicture}


For the diagram on page 220, here is the code.

\begin{tikzpicture}
\draw

(0,0) node[inner sep=0pt,draw] {tight}
(0cm,2em) node[inner sep=5pt,draw] {loose}
(0cm,4em) node[fill=yellow!80!black] {default};

\end{tikzpicture}


On page 50, it seems to me that variables "place" and "transition are being declared. What is the sytax for the /.style command? I could have written

\node at (0,2) [circle,draw=blue!50,fill=blue!20,thick] {}


\node at (0,2) [place] {};  .


Is that right?

When does one use node as was used on page 220 and when does one use \node as on page 50?

On page 220, why does TikZ draw a rectangle about the given text?

I have three questions about the syntax for the code on page 50.

• The rectangle is drawn with black!50. Is there a black50?
• Why is there an exclamation point?
• To what is thick referring?
• \node is a shortcut for \path node. Hopefully this would answer one of your questions. The exclamation point is the syntax used by package xcolor (also used by tikz) to declare "mixings" of colors. In this case it is a mix of 50% black (and 50% white which is the default when the second colour is omitted). thick is the line width. – JLDiaz Jul 14 '14 at 20:46
• All the [options] for tikz are actually calls to \pgfkeys (or \pgfkeysvalueof) with different prefixes attached. – John Kormylo Jul 14 '14 at 22:12
• Answer to first question is 'yes'. Styles are a convenience and help keep formatting consistent. thick is the thickness of the lines. If you pass draw to the node, tikz draws the box around it which is rectangular by default. Too many questions for one question! – cfr Jul 15 '14 at 0:36

In a nutshell, <name>/.style syntax is a container of other styles or codes that are called in the order of declaration.

This is the instance of the more general key=value system and it is part of the powerful pgfkeys library which you can read up in the same manual under libraries section.

So to your first question, yes that would be equivalent instead of calling the place style.

If you only want to place a node on a path, it is kind of tedious to write everytime \path node instead \node is defined which is a shorthand. But in case you have other path constructing commands then you use node, for example,

\draw (0,0) node[draw] {a} -- (1,1) node {b};


As you can see from this first node has a rectangle and the second doesn't because we supplied draw key to the node in the first node. Every node has a shape which you can draw or not (unless we define a new node with no background but that's not relevant now). You can also fill that shape, example

\node[fill=yellow,draw=red] {A};


So if you supply colors to these commands they draw or fill the value of the key.

TikZ uses xcolor package to define and use colors. Color mixing is done via ! and you can use more than two colors. If you omit the mix colors white is used by default. Here, black!50 is equal to mix black and white equally. The number between 0 and 100 selects x percent you take the left hand side and mix it with 100-x with the right hand side (well at least you can take it as a simple mental shortcut. Color models are tricky business). Examples;

\begin{tikzpicture}
\fill[blue!20!yellow!60!red] (2,0) rectangle (3,1);
\fill[blue!20!yellow!60] (1,0) rectangle (2,1);    %  = (blue!20!yellow)!60!white
\fill[blue!20!!60] (0,0) rectangle (1,1);          %  = (blue!20!white)!60!white
\end{tikzpicture}


The drawing can have different line widths, and TikZ defines shortcuts for mostly used line width arguments as follows,

\tikzset{ultra thin /.style=line width=0.1pt,
very thin/.style  =line width=0.2pt,
thin/.style       =line width=0.4pt, %<= default
semithick/.style  =line width=0.6pt,
thick/.style      =line width=0.8pt,
very thick/.style =line width=1.2pt,
ultra thick/.style=line width=1.6pt
}


When you use thick on a path or a node together with draw the drawing is done using a pen with the line width of 0.8 pt.