In the 2cell package for xy, there is a command for typesetting 2cells between composite arrows, namely \..compositearrow (where the .. stands for some number of u,l,d,r).

I would like to use this command to duplicate the defining diagram for the Kan extension:

Kan extension diagram

Except that I want to the double arrow $\eta$ two be pointing from node $B$ toward the middle of arrow $X$ (it is, after all, a natural transformation from $RF$ to $X$). The \..compositearrow command seems tailor-made for this purpose, except I can't figure out how to label the intermediate source/target object in the composite arrow.

Using the markup

A\drcompositemap<4>_{a}^{b}{c}\drlowertwocell{\omit} &\\
& C\\

I get:

bad diagram

How do I label the object that is the target of arrow $a$ and the source of arrow $b$?

See also my question at Change the orientation of Arrow of xtwocell in the 2cell option for xy for another attempted method at this diagram

  • So adding a B between the & and the `\` in the first line doesn’t work? – Qrrbrbirlbel Aug 22 '13 at 9:58
  • That adds $B$ to the [0,1] matrix position. It's not where the arrows are pointing to/from. If I change the curvature of the compositemap, I can get the arrows closer toward pointing to $B$, but it's never quite right. Also there is not enough space between the two arrows for a $B$, let alone a longer expression. – ziggurism Aug 22 '13 at 20:22

Again, I would use tikz-cd here.

The short style helps us to draw a straight line only in a segment of the full path. (This isn’t that easy for curved line!)

If the nodes are not aligned in a matrix-like manner, one can use a normal TikZ picture if needed (see second example).


\newcommand*{\tikzcdset}{\pgfqkeys{/tikz/commutative diagrams}}
  to node/.style={%
    /tikz/execute at begin to=\edef\tikztotarget{#1}}}
  short shift >/.initial=+.6em,
  short shift </.initial=+.6em,
  short center/.initial=.55,
    to path={
          \path (\tikztostart) coordinate (@aux1) -- (\tikztotarget) coordinate (@aux2);
        \edef\pgfpathlength{\pgfmathresult pt}%
            {(\pgfkeysvalueof{/tikz/commutative diagrams/short center})*\pgfpathlength-\pgfkeysvalueof{/tikz/commutative diagrams/short shift <}}
            {(\pgfkeysvalueof{/tikz/commutative diagrams/short center})*\pgfpathlength+\pgfkeysvalueof{/tikz/commutative diagrams/short shift >}}
        (@@aux1) -- (@@aux2) \tikztonodes}}
\tikzset{% from CVS version
  edge node/.code={\expandafter\def\expandafter\tikz@tonodes\expandafter{\tikz@tonodes #1}},
  edge label/.style={/tikz/edge node={node[auto]{#1}}},
  edge label'/.style={/tikz/edge node={node[auto,swap]{#1}}},
  mlabel/.style={/tikz/edge node={node[auto]{$#1$}}},
  mlabel'/.style={/tikz/edge node={node[auto,swap]{$#1$}}}
A \rar{a}
  \drar[out=-90, in=180][coordinate,name=ac]{}
  & B \dar{b}
      \dar[short, Rightarrow, to node=ac]{c} \\ % doesn't matter what \*ar is used
  & C
\begin{tikzpicture}[tikzcd=every diagram, node distance=.5cm and 1cm]
\node                          (B) {$B$};
\node at ([shift=(170:1.5)] B) (A) {$A$};
\node at ([shift=(-80:1.5)] B) (C) {$C$};

\path[tikzcd={every arrow, every label}] (A) edge[mlabel=a] (B)
                                             edge[out=-90, in=180] coordinate (ac) (C)
                                         (B) edge[mlabel=b] (C)
                                             edge[tikzcd={short, Rightarrow}, mlabel=c] (ac);


enter image description here

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.