15

I can't get this document to compile:

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{snakes,arrows,shapes}
\begin{document}
\begin{tikzpicture}[>=latex',line join=bevel,]

  \definecolor{strokecol}{rgb}{0.0,0.0,0.0};
  \pgfsetstrokecolor{strokecol}
  \draw (140.1bp,19bp) node {310e} edge [loop below]  ();
  \definecolor{strokecol}{rgb}{0.0,0.0,0.0};
  \pgfsetstrokecolor{strokecol}
  \draw (28bp,55.424bp) node {311r} edge [loop left]  ();

%

%%circles around nodes
%31-, 310e and 311r
%fail here
\draw (311r) -- (310e);
\end{tikzpicture}
\end{document}
%

It fails when I add that last draw command, saying Package pgf Error: No shape named 311r is known., and another with "310e" instead of "311r". I just need to be able to draw lines with nodes as the anchors. Can anyone tell me what I am doing wrong?

3
  • 1
    Try ... node (310e) {} ... instead. Note the round brackets and braces.
    – Werner
    Commented Jan 3, 2012 at 6:35
  • 1
    yes you forgot to name the nodes Commented Jan 3, 2012 at 6:52
  • 2
    @Altermundus: Please write up an answer for this, since I lack the tikz skill to do it properly.
    – Werner
    Commented Jan 3, 2012 at 7:53

1 Answer 1

12

As said in comments you have to name the nodes, this means all you need to is

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{snakes,arrows,shapes}
\begin{document}
    \begin{tikzpicture}[>=latex',line join=bevel,]

    \definecolor{strokecol}{rgb}{0.0,0.0,0.0};
    \pgfsetstrokecolor{strokecol}
    \draw (140.1bp,19bp) node(310e) {310e} edge [loop below]  ();
    \definecolor{strokecol}{rgb}{0.0,0.0,0.0};
    \pgfsetstrokecolor{strokecol}
    \draw (28bp,55.424bp) node(311r) {311r} edge [loop left]  ();

    %%circles around nodes
    %31-, 310e and 311r
    %fail here
    \draw (311r) -- (310e);
    \end{tikzpicture}
\end{document}

Anyway, your code looks interesting, because of the unnecessary pgfsetstrokecolor, definecolor and the exact positions. Are you sure you need them? Maybe \usetikzlibrary{positioning} will help you (16.5.3 Advanced Placement Options in the tikz/pgf manual).

3
  • The code was generated by dot2tex[fauskes.net/code/dot2tex/], and I had a hard time following it myself. Thanks for your help!
    – Nate Glenn
    Commented Jan 3, 2012 at 19:40
  • You will get much better results (code and output) if you take a look at the tikz/pgf manual. The manual is really good.
    – someonr
    Commented Jan 3, 2012 at 19:46
  • 3
    It looks quite good, but it's 700 pages... Do you know of a condensed one?
    – Nate Glenn
    Commented Jan 4, 2012 at 17:16

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .