Tikz Paths and Decorations

March 17th, 2012

The tikz drawing system can be used to draw basic solid black lines and simple shapes which can reasonably easily be adjusted to allow alternative patterns and decorations.


Fast Tube by Casper

The thickness of a line can be specified as part of a \draw command so when drawing a grid with thinner than standard lines we could add the very thin option to the tikz code:

\draw[step=.5cm,very thin,black!20] (0,0) grid (6,6);

The line pattern can also be specified as part of the draw options and the available patterns include solid lines, dashed lines and dotted lines:

\draw[solid,->] (0,0) -- (6,0);
\draw[dashed,<-] (0,1) -- (6,1);
\draw[dotted,<->] (0,2) -- (6,2);
\draw[solid,|<->|] (0,3) -- (6,3);

These settings can also be applied to decorations around nodes such as boxes. The command below draws a box with a blue outline filled with a background shade of red. The outline of the box around the node is thicker than usual (ultra thick) and the box itself is rectangular with rounded corners. The last option inner sep adds some padding inside the box around the text.

\node[draw=blue,fill=red!40,ultra thick,rectangle,rounded corners,
  inner sep=10pt] (b1) {Example};

Other useful resources are provided on the Supplementary Material page.

One response to “Tikz Paths and Decorations”

  1. Ezzy says:

    Nice presentation, however; it would be nice to post the LaTeX code that you had in the presentation here. Could you?
    Thanks.