xypic: 2-Cell Triangle Identities
I do not use xy
anymore, as it is not that easy and powerful as tikz-cd. I hope, this solution will help you as well:
% arara: pdflatex
\documentclass{article}
\usepackage{tikz-cd}
\begin{document}
\[\begin{tikzcd}[row sep=3em]
C \arrow{r}{F} \arrow[""{name=foo}]{dr}[swap]{1_C} & D \arrow{d}{G} \arrow[Rightarrow, from=foo, swap, near start, "\eta"]& D \arrow{d}[swap]{G} \arrow[""{name=bar, below}]{dr}{1_D} & \\
& C & C \arrow{r}[swap]{F} \arrow[Rightarrow, to=bar, swap, near start, "\varepsilon"] & D
\end{tikzcd}\]
\end{document}
As you wished, here is a solution with xy
. It is quite hacky. Using the examples mentioned by Sigur would be better, I guess. But as xy
is able to manage empty matrix entries, I used this in order to point arrows to where I want. The double amount of matrix nodes is necessary though.
% arara: pdflatex
\documentclass{article}
\usepackage[%
,all
%,cmtip % recommended, but I do not know how to get it to work for the double arrow
]{xy}
\begin{document}
\[\xymatrix@R=4mm @C=4mm{
C\ar[rr]^{F} \ar[ddrr]_{1_{C}} & & D \ar[dd]^{G} & & D \ar[ddrr]^{1_{D}} \ar[dd]_{G} & & \\
&\ar@2{->}[ur]_{\eta} & & & & & \\
& & C & & C \ar@2{->}[ur]_{\varepsilon} \ar[rr]_{F} & & D
}\]
\end{document}
Another xy-pic
solution with a different approach:
\documentclass{article}
\usepackage[all]{xy}
\begin{document}
\[
\xymatrix{
C\ar[r]^{F}\ar[dr]_{1_{C}} & D\ar[d]^{G}\ar@{<=}[dl]+<22pt>^>>>{\eta} & & D\ar[dr]^{1_{D}}\ar[d]_{G} & \\
& C & & C\ar[r]_{F}\ar@{=>}[ur]-<22pt>_>>>{\varepsilon} & D
}
\]
\end{document}
Output: