I'd like to know if somebody know a way to define a path in TikZ and reuse the path's definition several times. For example, consider the following:
code example with duplicate paths http://csweb.ucc.ie/~dongen/TeX-SX/11--12/path.png
If I wanted to change the path (0,2) -- (0,2) -- (5,3) -- (5,2)
I'd have to make two changes to the code. How can I avoid this?
\def
it?\def\mypath{ (0,0) -- (5,5)}
and then using it\tikz \draw {\mypath};
. Not so elegant though.def
s local to atikzpicture
. Interestingly, and this is one of the reasons why I never thought of using a\def
, TikZ'sname path
only seems to work for intersections but not for drawing....spath
then you might get some idea of the sort of thing I do with my code. If it looks interesting, tell me and I'll try to see if it could do what you want.