3

I am trying this:

\documentclass[10pt]{article}

\usepackage{amsmath,amssymb,tikz-cd}

\begin{document}

\begin{equation*}
\begin{tikzcd}[row sep=huge]

A \arrow[r, "aaa"] \arrow[d, "xxxx"] &   B  \arrow[d, "yyyy"] \\ 

C                           & D  \arrow[l, "bbbbbbbbbbbbbbbbb"] \\

\end{tikzcd}

\end{equation*}

\end{document}

and I would like to fix 2 things:

1) The arrow over the "bbbbbbbbbbbbbbbbbbbb" label should be longer, so the pic does not look so cramped. 2) I would like the "xxxx" label to be on the left of the down arrow.

Thank you.

0

2 Answers 2

2

Like this?

\documentclass[10pt]{article}

\usepackage{amsmath,amssymb,tikz-cd}

\begin{document}

\begin{equation*}
\begin{tikzcd}[row sep=huge,column sep=width("bbbbbbbbbbbbbbbbb")]
A \arrow[r, "aaa"] \arrow[d, "\mathrm{xxxx}" swap] &   B  \arrow[d,
"\mathrm{yyyy}"] \\ 
C                           & D  \arrow[l, "bbbbbbbbbbbbbbbbb"] \\
\end{tikzcd}
\end{equation*}

\end{document}

enter image description here

4
  • The arrow length over the "bbbbbbb" is perfect, thank you. But I want the "xxx" label to be at the same height as the "yyyyy" label, but to the left of the A to C downarrow.
    – district9
    Jan 24, 2019 at 19:52
  • @district9 Yes, in the updated version it is there. (I misread your question first.)
    – user121799
    Jan 24, 2019 at 19:52
  • Almost there, I just need to make the label on the arrow in roman. I tried to replace the \arrow[d, "yyyy"] with \arrow[d, {\rm "yyyy"}], but it does not seem to compile. Thanks!
    – district9
    Jan 24, 2019 at 21:29
  • @district9 Sorry, was offline. You need to put the information inside the quotes (and \mathrm is more appropriate than \rm). I made xxxx and yyy upright. There also different options like \text or \mathup, it depends on what you really aim at.
    – user121799
    Jan 24, 2019 at 22:05
2

From the TikZ manual, Section 20.3.2 Setting and Adjusting Column and Row Spacing

The cell separation character & also takes an optional argument, which must also be a spacing list. This spacing list is added to the column sep having a similar effect as the option for the \\ command for rows.
This optional spacing list can only be given the first time a new column is started (usually in the first row), subsequent usages of this option in later rows have no effect.

In practice, if you put a [<width>] after &, for example &[7em], you can enlarge the space between the two columns separated by &[<width>] as you wish.

The option column sep=<width> sets a default spacing for all columns.

This difference could be relevant in case you have a matrix with more than two columns. If you want to enlarge only the space between the first and the second columns, but not between the second and the third, &[<width>] should be used, not column sep=<width>.

Option swap to change the position of the label.

\documentclass[10pt]{article}

\usepackage{amsmath,amssymb,tikz-cd}

\begin{document}

\begin{equation*}
\begin{tikzcd}[row sep=huge]
A \arrow[r, "aaa"] \arrow[d, "xxxx", swap] &[7em]   B  \arrow[d, "yyyy"] \\ 
C                           & D  \arrow[l, "bbbbbbbbbbbbbbbbb"] \\
\end{tikzcd}
\end{equation*}

\end{document}

enter image description here

You must log in to answer this question.

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