# What's the difference between \path and \draw in Tikz?

The question is in the title: What is the difference between the commands \path and \draw in Tikz? The PGF and TikZ manual by Till Tantau tells me (on page 26 of the current version) that “\draw is just a shorthand for \path[draw]”.

In some of the answers I got to previous questions on how to draw certain figures using Tikz, some users have used a mixture of \path and\draw in their code, while others only seemed to use \draw.

The very helpful slides Marc van Dongen has on his website explaining the basic features of Tikz also contain a mixture of both, whilst mostly relying on the \draw command.

To remedy this confusion, I have as of now switched to using exclusivley \draw, but I find it very confusing.

What is the difference between the two commands? Should I be using both? When is it better to use \path instead of \draw and vice versa? When is it all the same? Are there things \path can do that \draw cannot?

Sometimes we only need a virtual path, or a totally transparent path just to compute some coordinates, intersections, and so on.

To do an invisible path we use \path and if you want to put some ink on it you use \draw.

Example: Here is an example where I used some paths to compute the intersections.

\documentclass{report}
\usepackage{amsthm,amsmath,amssymb}
\usepackage{tikz}
\usetikzlibrary{intersections}

\begin{document}
\begin{tikzpicture}[scale=2]\footnotesize
\clip (-1.2,-.3) rectangle (4,1.75);
\begin{scope}[rotate=70]
\coordinate (q) at (0,0);
%
\draw[dashed] (q) circle (1);
\draw[dotted](0,-.8)--(0,.8)node[left=1.5em]{$\mathcal{K}$};
%
\path[name path=ray1] (q)-- (35:3cm);
\path[name path=ray2] (q)-- (0:3cm);
\path[name path=ray3] (q)-- (-40:3cm);
\path[name path=ray4] (q)-- (-60:3.5cm);
\path[name path=ray5] (q)-- (-70:4cm);
\draw[name path=circulo] (q)+(.4,0) circle (.4);
\draw[name path=vertical] (1.25,-4)node[above left=10pt]{$L$} -- (1.25,2);
%
\draw[name intersections={of=ray1 and vertical,by={b}}]  (q)--(b);
\draw[name intersections={of=ray2 and vertical,by={a}}]  (q)--(a);
\draw[dotted,name intersections={of=ray3 and vertical,by={v3}}]  (q)--(v3);
\draw[dotted,name intersections={of=ray4 and vertical,by={v4}}]  (q)--(v4);
\draw[dotted,name intersections={of=ray5 and vertical,by={v5}}]  (q)--(v5);
%
\path[name intersections={of=ray1 and circulo,by={btilde}}] ;
\path[name intersections={of=ray2 and circulo,by={atilde}}] ;
\path[name intersections={of=ray3 and circulo,by={c31,c32}}] ;
\path[name intersections={of=ray4 and circulo,by={c41,c42}}] ;
\path[name intersections={of=ray5 and circulo,by={c51,c52}}] ;
%
\draw (atilde)--(btilde);
\draw[rotate=35] (btilde) rectangle +(-.07,-.07);
\draw[rotate=0] (a) rectangle +(-.07,.07);
\foreach \p in {q,btilde,atilde,c32,c42,c52,b,a,v3,v4,v5}{
\draw[fill=white] (\p) circle (.7pt); }
%
\node[left=2pt] at (btilde){$\tilde b$};
\node[right=2pt] at (atilde){$\tilde a$};
\node[above=2pt] at (a){$a$};
\node[above=2pt] at (b){$b$};
\node[below=2pt] at (q){$q$};
\end{scope}
\end{tikzpicture}
\end{document}


• Could you please provide an example of this? What to do with an invisible path? – Olivier Bégassat Nov 26 '13 at 23:50
• @OlivierBégassat You can place coordinate/nodes on a path, or to be precise: along a sub-path (with the pos key and its family). As a matter of fact: \node expands to \path node (although, in most case \draw node will work, too). If you only want to fill a path, you use \fill (expands to \path[fill]). Here you you want a draw neither. Another thing: If you use edges, you should use \path instead of \draw because strange things will happen; the edge operator creates separate paths anyway, and we use \path only for the parser. – Qrrbrbirlbel Nov 27 '13 at 0:05
• @OlivierBégassat, I'd edited. – Sigur Nov 27 '13 at 0:17
• Beautiful answer! An invisible path is also useful for clipping, I use it a lot for that. :) – OSjerick Nov 27 '13 at 1:36
• Thanks, this code is quite illuminating. I don't understand the c31,c23 stuff though, what is going on there? – Olivier Bégassat Nov 27 '13 at 1:50