I'm building a tree graph and started from creating vertices
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{calc}
\usepackage[active,tightpage]{preview}
\PreviewEnvironment{tikzpicture}
\setlength\PreviewBorder{10pt}
\definecolor{lavander}{cmyk}{0,0.48,0,0}
\definecolor{violet}{cmyk}{0.79,0.88,0,0}
\definecolor{burntorange}{cmyk}{0,0.52,1,0}
\def\lav{lavander!90}
\def\oran{orange!30}
\tikzstyle{vertices}=[draw,circle,violet,bottom color=\lav,
top color= white, text=violet,minimum width=10pt]
\tikzstyle{namedvertices}=[draw,circle,burntorange, left color=\oran,
text=violet,minimum width=12pt]
\begin{document}
\begin{tikzpicture}[auto, thick]
\pgfmathsetmacro{\xoffset}{1}
\pgfmathsetmacro{\yoffset}{1.5}
% Place named vertices
\foreach \vertex/\name in
{
{(0,0)/t},
{(0 * \xoffset, 2 * \yoffset)/v},
{(1 * \xoffset, -3 * \yoffset)/a},
{(-4 * \xoffset, -4 * \yoffset)/u},
{(0 * \xoffset, -4 * \yoffset)/b}
}
\node[namedvertices] (\name) at \vertex {};
\end{tikzpicture}
\end{document}
Unfortunately, compiling this i'm getting
Package tikz Error: Cannot parse this coordinate.
in the line of last vertex. And the result looks like
If i remove just the last vertex, i.e. stay with 4 instead of 5, everything compiles fine.
What am I doing wrong? Or what should i change in order to handle more than 4 nodes?
Update: I've solved the problem by doing
{(0 * \xoffset, -4 * \yoffset)/b}%
So maybe now,
I want to understand why it solved something? Initially no hidden symbols were written after the closing } in the first place.
foreach
tha first\vertex
is set to{(0,0)/t}
and your\name
is empty. You should delete{}
or keep them like this{(0,0)}/t
.\foreach
, add%
just after the last}
: [...]* \yoffset)/b}%
%
after the last one to remove the white spaces (new line). But in any case you do not need all this{}
.