1

How do I type this commutative diagram in tikz-cd in overleaf?

enter image description here

I have tried this

\documentclass{amsart}
\usepackage{latexsym,amsmath}
\usepackage{mathtools}
\usepackage{scalerel,stackengine}
\usepackage{tikz-cd}
\begin{document}

\maketitle [ \begin{tikzcd} G \arrow[r,""]\arrow[d,swap,"\Delta"]\arrow[rd,swap,"\id_G"] & 1 \times G \arrow[r,"e \times id_G"] & G \times G \arrow[d,"m"] \ G \times 1 \arrow[d,"id_G \times e"] \ G \times G \arrow[r,"m"] & G \end{tikzcd} ] \end{document}

which is not working.

Ri-Li
  • 113
  • 5

1 Answers1

3

The trick is to consider this as a 3-by-3 matrix. So the diagonal arrow should be rrdd, because it has to jump over two columns and two rows.

Similarly, in the last row you need &&, because the center column has no entry.

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

\newcommand{\id}{\mathrm{id}} \newcommand{\one}{\mathbf{1}}

\begin{document}

[ \begin{tikzcd}[column sep=3em] %% first row G \arrow[r] \arrow[d,swap,"\Delta"] \arrow[rrdd,"\id_G"] & \one \times G \arrow[r,"e \times \id_G"] & G \times G \arrow[dd,"m"] \ %% second row G \times \one \arrow[d,swap,"\id_G \times e"] \ %% third row G \times G \arrow[rr,"m"] && G \end{tikzcd} ]

\end{document}

I increased a tad the column separation, so as to avoid the label in the top row overfilling the arrow.

I'm not sure I'd label that arrow by “Delta” that suggests “diagonal”, but you've the final word on this.

enter image description here

egreg
  • 1,121,712
  • I have a general question what does the 'swap' mean when we are drawing the down arrow? – Ri-Li Dec 07 '21 at 18:26
  • I got it the map will be on the other side of the arrow. Many many thanks :) – Ri-Li Dec 07 '21 at 18:30
  • @Ri-Li You can also type "<label>"' (with an apostrophe after the closing double quote). By default, labels are printed on the left side: imagine to be standing on the source of the arrow and to look towards the target. – egreg Dec 07 '21 at 18:47