For some reason the tikzcd documentation that comes with TeXLive says nothing about the following:

  1. How do I specify whether or not a label is below/above an arrow?

  2. How do I specify the size of diagrams (e.g. if I need a longer arrow to fit a large label)?

  3. How can I specify multiple labels (e.g. both above and below) an arrow?

  • Section 1.1 Inserting arrows gives examples of different label placements and multiple labels. Section 2 Controlling the appearance of diagrams tells you how to adjust column and row spacing, so allowing more room for large labels. Jun 24, 2013 at 9:10
  • Welcome to TeX.SX! You can have a look on our starter guide to familiarize yourself further with our format.
    – mafp
    Jun 24, 2013 at 9:19
  • @AndrewSwann: It says that you can specify things with options, but it doesn't say anywhere what these options are. The only thing that seems to do (2) is e.g. [column sep=...]. Jun 24, 2013 at 9:20
  • OK, it does look like what I was looking for is there, but it's hidden as section 2.3. It would be much better though if there was even one example in the first section where they mention labels that actually specifies label positions. That way glancing over the document you immediately see this and it's usually one of the first things you need when drawing diagrams... Jun 24, 2013 at 9:24

1 Answer 1


The package documentation contains examples of most of this. Section 1.1 gives examples for placing of labels, Section 2 provides ways to adjust the appearence of the diagram and control spacing. However, the package documentation is easiest to understand in conjunction with the manual for tikz and its underlying language pgf: see http://www.ctan.org/pkg/pgf in particular section 16.8 Placing Nodes on a Line or Curve Explicitly.

By default labels on arrows are to the left of the direction of travel. This my be changed by prefixing the label with [swap], so you can write \arrow{r}{a}[swap]{b} to get an arrow to the right with label a above and b below.

Labels above/below

[Code at end.]

Diagrams are set on a grid, so you can't make more space for a single arrow. However, you can open up the grid horizontally and vertically (if necessary with different factors).

Long labels

Basic tikz options such as for placing labels along the arrow are [pos=0.7] for 0.7 of the way along the length and [near start]/[near end] for near to the beginning or the end.

Labels may be turned with [rotate=90], or some other angle. Doing this you will often need to shift the label with the options xshift or yshift, as in the example above, where one could write

\arrow{d}[anchor=center,rotate=-90,yshift=1ex]{\text{arrow name}}

However, as Qrrbrbrilbel points out it is easier to use sloped together with above or below as in the code below (swap no longer has an effect).



    x \arrow{r}{a} \arrow{d}[swap]{b} &y \arrow{d}{d} \\
    z \arrow{r}{e}[swap]{c} &w \\

  \begin{tikzcd}[column sep=6em,row sep=6em]
    x \arrow{r}{\text{arrow name}}
    \arrow{d} &y \arrow{d}[sloped,above]{\text{arrow
    name}} \\
    z \arrow{r} &w \\


If you need a non-grid layout then as in section 3.3 of the manual, you need to resort to basic tikz to place elements.

  • If you define, say Sloped/.style={sloped, anchor=south} you won’t need shifting and manual rotation (arrows can be any angle). Though, shifting shouldn’t be needed if you use the proper anchor anyway. Dec 11, 2013 at 21:08
  • @Qrrbrbirlbel The sloped is useful and I'll update my answer. Note that like my original code it plays badly with swap. Instead of swap one ends up using sloped,anchor=north on that particular arrow. Dec 12, 2013 at 10:04
  • Yes, swap only swaps the side of auto (left to right and vice versa). In fact, for sloped only the anchors north and south make sense really. So it may be a good idea to also introduce the key Sloped'/.style={sloped, anchor=north} Dec 12, 2013 at 13:58

You must log in to answer this question.

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