6

I am using tikzcd to make a fairly complex diagram and would like to have the labels on arrows closer to the arrows they are associated with in order to remove ambiguity. Here is what I have currently:

\documentclass{article}
\usepackage{tikz-cd}
\begin{document}
\[
\begin{tikzcd}[ampersand replacement = \&, column sep = tiny]
\&  z_1 \ar[r, phantom, description, "\in"]
\&  C   \ar[dd, dashed, "\psi"]
\&  z_2 \ar[l, phantom, description, "\ni"] \\
x_1 \ar[ur, mapsto] \ar[dr, mapsto] \ar[r, phantom, description, "\in"]
\&  G_1 \ar[ur, near start, "\eta_1"]   \ar[dr, near start, "\psi_1"']
\&
\&  G_2 \ar[ul, near start, "\eta_2"']  \ar[dl, near start, "\psi_2"]
\&  x_2 \ar[l, phantom, description, "\ni"] \ar[ul, mapsto] \ar[dl, mapsto] \\
\&  y_1 \ar[r, phantom, description, "\in"]
\&  H
\&  y_2 \ar[l, phantom, description, "\ni"]
\end{tikzcd}
\]
\end{document}

Which produces

Commutative Diagram result

If I change all the labelled arrows to have the near start option, I get

Commutative Diagram with near start result

Both of these seem to be pretty ambiguous, as it isn't really clear which labels the maps are associated with. I've tried using inner sep both as a global option and as an option for the arrows, but it doesn't seem to do anything. So my question is:

How do I make the labels closer to the arrows they correspond to?

1 Answer 1

11

You can give a negative outer sep to the labels. In the code below I've added a style to save some typing.

\documentclass{article}
\usepackage{tikz-cd}
\tikzset{close/.style={near start,outer sep=-2pt}}
\begin{document}
\[
\begin{tikzcd}[ampersand replacement = \&, column sep = tiny]
\&  z_1 \ar[r, phantom, description, "\in"]
\&  C   \ar[dd, dashed, "\psi"]
\&  z_2 \ar[l, phantom, description, "\ni"] \\
x_1 \ar[ur, mapsto] \ar[dr, mapsto] \ar[r, phantom, description, "\in"]
\&  G_1 \ar[ur, close, "\eta_1"]   \ar[dr,close, "\psi_1"']
\&
\&  G_2 \ar[ul, close, "\eta_2"']  \ar[dl,close, "\psi_2"]
\&  x_2 \ar[l, phantom, description, "\ni"] \ar[ul, mapsto] \ar[dl, mapsto] \\
\&  y_1 \ar[r, phantom, description, "\in"]
\&  H
\&  y_2 \ar[l, phantom, description, "\ni"]
\end{tikzcd}
\]
\end{document}

output of code

0

You must log in to answer this question.

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