[Tex/LaTex] tikzpicture options causing “There is no [ in font nullfont!”

tikz-pgf

I'm following TikZ & PGF Manual, on page 47 (drawing a Petri net). The example is demonstrating making every label red with the following line:

\begin{tikzpicture}[every label/.style={red}]

When I use this the label does turn red, but I lose all other color: enter image description here

(and here is my image without the [every label/.style={red}] portion):

enter image description here

My log contains a bunch of lines like this:

Missing character: There is no [ in font nullfont!
Missing character: There is no p in font nullfont!
Missing character: There is no l in font nullfont!

This question suggests that blank lines are the cause, but my image works when I remove the [every label/.style={red}] portion, and doesn't when I put it back. This question suggests that I've got bare text. I'm afraid I don't know enough to determine whether this is the case for me (but I am copying from the linked manual…).

Could somebody shed light on this issue? Here's my minimal non-working example:

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{arrows,decorations.pathmorphing,backgrounds,positioning, fit,petri}
\begin{document}
\begin{tikzpicture}[every label/.style={red}]
    [place/.style={circle,draw=blue!50,fill=blue!20,thick,
                    inner sep=0pt, minimum size=6mm},
    transition/.style={rectangle,draw=black!50,fill=black!20,thick,
                    inner sep=0pt, minimum size=4mm}]
    %
    \node [place] (waiting) at ( 0,2)   {};
    \node [place] (critical) at ( 0,1)  [below=of waiting]  {};
    \node [place] (semaphore) at ( 0,0) [below=of critical,label=above:$s\le3$] {};
    \node [transition] (leave critical) at ( 1,1) [right=of critical]  {};
    \node [transition] (enter critical) at (-1,1) [left =of critical]  {};
\end{tikzpicture}
\end{document}

Best Answer

Got it.

\begin{tikzpicture}[every label/.style={red}]
    [place/.style={circle,draw=blue!50,fill=blue!20,thick,
                    inner sep=0pt, minimum size=6mm},
    transition/.style={rectangle,draw=black!50,fill=black!20,thick,
                    inner sep=0pt, minimum size=4mm}]

This has two style setup sections (two sections in [ ]). One of them (the second) is being interpreted as bare text, instead of an addendum to the first. Because the second set contains the color for the nodes, they weren't being colored.

To fix this, I should just use a single [ ... ] containing all my styling:

\begin{tikzpicture}[every label/.style={red},
                   place/.style={circle,draw=blue!50,fill=blue!20,thick,
                         inner sep=0pt,minimum size=6mm},
                   transition/.style={rectangle,draw=black!50,fill=black!20,thick,
                         inner sep=0pt,minimum size=4mm}]