# TikZ: Labeling objects and referencing them

According to the TikZ manual I can use name= to assign a label to the drawings, but when I do the following:

\begin{tikzpicture}
\draw [ blue, thick, name=e1]  (10pt,10pt)  ellipse   (50pt and 30pt);
\node (red,above) at (e1.north) {E1};
\end{tikzpicture}


I get an error message that e1 is not defined. What am I doing wrong?

My second question is where can I find a concise syntactical representation of TikZ's commands?

-

You can only name nodes, not arbitrary parts of a drawing. In your example, if you wanted to be able to refer to the ellipse by name, you'd need to create it as a node instead of a plain ellipse. Try replacing your \draw command with this:

\node[draw=blue,ellipse,name=e1,minimum width=100pt,minimum height=60pt] at (10pt,10pt) {};


To address the second part of your question, I know of no better documentation of TikZ than the PGF manual itself. I've never heard of a short "cheat sheet" that briefly lists TikZ commands along with reminders of their syntax, if that's what you're looking for. Although it might be out there somewhere, at least for the most commonly used ones. You could probably create such a quick reference by extracting lines from the PGF documentation.

-

It is not a precise answer to your second question, but did you try the TeXample website? It contains a lot of examples (including source code) for doing all sorts of nice things with TikZ. In my experience, the TikZ manual can be a bit overwhelming at first glance. So if you are looking for doing something specific, you may be better off with adapting an example from this site.

-