TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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 uses \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



\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={
segment length=4,
post length=2pt}, decorate] (m-1-1) edge node[auto] {F} (m-1-2);


where the decorate part does not work.

share|improve this question
In your example you should also load the TikZ matrix library. – Stefan Kottwitz Nov 5 '11 at 13:01
You're right, i forgot to mention it here ! – redfiloux Nov 5 '11 at 14:07
up vote 12 down vote accepted

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);

enter image description here

share|improve this answer
That's clever, the decoration key is set for the entire scope, so you don't have to repeat those for the edge even though it creates a new path. You also don't need the draw here because the every edge style is equal to draw by default. Nice solution! – Roelof Spijker Nov 5 '11 at 14:01
That's great, it works thank you so much. – redfiloux Nov 5 '11 at 14:09

You need to add the matrix library, otherwise the example doesn't compile. Furthermore, add a draw to your path, otherwise there is no line. Finally, replace edge with -- and you should get what you are after.

Update: Perhaps I should add why the edge does not work and the -- does. According to the TikZ manual the edge operation adds a new path after the main path has been drawn. This new path will have as options every edge and the options given to the edge operation. Most important, it won't have the same options as the path of which the edge was a part. So if you insist on using edge instead of -- you need to add the decoration information either as an option to edge on your path or to the every edge style.

share|improve this answer
Cool, thanks for the answer, i'm gonna take a look to understand what happens here. I actually am not really familiar with tikz, i only uses it for diagram-making purposes, so \path it's about everything i know :(. I'll take a look it'll probably help me understand it a bit more... :) – redfiloux Nov 5 '11 at 14:11

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.