I am beginning to learn tikz to draw a simple graph. I would like to represent the idea that there are N
nodes by drawing something like this:
How can I draw an ellipsis: ...
between the two nodes?
Here is the code I used for the above:
\documentclass[12pt,a4paper]{report}
\usepackage{tikz}
\usetikzlibrary{arrows}
\begin{document}
\begin{tikzpicture}[->,>=stealth',shorten >=1pt,auto,node distance=2.5cm,
main node/.style={thick,circle,draw,font=\sffamily\Large}]
\node[main node] (1) {$X_1$};
\node[main node] (2) [right of=1]{$X_N$};
\node[main node] (5) [below of=1]{C};
\path[every node/.style={font=\sffamily\small}]
(1) edge (5);
\end{tikzpicture}
\end{document}
(Other comments on how to improve my tikz code are welcome.)
Best Answer
Another way would be to say
\path (1) -- node[auto=false]{\ldots} (2);
. You've turned on theauto
setting in thetikzpicture
options,auto=false
turns it off.Also, it is recommended to load the
positioning
library and useright=of
instead of saying justright of=
. See Difference between "right of=" and "right=of" in PGF/TikZ.Finally, I don't really think the
[every node...
option to your last path does anything.