# xypic: 2-Cell Triangle Identities

I would like to typeset, using xypic, the triangle identities from the definition of adjoint functors in category theory. My problem is with creating the double arrow connecting the hypotenuse and the opposite corner.

Here's the (completely trivial) part I can do myself, which is everything but the double arrows: \xymatrix{ C\ar[r]^{F}\ar[dr]_{1_{C}} & D\ar[d]^{G} & & D\ar[dr]^{1_{D}}\ar[d]_{G}\\ & C & & C\ar[r]_{F} & D }

There is supposedly a way of creating such "pasting diagrams" in xypic, but I haven't found any clear instructions anywhere; I know the command \compositemap is somehow involved but I could not figure out how to use it.

• Please help us to help you and add a minimal working example (MWE) that illustrates your problem. It will be much easier for us to reproduce your situation and find out what the issue is when we see compilable code, starting with \documentclass{...} and ending with \end{document}. Dec 10 '14 at 12:00
• Dec 10 '14 at 14:49
• @Thruston, I have no minimal working example. I have no idea how to make the diagrams I want Dec 10 '14 at 22:11
• @Sigur I had seen those sources before you posted, but they did not help me at all. Dec 10 '14 at 22:12

I do not use xy anymore, as it is not that easy and powerful as . 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}


• Thanks for your tikz solution, but I would also much like an xy solution as it is a lot easier to use in LyX. Dec 12 '14 at 11:57
• @Exterior You can just copy my code in to your TeX-File. Even in LyX. As you have not even provided one single letter of code, it is not very likely to get help for this (quite hard in xy, if you are interested). This is not a "we-code-for-free"-page. Sorry, but I down-voted your question until it gets some improvement by you. Dec 12 '14 at 12:01
• I understand. I can of course put up the code for the triangles, but that's really pretty trivial in xypic and the problem is entirely with the 2-arrows. At any rate, I'll add the code for the triangles. Dec 12 '14 at 12:04
• @Exterior See my update Dec 12 '14 at 12:34

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:

• +1. Still though, I would like to see the "right" answer using \compositemap. Dec 14 '14 at 9:38

I just looked at the same thing and tried to use the 2cell feature in xy-pic. After reading the reference manual, I think the "right" solution is the following

\documentclass[border=10pt]{standalone}
\usepackage[all,2cell]{xy}
\UseAllTwocells

\begin{document}
$\xymatrix{C\drtwocell\omit{^<-2>\eta}\ar_{1_C}[dr]\ar^F[r]&D\ar^G[d]& D\drtwocell\omit{^<2>\varepsilon}\ar^{1_D}[dr]\ar_G[d]&\\ &C&C\ar_F[r]&D}$
\end{document}


The code reads as \drtwocell\omit{^<-2>\eta}, where \omit says we will omit the two curved arrows, the ^ specifies the direction of the 2-cell, and <-2> nudges the label (otherwise it will be at the center point).

Output:

There is a problem: you cannot specify which side the label is on with respect to the 2-cell. It seems that this is not implemented, so perhaps this is the best we can do without some other hacks.