Commutative Diagrams in Latex

I know some people were asking about drawing commutative diagrams in LaTeX.  I wrote code for the following diagrams last night, and I thought I’d pass it along to anyone who’s interested.  Paste

\usepackage{tikz}
\usetikzlibrary{arrows,backgrounds}
\usepackage[all]{xy}

into your preamble, and the following code should compile.  I don’t think you need tikz for this code, but there’s no reason not to include it, so I have it in my standard preamble.

Coassociativity:

\[
\xymatrix{
H_4\ar[d]_\Delta\ar[r]^\Delta&H_4\ox H_4\ar[d]^{\Delta\ox I}\\
H_4\ox H_4\ar[r]^{I\ox \Delta}&H_4\ox H_4\ox H_4
}
\]

 

Counit:
\[
\xymatrix{
&H_4\ox H_4\ar[dr]^{I\ox \epsilon}\ar[dl]_{\epsilon\ox I}&\\
\F\ox H_4\ar[dr]_\cong&&H_4\ox\F\ar[dl]^\cong\\
&H_4\ar[uu]^\Delta&
}
\]

 

m and \Delta:
\[
\xymatrix{
H_4\ox H_4\ar[r]^m\ar[d]_{\Delta\ox\Delta}&H_4\ar[r]^\Delta&H_4\ox H_4\\
H_4\ox H_4\ox H_4\ox H_4\ar[rr]^{I\ox T\ox I}&&H_4\ox H_4\ox H_4\ox H_4\ar[u]_{m\ox m}
}
\]

 

u and \Delta:
\[
\xymatrix{
H_4\ox H_4&&H_4\ar[ll]_\Delta\\
&\F\ox\F\cong\F\ar[ul]^{u\ox u}\ar[ur]_u&
}
\]

 

m and \epsilon:
\[
\xymatrix{
H_4\ox H_4\ar[rr]^m\ar[dr]_{\epsilon\ox\epsilon}&&H_4\ar[dl]^\epsilon\\
&\F\ox\F\cong\F&
}
\]

 

u and \epsilon:
\[
\xymatrix{
\F\ar[dr]_u\ar[rr]^I&&\F\\
&H_4\ar[ur]_\epsilon
}
\]

Advertisements

4 comments

  1. excellent! thank you zach!

  2. Yes, \usepackage[all]{xy} is all that’s needed for these things to work. I try to use as few usepackages as possible so that the compilation goes faster. (I like your \newcommand{\ox}{\otimes} idea!)

    J. S. Milne has some nice cheat sheets for all standard commutative-diagrams packages: http://www.jmilne.org/not/CDGuide.html . Check out the “xymatrix (Rose)” one; it’s what Zach (and I) is using.

  3. Brian Cruz

    I don’t know if this is blasphemy, but I’ve been using a WYSIWYG (what you see is what you get) latex writer called Lyx. I like it because you still write everything as \rho, etc. if you want, but it is also WYSIWYG.
    It has auto-complete for Latex commands, which I love, and also, when you type \xymatrix it sets up a matrix that you can easy add columns and rows to and within each spot you can put things like “C\ar[dr]^\epsilon”.

    The main problem about Lyx is that if you don’t know latex well already and how it works, then using Lyx properly might be hard (you have to know what latex commands are happening in the background)

  4. Brian Cruz

    I just thought I’d make that confession here 🙂

    Thanks by the way Zach!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: