# Commutative diagrams package

I want to put one of those great category theoretic diagrams into one of my papers. What sort of packages can I use without breaking my TeX work so far.

• Welcome to TeX.SX! Check tikz-cd; we have several questions and answers dealing with it. Can you point to a typical diagram you need? – egreg Sep 8 '14 at 16:35
• co-commutative, and co-unital are the words I would like to capture. I am also interested in putting together some Hochschild cohomology inspired diagrams . Essentially I need to be able to put together some squares with arrows that I can label. – user62119 Sep 8 '14 at 16:51
• I noticed you mentioned you have some latex notes in Italian. If you have one on such diagrams just direct me. No translations needed :) – user62119 Sep 8 '14 at 16:56
• Sorry, no notes about diagrams. – egreg Sep 8 '14 at 16:58

I recommend tikz-cd. Let's see some examples (the last one is from page 3 of these notes

\documentclass{amsart}
\usepackage{tikz-cd}

\DeclareMathOperator{\Hom}{Hom}

\begin{document}
\section{Commutative $k$-algebra}
$\begin{tikzcd} A\otimes A \arrow[rr,"\iota"] \arrow[dr,swap,"\mu"] && A\otimes A \arrow[dl,"\mu"] \\ & A \end{tikzcd}$

\section{Cocommutative $k$-coalgebra}
$\begin{tikzcd} & C \arrow[dl,swap,"\Delta"] \arrow[dr,"\Delta"] \\ C\otimes C \arrow[rr,"\iota"] && C\otimes C \end{tikzcd}$

\section{Associative $k$-algebra}
$\begin{tikzcd} A\otimes A\otimes A \arrow[r,"\mu\otimes 1"] \arrow[d,swap,"1\otimes\mu"] & A \otimes A \arrow[d,"\mu"] \\ A \otimes A \arrow[r,"\mu"] & A \end{tikzcd}$
\section{Coassociative $k$-coalgebra}
$\begin{tikzcd} C \arrow[r,"\Delta"] \arrow[d,swap,"\Delta"] & C \otimes C \arrow[d,"1\otimes\Delta"] \\ C\otimes C \arrow[r,"\Delta\otimes 1"] & C\otimes C\otimes C \end{tikzcd}$

\section{Hochschild cohomology complex}
$\begin{tikzcd} 0 \arrow[r] & M \arrow[r,"\partial_0-\partial_1"] & \Hom_k(R,M) \arrow[r,"d"] & \Hom_k(R\otimes R,M) \arrow[r,"d"] & \dotsb \end{tikzcd}$
\end{document}


Note that triangular diagrams are realized by adding an intermediate column.

• Always good to have notes :) – user62119 Sep 8 '14 at 20:41

And now for the pstricks way: here is the code for the counity diagram:

\documentclass[pdf]{article}
\usepackage[utf8]{inputenc}
\usepackage{mathtools}
\usepackage{pst-node}
\DeclareMathOperator\id{id}

\begin{document}

$\psset{arrows = ->, nodesep = 3pt, labelsep = 3pt}%, \begin{psmatrix}[colsep = 1.6] C & C \otimes C \\ C \otimes C & K \otimes C \cong C \cong C \otimes K % \ncline{1,1}{1,2}\naput{\Delta} \ncline{2,1}{2,2}\nbput{\varepsilon \otimes \id} \ncline{1,1}{2,1}\nbput{\Delta} \ncline{1,2}{2,2}\naput{\id \otimes \varepsilon} \ncline{1,1}{2,2}\nbput{\id} \end{psmatrix}$

\end{document}


• nice too . . .. – user62119 Sep 9 '14 at 0:07
• It's a different way of doing it: here you describe first the objects, then the arrows. Btw it compiles with pdflatex (with the switch --shell-escape, or --enable-write18 for MiKTeX). – Bernard Sep 9 '14 at 0:14

The syntax of xy makes the codes short but hard to read. Nevertheless xy is powerful so I put it here.

\documentclass{amsart}
\usepackage{tikz-cd}\usetikzlibrary{decorations.pathmorphing}
\usepackage[all,pdf]{xy}\SelectTips {cm}{}

\DeclareMathOperator{\Hom}{Hom}
\DeclareMathOperator\id{id}

\begin{document}
\section{Commutative $k$-algebra}
$\xymatrix{ A\otimes A \ar^\iota[rr]\ar_\mu[dr] && A\otimes A \ar[dl]^\mu \\ & A }$

\section{Cocommutative $k$-coalgebra}
$\xymatrix{ & C \ar_\Delta[dl]\ar^\Delta[dr] \\ C\otimes C \ar^\iota[rr] && C\otimes C }$

\section{Associative $k$-algebra}
$\xymatrix{ A\otimes A\otimes A \ar^-{\mu\otimes1}[r]\ar_{1\otimes\mu}[d] & A\otimes A \ar^\mu[d] \\ A\otimes A \ar^-\mu[r] & A }$

\section{Coassociative $k$-coalgebra}
$\xymatrix{ C \ar^\Delta[r]\ar_\Delta[d] & C\otimes C \ar^{1\otimes\Delta}[d] \\ C\otimes C \ar^{\Delta\otimes1}[r] & C\otimes C\otimes C }$

\section{Hochschild cohomology complex}
$\xymatrix{ 0\ar[r] & M \ar^-{\partial_0-\partial_1}[r] & \Hom_k(R,M) \ar^-d[r] & \Hom_k(R\otimes R,M)\ar^-d[r] & \cdots }$

$\xymatrix{ C \ar^\Delta[r]\ar_\Delta[d]\ar_\id[dr] & C\otimes C \ar^{\id\otimes\varepsilon}[d] \\ C\otimes C \ar_-{\varepsilon\otimes\id}[r] & K\otimes C\cong C\cong C\otimes K }$
$\begin{tikzcd}[column sep=3cm] A\ar[hook,squiggly,two heads,"\phi" description]{r} & B \end{tikzcd}$
$\xymatrix@C3cm{ A\ar@{^(~>>}|\phi[r] & B }$