6

I have a quite large description of an arrow, and row sep = huge does not make the arrow long enough. Is there a way to format this better?

\documentclass{article}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{tikz-cd}
\usepackage{fullpage}
\usepackage{amsthm}
\usepackage{adjustbox}
\usepackage{xcolor}
\begin{document}
\begin{tikzcd}[column sep = huge, row sep = huge]
E \arrow[r, "e"] & \Pi_{i \in ob(\mathcal{E})} F(i) \arrow[r, shift left, " 
{<\pi_{cod(u)} \ | \ u \in \hom(\mathcal{E})>}"] \arrow[r, shift right, "{<F(u) 
\pi_{dom(u)} \ | \ u \in \hom(\mathcal{E})}"'] & {\Pi_{u \in \hom(\mathcal{E}) 
F(cod(u))}} 
\end{tikzcd}
\end{document}
  • I've never seen huge as an argument for column sep before. If you look in the tikz-cd manual, you'll notice that you can give any arbitrary length (say 5cm) instead of huge, then manual states what huge is an alias for. – daleif Apr 2 at 9:44
  • That said I'd probably consider rewriting this diagram instead and it will not be particularly readable for the reader anyway. – daleif Apr 2 at 9:45
5

Here are two different ways

enter image description here

\documentclass{article}

\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{tikz-cd}

\DeclareMathOperator{\cod}{cod}
\DeclareMathOperator{\dom}{dom}
\DeclareMathOperator{\ob}{ob}

\begin{document}

Option 1: wide column separation specified by dimension
\begin{equation*}
  \begin{tikzcd}[column sep = 10em]
    E \arrow[r, "e"] & \displaystyle\prod_{i \in
    \ob(\mathcal{E})} \mkern-12mu F(i)
    \arrow[r, shift left, " {\langle\pi_{\cod(u)} \mid u \in
    \hom(\mathcal{E})\rangle}"] \arrow[r, shift right, "{\langle F(u)
    \pi_{\dom(u)} \mid u \in
    \hom(\mathcal{E})\rangle}"']
    & {\displaystyle\prod_{u \in \hom(\mathcal{E})} \mkern-12mu F(\cod(u))}
  \end{tikzcd}
\end{equation*}

Option 2: let arrows cover two (or more) columns
\begin{equation*}
  \begin{tikzcd}[column sep = huge]
    E \arrow[r, "e"]
    & \displaystyle\prod_{i \in \ob(\mathcal{E})} \mkern-12mu F(i)
    \arrow[rr, shift left, " {\langle\pi_{\cod(u)} \mid u \in
    \hom(\mathcal{E})\rangle}"]
    \arrow[rr, shift right, "{\langle F(u) \pi_{\dom(u)}
    \mid u \in \hom(\mathcal{E})\rangle}"']
    && {\displaystyle\prod_{u \in \hom(\mathcal{E})} \mkern-12mu F(\cod(u))}
  \end{tikzcd}
\end{equation*}

\end{document}

The first is simply to specify the column sep as a dimension. The second is to add an extra column under the long arrows, so you have

A \arrow[r] & B \arrow[rr] && C

instead of

A \arrow[r] & B \arrow[r] & C

You can make this wider by using more columns

A \arrow[r] & B \arrow[rrr] &&& C

etc.

Note I have recoded much of your mathematics.

The above solutions corresponding to working with a fixed grid, which is often a good idea for consistent spacing. An alternative is the extra space syntax of egreg's answer:

&[5em]

in the first row, will push the subsequent column 5em to the right and so making the corresponding arrows longer.

6

Add a width specification:

\documentclass{article}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{tikz-cd}

\DeclareMathOperator{\ob}{ob}
\DeclareMathOperator{\dom}{dom}
\DeclareMathOperator{\cod}{cod}

\begin{document}

\begin{tikzcd}
E \arrow[r, "e"] &
  \prod_{i \in \ob(\mathcal{E})} F(i)
  \arrow[
    r, shift left,
    "{\langle\pi_{\cod(u)} \mid u \in \hom(\mathcal{E})\rangle}"
  ]
  \arrow[
    r, shift right,
    "{\langle F(u)\pi_{\dom(u)} \mid u \in \hom(\mathcal{E})\rangle}"'
  ] &[8em]
  \prod_{u \in \hom(\mathcal{E})} F(\cod(u))
\end{tikzcd}

\end{document}

Note the adjustments I made:

  • <...> should be \langle...\rangle
  • \Pi should be \prod
  • \ | \ should be \mid
  • ob, dom and cod should be typeset upright

enter image description here

A possible alternative with \smashoperator that makes the diagram shorter:

\documentclass{article}
\usepackage{amsmath,mathtools}
\usepackage{amssymb}
\usepackage{tikz-cd}

\DeclareMathOperator{\ob}{ob}
\DeclareMathOperator{\dom}{dom}
\DeclareMathOperator{\cod}{cod}

\begin{document}

\begin{tikzcd}
E \arrow[r, "e"] &
  \smashoperator{\prod_{i \in \ob(\mathcal{E})}} F(i)
  \arrow[
    r, shift left,
    "{\langle\pi_{\cod(u)} \mid u \in \hom(\mathcal{E})\rangle}"
  ]
  \arrow[
    r, shift right,
    "{\langle F(u)\pi_{\dom(u)} \mid u \in \hom(\mathcal{E})\rangle}"'
  ] &[10em]
  \smashoperator{\prod_{u \in \hom(\mathcal{E})}} F(\cod(u))
\end{tikzcd}

\end{document}

enter image description here

  • 2
    Eventually, someone who knows the &[<lenght>] option, you beat me by a second, lol! – CarLaTeX Apr 2 at 10:31
  • +1 Of course, loading amsmath is not needed once you load mathtools. – Andrew Swann Apr 2 at 10:41
4

Add an empty column between columns 2 and 3. I also added some improvements to the diagram.

\documentclass{article}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{tikz-cd}
\usepackage{fullpage}
\usepackage{amsthm}
\usepackage{adjustbox}

\begin{document}

\begin{tikzcd}[column sep= huge, row sep=huge]
E \arrow[r, "e"] & \Pi_{i \in ob(\mathcal{E})} F(i) \arrow[rr, shift left=1ex, "
{\langle\pi_{cod(u)} \, | \, u \in \hom(\mathcal{E})\rangle}"] \arrow[rr, shift right=1ex, "{\langle F(u)
\pi_{dom(u)} \, | \, u \in \hom(\mathcal{E})\rangle}"'] & & {\Pi_{u \in \hom(\mathcal{E})
F(cod(u))}}
\end{tikzcd}

\end{document} 

enter image description here

3

I remade everything in normal TikZ and correct (many) typos. Also, take note that I use \langle and \rangle instead of < and >. A curve is always more readable than a straight line in this case in my opinion.

\documentclass{standalone}
\usepackage{amsmath}
\usepackage{tikz}
\usetikzlibrary{positioning}
\DeclareMathOperator{\ob}{ob}
\DeclareMathOperator{\cod}{cod}
\DeclareMathOperator{\dom}{dom}
\begin{document}
\begin{tikzpicture}[>=stealth]
\node (mid) {$\prod_{i \in \ob(\mathcal{E})} F(i)$};
\node[left=1cm of mid] (left) {$E$};
\node[right=4cm of mid] (right) {$\prod_{u \in \hom(\mathcal{E})}F(\cod(u))$};
\draw[->] (left)--(mid) node[midway,above] {$\scriptstyle e$};
\draw[->] ([yshift=.2em]mid.east) to[bend left=5] node[midway,above] {$\scriptstyle\langle\pi_{\cod(u)} \ | \ u \in \hom(\mathcal{E})\rangle$} ([yshift=.2em]right.west);
\draw[->] ([yshift=-.2em]mid.east) to[bend right=5] node[midway,below] {$\scriptstyle\langle F(u)\pi_{\dom(u)} \ | \ u \in \hom(\mathcal{E})\rangle$} ([yshift=-.2em]right.west);
\end{tikzpicture}
\end{document}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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