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 tried to use the tikz chains feature today, and all was good for a few hours, but now I get an error every time I try to use chains

./test.tex:7: Package pgfkeys Error: I do not know the key '/tikz/nonterminal' and I am going to ignore it. Perhaps you misspelled it. [    \node [nonterminal]]
./test.tex:8: Package pgfkeys Error: I do not know the key '/tikz/terminal' and I am going to ignore it. Perhaps you misspelled it. [    \node [terminal]]
./test.tex:9: Package pgfkeys Error: I do not know the key '/tikz/terminal' and I am going to ignore it. Perhaps you misspelled it. [    \node [terminal]]
./test.tex:10: Package pgfkeys Error: I do not know the key '/tikz/terminal' and I am going to ignore it. Perhaps you misspelled it. [    \node [terminal]]

And here is the code

\documentclass[a4paper]{memoir}
% Add packages
\usepackage{tikz}
\usetikzlibrary{chains}
\begin{document}
\begin{figure}
  \begin{tikzpicture}[start chain,node distance=5mm, every node/.style={on chain,join}, every join/.style={->}]
    \node [nonterminal]  {unsigned integer};
    \node [terminal]     {.};
    \node [terminal]     {digit};
    \node [terminal]     {E};
  \end{tikzpicture}
\end{figure}
\end{document}

Any good ideas on how to repair the chain?

share|improve this question
1  
Well, you don’t have a definition for the terminal nor the nonterminal style. The example (or another one) in the PGf manual, p. 61, defines them. –  Qrrbrbirlbel May 19 '13 at 14:58
add comment

1 Answer

As Qrrbrbirlbel (name chosen to be difficult to write? :p) said, you haven't defined your terminal and nonterminal style. The pgfkeys errors are hinting about this as they complain that tikz/nonterminaland tikz/terminalare unknown. Some times, TikZ recognise if you try to use keys from a tikzlibrary you should have loaded with usetikzlibrary, and will say so.

In the TIKZandPGF-manual the styles are set with tikzset, but are given in the tikzpicture options ([]) in the examples on page 60 and 61. You'll also need to load the shapes.misc library to be able to produce the rounded rectangle. The code is given below:

\documentclass[a4paper]{memoir}
\usepackage{tikz}
\usetikzlibrary{chains, shapes.misc}
\tikzset{
    nonterminal/.style={
      rectangle,
      minimum size=6mm,
      very thick,
      draw=red!50!black!50,
      top color=white,
      bottom color=red!50!black!20,
      font=\itshape},
    terminal/.style={
      rounded rectangle,
      minimum size=6mm,
      very thick,draw=black!50,
      top color=white,bottom color=black!20,
      font=\ttfamily}
    }
\begin{document}
\begin{figure}
  \begin{tikzpicture}[start chain,node distance=5mm, every node/.style={on chain,join}, every join/.style={->}]
    \node [nonterminal]  {unsigned integer};
    \node [terminal]     {.};
    \node [terminal]     {digit};
    \node [terminal]     {E};
  \end{tikzpicture}
\end{figure}
\end{document}

which produces the output

enter image description here

share|improve this answer
add comment

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.