# How to draw dotted line between two nodes

\begin{tikzpicture}
\tikzset{grow'=right,level distance=60 pt}
\Tree [.I \edge node[auto=left]{M};[.II \edge node[auto=left]{L};$3,3$ \edge node[auto=right]{R};[.$x,0$ ]]
\edge node[auto=left]{B};[.II \edge node[auto=left]{L};$0,0$ \edge node[auto=right]{R};[.$1,1$ ]]
\edge node[auto=right]{T};[.$2,2$ ] ]
\begin{scope}[dashed]
\draw (M)--(B);
\end{scope}
\end{tikzpicture}


I am trying to draw a dotted line between M and B, but don't know exactly how to identify the said nodes.

As shown above, I have used : \draw (M)--(B) - obviously texmaker does not recognise (M) and (B).

• \path[draw, dashed] (M) edge (B); ? – cacamailg Apr 11 '13 at 12:52
• \draw (M)--(B) returns an error because no such points are defined. "M" and "B" are only node labels; they do not refer to any points in your tikzpicture. Simply add (M) and (B) before {M} and {B} in your code, respectively. Then, \draw[dotted,thick] (M)--(B); should produce what you want. – jub0bs Apr 11 '13 at 12:54
• Welcome to TeX.sx! Please add a minimal working example (MWE) that illustrates your problem. It will be much easier for us to reproduce your situation and find out what the issue is when we see compilable code, starting with \documentclass{...} and ending with \end{document}. Do I got you right and your problem is not "how do draw a dotted line" but "how to identify/label two nodes"? – Dominikus K. Apr 11 '13 at 12:54

Note that you must give a name inside () to the nodes in order to reference them later.

\documentclass{article}
\usepackage{tikz-qtree}

\begin{document}
\begin{tikzpicture}
\tikzset{grow'=right,level distance=60pt}
\Tree [.I \edge node[auto=left](M){M};[.II \edge node[auto=left]{L};$3,3$ \edge node[auto=right]{R};[.$x,0$ ]]
\edge node[auto=left](B){B};[.II \edge node[auto=left]{L};$0,0$ \edge node[auto=right]{R};[.$1,1$ ]]
\edge node[auto=right]{T};[.$2,2$ ] ]
\path[draw, densely dotted] (M) edge (B);
\end{tikzpicture}
\end{document}