Decorate a TikZ path

Redfiloux asked on TeX.SX:

 
How to decorate a \path?
 

My question is about drawing a “commutative-type diagram” in mathematics. I would like to integrate an arrow of the type \rightsquigarrow, which is described how to be obtained here: Squiggly arrows in TikZ.

The problem is that I use \path to connect the entries of my matrix in TikZ (because this part comes integrated in a bigger diagram), and I get an error:

“Package PGF Error: I cannot decorate an empty path.”

The code is

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{decorations.pathmorphing}
\usepackage{amssymb}
\begin{document}
\begin{tikzpicture}
\matrix (m) [matrix of math nodes, row sep=3em,
  column sep=4em, text height=2ex, text depth=0.25ex]
{ U & U \\};
\path [->, font=\scriptsize, line join=round,
  decoration={zigzag,segment length=4,
  amplitude=.9,post=lineto,post length=2pt},
  decorate] (m-1-1) edge node[auto] {F} (m-1-2);
\end{tikzpicture}
\end{document}

where the decorate part does not work.

Answer:

You could specify the decoration to the path, and give the edge the decorate option:

\path [->, decoration={zigzag,segment length=4,amplitude=.9,
  post=lineto,post length=2pt},font=\scriptsize,
  line join=round] (m-1-1) edge[decorate]
  node[auto] {F} (m-1-2);
path with decoration
Stefan Kottwitz

05. November 2011 by stefan
Categories: Uncategorized | Leave a comment

Leave a Reply

Required fields are marked *