Decorate a TikZ path
November 5th, 2011 by Stefan Kottwitz
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);

This entry was posted on Samstag, November 5th, 2011 at 14:21 and is filed under TikZ. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.



