I want to draw an arrow, who shall represent line numbers like in the following screenshot.

line numbers

I struggeled with xymatrix, but this doesn't seem to be the right approach. Any ideas?

  • This kind of drawing would be relatively easy to draw in tikz.
    – gerrit
    Nov 1, 2012 at 22:33

1 Answer 1


As mentioned in the comments, this is pretty straight forward using tikz; here's something to get you started



  % draw the arrow
  % draw the tick marks
  \foreach \x/\nodename/\mytext in {1/a/$2(N-1)\omega$,5/b/$2N\omega$,7/c/$2\omega_0$,9/d/$2(N+1)\omega$}
  \draw[shift={(\x,0)},color=black] (0pt,2pt) -- (0pt,-2pt) node[anchor=north](\nodename){\mytext};
  % draw the braces
  \draw[decorate,decoration={brace,amplitude=10}]($(a.north)+(0,.25)$)--($(b.north)+(0,.25)$)node[anchor=south,pos=.5,outer sep=.5cm]{$|2\omega|$};
  \draw[decorate,decoration={brace,amplitude=10}]($(b.north)+(0,.25)$)--($(c.north)+(0,.25)$)node[anchor=south,pos=.5,outer sep=.5cm]{$|2\omega_0-2N\omega|$};


I hope that most of the code is pretty self-explanatory; one of the pieces that isn't immediately obvious (to someone who hasn't seen a lot of tikz code) is the line

\foreach \x/\nodename/\mytext in {1/a/$2(N-1)\omega$,5/b/$2N\omega$,7/c/$2\omega_0$,9/d/$2(N+1)\omega$}

The way that I read this is to think that \x, \nodename, and \mytext are all loop variables, and they will take the values specified in the following curly braces (separated by the delimeter /).


  • \x will take the values 1,5,7,9
  • \nodename will take the values a,b,c,d
  • \mytext will take the values $2(N-1)\omega$,...,$2(N+1)\omega$

I've used

  • \usetikzlibrary{decorations.pathreplacing} for the braces; the amplitude key controls the amplitude of the brace
  • \usetikzlibrary{calc} to tweak the vertical positioning of the braces, for example ($(a.north)+(0,.25)$) means to use the node named a north's position PLUS (0,.25)

The tikz package provides a huge number of tools, so there are probably multiple ways to do this- my code is just one such way :)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .