# Globular 3-cells and higher diagrams in xy-pic

Is there a nice/standardized way to format globular 3-cells in xy-pic the same way we can with 2-cells?

For 2-cells the command \rtwocell generates the required arrows, and a modification that allows one to type \rncell for natural numbers n would be incredible for writing category theory papers and nLab pages.

I found a page describing how to define globular 3-cells back in 2004, but xy-pic appears to have changed syntax significantly since then (or at least I am too green behind the ears to read the code there and translate it to something that works in my version of xy-pic). Can someone more knowledgable in LaTeX renovate these codes to work with modern xy-pic syntax?

Any strategy that generalizes to higher cells with arrows between arrows between arrows between... would be beautiful, but a solution for 3-cells is still greatly appreciated. Also please note that tikz solutions will be somewhat incomprehensible to me due to a lack of familiarity with the syntax, however, if there is no xy-pic solution (and no kind samaritan willing to create one) and tikz has an elegant solution on hand I can learn some new syntax and use a tikz diagram.

The following code

\xymatrix@R5mm@C10mm{ & \ar@{=>}@/^.7pc/[dd]^\Theta \ar@{=>}@/_.7pc/[dd]_{\;\;\;\Theta'} \\ A \ar@/^2.0pc/[rr]^F \ar@/_2.1pc/[rr]_G & {\substack{\mathscr{M} \\ \rightsquigarrow}} & B \\ & }


generates the diagram below

and it's relatively straightforward (but time-consuming) to generalize further, but this is pretty hacked together and very time consuming for larger diagrams so a more elegant solution would still be greatly appreciated.

With tikz-cd it is not difficult.

The & are used to separate the cells (and \\ to separate the rows, if you have more rows).

\arrow[rr, bend left=40, "F", ""{name=U}] means "draw an arrow, bent to the left of 40 degrees, with the label "F" and call the middle point "U"."

\arrow[Rightarrow, "\Theta", shorten <=2pt, shorten >=2pt, bend left=40, from=U, to=D] means "draw a Rightarrow, labelling it with \Theta, shortening a bit (2pt) the tip and the tail of the arrow, bending to the left from the point called "U" to the point called "D"."

I don't know anything about Globular diagrams, I've just written an example of how to use tikz-cd.

Edit: for peculiar cases, a pure TikZ solution may be convenient.

I've added one with a TikZ matrix. If you use it without loading tikz-cd, you have to load \usetikzlibrary{matrix}.

You can refer to the matrix cells with matrixname-rownumber-columnnumber.

\node[above=16pt of mymatr, inner sep=12pt] (UP) {}; means "position the node UP 16pt above of mymatr, since the node has an empty text, I've given it an height with inner sep=12pt."

\draw[double distance=2pt, -{Implies}] (UP.south) -- (DOWN.north); means "draw an arrow, with Implies arrow tip, and with 2pt distance between the two rows of the arrows, between the south point of node UP and the north point of point DOWN."

\draw ([xshift=-10pt]UP.south) edge[bend right=60, double distance=2pt, -{Implies}] ([xshift=-10pt]DOWN.north); means "draw an Implies arrow, bent right of 60 degrees, from a point shifted horizontally -10pt from UP.south to a point shifted horizontally -10pt from DOWN.north."

\documentclass{article}
\usepackage{amsmath,amsfonts, amssymb}
\usepackage{tikz-cd}
\usetikzlibrary{positioning, arrows.meta}

\begin{document}
$\begin{tikzcd} A \arrow[rr, bend left=40, "F", ""{name=U}] \arrow[rr, bend right=40, "G", swap, ""{name=D}] & M & B \arrow[rr, bend left=40, "A", ""{name=A}] \arrow[rr, bend right=40, "B", swap, ""{name=B}] & \Rrightarrow & \bullet \arrow[Rightarrow, "\Theta", shorten <=2pt, shorten >=2pt, bend left=40, from=U, to=D] \arrow[Rightarrow, "\Theta'", shorten <=2pt, shorten >=2pt, bend right=40, swap, from=U, to=D] \arrow[Rightarrow, "\Phi", shorten <=2pt, shorten >=2pt, bend left=40, from=A, to=B] \arrow[Rightarrow, "\Phi'", shorten <=2pt, shorten >=2pt, bend right=40, swap, from=A, to=B] \end{tikzcd}$
$\begin{tikzpicture} \matrix[matrix of math nodes, nodes in empty cells] (mymatr) { \bullet &[20pt] \Rrightarrow &[10pt] \Rrightarrow &[20pt] \bullet\\ }; \node[above=16pt of mymatr, inner sep=12pt] (UP) {}; \node[below=16pt of mymatr, inner sep=12pt] (DOWN) {}; \draw[->, rounded corners=40pt] (mymatr-1-1) -- (UP.north) -- (mymatr-1-4); \draw[->, rounded corners=40pt] (mymatr-1-1) -- (DOWN.south) -- (mymatr-1-4); \draw[double distance=2pt, -{Implies}] (UP.south) -- (DOWN.north); \draw ([xshift=10pt]UP.south) edge[bend left=60, double distance=2pt, -{Implies}] ([xshift=10pt]DOWN.north); \draw ([xshift=-10pt]UP.south) edge[bend right=60, double distance=2pt, -{Implies}] ([xshift=-10pt]DOWN.north); \end{tikzpicture}$
\end{document}


• I adding my upvote because this nice answer not can be = 0. Mar 6, 2019 at 20:59
• Upvoted as well and much appreciated, the explanation of syntax is particularly nice — if no xypic solutions come by in the near future I’ll accept and adapt. Mar 6, 2019 at 23:46
• @AlecRhea Thank you, I answered because nobody else did. I added a pure TikZ solution, I think it could be convenient for peculiar cases. Mar 7, 2019 at 7:08
• Accepted and thank you for the additional solution, for more complicated diagrams it will likely come in handy. Mar 10, 2019 at 19:56
• @AlecRhea You're welcome! Thank you for accepting my answer. Mar 10, 2019 at 20:02