1

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

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

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

David Carlisle
  • 757,742
ziggurism
  • 373
  • So adding a B between the & and the \\ in the first line doesn’t work? – Qrrbrbirlbel Aug 22 '13 at 09: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

1 Answers1

1

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).

Code

\documentclass[tikz,convert=false]{standalone}
\usepackage{tikz-cd}
\usetikzlibrary{positioning}
\newcommand*{\tikzcdset}{\pgfqkeys{/tikz/commutative diagrams}}
\tikzset{tikzcd/.code=\tikzcdset{#1}}
\tikzcdset{
  to node/.style={%
    /tikz/execute at begin to=\edef\tikztotarget{#1}}}
\makeatletter
\tikzcdset{
  short shift >/.initial=+.6em,
  short shift </.initial=+.6em,
  short center/.initial=.55,
  short/.style={
    to path={
      \pgfextra
        \pgfinterruptpath
          \path (\tikztostart) coordinate (@aux1) -- (\tikztotarget) coordinate (@aux2);
        \endpgfinterruptpath
        \pgfpointdiff{\pgfpointanchor{@aux1}{center}}{\pgfpointanchor{@aux2}{center}}%
        \pgfmathveclen@{\pgfmath@tonumber{\pgf@x}}{\pgfmath@tonumber{\pgf@y}}%
        \edef\pgfpathlength{\pgfmathresult pt}%
        \pgfcoordinate
          {@@aux1}
          {\pgfpointlineatdistance
            {(\pgfkeysvalueof{/tikz/commutative diagrams/short center})*\pgfpathlength-\pgfkeysvalueof{/tikz/commutative diagrams/short shift <}}
            {\pgfpointanchor{@aux1}{center}}
            {\pgfpointanchor{@aux2}{center}}}%
        \pgfcoordinate
          {@@aux2}
          {\pgfpointlineatdistance
            {(\pgfkeysvalueof{/tikz/commutative diagrams/short center})*\pgfpathlength+\pgfkeysvalueof{/tikz/commutative diagrams/short shift >}}
            {\pgfpointanchor{@aux1}{center}}
            {\pgfpointanchor{@aux2}{center}}}%
      \endpgfextra
        (@@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$}}}
}
\makeatother
\begin{document}
\begin{tikzcd}
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
\end{tikzcd}
\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);
\end{tikzpicture}
\end{document}

Output

enter image description here

enter image description here

Qrrbrbirlbel
  • 119,821