# Kan extension in beamer.

I'm trying to include the diagram of a Kan extension in a beamer presentation (see the nLab page for an example). I've achieved to draw it through \xymatrix without the natural transformations symbol (the \Rightarrow), but I would like to put the symbol into the diagram. Does anybody know how to draw it?

Thanks.

-
Sorry, I don't understand the but I would like to put them part. Also, drawing this shouldn't be beamer specific. I personally would just use TikZ for it. – Martin Scharrer May 24 '11 at 23:09
@Martin: I believe he means that he succeeded to draw the diagram without the ⇒, and now wants to know how to place a ⇒ into the middle. – Caramdir May 24 '11 at 23:40
+1 for referring to the nLab page! – Loop Space May 25 '11 at 21:37

If you click on the source link at the bottom of the nLab page, you will see that the diagram is produced with

\xymatrix{
\mathbf{A} \ar[ddr]_F \ar[rr]^{P}  &             & \mathbf{B} \ar[ddl]^{F'}  \\
& \Rightarrow & \\
& \mathbf{M}  &
}


Personally, I prefer using TikZ. Here is an example:

\begin{tikzpicture}[>=latex]
\node (A) at (150:1.5) {$\mathbf{A}$};
\node (B) at (30:1.5)  {$\mathbf{B}$};
\node (M) at (270:1.5) {$\mathbf{M}$};

\path[->]
(A) edge node[auto] {$P$} (B)
(A) edge node[auto,swap] {$F$} (M)
(B) edge node[auto] {$F'$} (M);

\node at (0,-0.2) {$\Rightarrow$};
\end{tikzpicture}


Both can just be put into a beamer frame (maybe inside a  for centering and vertical spacing), provided that the corresponding packages are loaded.

-
Ack. That means it's a codecogs diagram. One of my missions in life is to remove all codecogs from the nLab and replace them with beautiful SVGs. – Loop Space May 25 '11 at 21:39

When using the \xymatrix command from Xy-pic, you can (1) Attach a name to a label on an arrow, and then use that label as a source or target of another arrow, and (2) add a displacement vector to either the source or target of an arrow. We use both of those ideas in the following code:

\documentclass[12pt]{article}
\usepackage[all,cmtip]{xy}
\begin{document}
\thispagestyle{empty}
\begin{displaymath}
\xymatrix@R=8ex{
{A} \ar[rr]^-{P} \ar[dr]_{F}="left"
&& {B} \ar[dl]^{F'}="right"\\
& {M}
\ar@{=>}"left"+<1.5em,0em>;"right"+<-1.5em,0em>
}
\end{displaymath}

\end{document}


which produces:

In that code, we give the name "left" to the F and the name "right" to the F'. The last line of the \xymatrix then draws an arrow of the form \ar{=>} from a point 1.5em to the right of the F to the point 1.5em to the left of the F'.

Edit: You might actually want that to change that last line of the \xymatrix to

\ar@{=>}"left"+<1.5em,1em>;"right"+<-1.5em,1em>^{\eta}


That would both raise the double shafted arrow a bit and label it with \eta (It's not labelled in the diagram you reference, but that arrow is meant to be the natural transformation \eta.)

-

Why don't you simply use the diagrams package found here: http://www.paultaylor.eu/diagrams/

It's very versatile, and making simple commutative diagrams like the one shown is really easy. Just look through the examples in the tutorial PDF.

Milne also has a overview of different diagrams packages somewhere...

-
Before using that package, you should make sure they've read the author's licensing terms. For example, the license forbids use "for any military purpose under any circumstances." Additionally, under certain circumstances, if you use this package to write a book, the author requires you send him a free copy. – Chris Phan May 25 '11 at 1:29
... and ”if you are doing something where mistakes cost money” then you are not allowed to use the package. Strictly interpreting this, you are not allowed to use it for anything? – Caramdir May 25 '11 at 3:45
Also you are not allowed to read the code of the package. – Caramdir May 25 '11 at 3:50
All of those terms do not apply to you if you're making a beamer presentation. Unless it's for a military or nonacademic purpose, although I don't see the military being very interested in category theory. – MarkovCh1 May 25 '11 at 6:54