# Tikz: Package pgfkeys Error: I do not know the key '/tikz/state' after second input

Hey I have to illustrated some networks using Tikz and the first one looks like this, in tikz:

\usetikzlibrary{arrows,automata}
\begin{tikzpicture}[->,>=stealth',shorten >=1pt,auto,node distance=2cm,
semithick]
%\tikzstyle{every state}=[fill=red,draw=none,text=white]

\node[state] (A)                    {$A$};
\node[state]         (C) [below right of=A] {$C$};
\node[state]         (B) [below left of=C] {$B$};
\node[state]         (D) [right of=C] {$D$};
\node[state]         (E) [above right of=D]       {$E$};
\node[state]         (F) [below right of=D]       {$F$};

\path (A) edge              node {a} (C)
edge              node {a} (E)
(B) edge              node {b} (C)
edge              node {b} (F)
(C) edge              node {a + b} (D)
(D) edge              node {a + b} (E)
edge              node {a + b} (F);
\end{tikzpicture}
%%% Local Variables:
%%% mode: latex
%%% TeX-master: t
%%% End:


A very simple butterfly network, and if I only compile with this Tikzpicture, there is no problem. However, if I add another Tizpicture, for instance a simple hub-by-hub network:

\begin{tikzpicture}[->,>=stealth',shorten >=1pt,auto,node distance=2cm,
semithick]
%\tikzstyle{every state}=[fill=red,draw=none,text=white]

\node[state] (A)                    {$E$};
\node[state]         (B) [right of=A] {$X$};
\node[state]         (C) [right of=B] {$X$};
\node[state]         (D) [right of=C] {$D$};

\path (A) edge              node {} (B)
(B) edge              node {} (C)
(C) edge              node {} (D);
\end{tikzpicture}


I start getting this error:

! Package pgfkeys Error: I do not know the key '/tikz/state' and I am going to
ignore it. Perhaps you misspelled it.


I simply cannot figure out what is wrong hope someone can help me

• this line \usetikzlibrary{arrows,automata} is probably loaded locally and the second one doesn't see automata Nov 22, 2017 at 22:03
• so it should be moved into the preamble then, right ? Nov 22, 2017 at 22:06

\usetikzlibrary{arrows,automata} is probably loaded locally in one of the picture files and the second one doesn't see automata library. Moving the library loading line to preamble should fix it.