Saturday, February 25, 2012

Defining functions for TikZ

The "easiest" way I've found to define "functions" in TikZ is to use the LaTeX \newcommand outside of the \tikzpicture environment.
\newcommand{\cir}[3]{ \def \x{ (#1,#2) circle (#3cm) } \draw \x ; }
And then use this inside the tikzpicture as:
\cir{0}{0}{1}
However, since the circle is drawn within the \newcommand, I can't rotate the figure inside the \tikzpicture environment.