# Change the orientation of Arrow of xtwocell in the 2cell option for xy

I'm trying to make a diagram similar to this (from wikipedia)

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

I'm trying to use the \xtwocell command of the 2cell package for xy. In subsection 3 (Excursions) of section 25.4 (extra options) of chapter 25 (two-cell) on page 47 of the xyrefer manual, it is stated

\xtwocell[⟨hop⟩]{⟨displace⟩}... connects to the ⟨pos⟩ displaced by ⟨displace⟩ from the relative cell location specified by ⟨hop⟩. The displacement can be any string of valid XY-pic commands, but they must be enclosed within a group {...}. When the cell location is the target, a null grouping {} must be given. When used with the <\omit> nudge, such excursions allow a labelled Arrow to be placed anywhere within an XY-pic diagram; furthermore the Arrow can be oriented to point in any direction.

Of course the manual gives no examples and makes no further comment about how to change the orientation of the Arrow (in this manual, capitalized "Arrow" refers to the double arrow between arrows, i.e. the 2-cell).

What does he mean by "any string of valid XY-pic commands"? What may the displacement argument for \xtwocell be? Any experiments I tried (eg <1>,dr,[0,1]) typing in the curly braces just ended up in the $A$ node text, so not being interpreted as a displacement or position or orientation. How do I change the orientation of the Arrow? How do I achieve the "orientation in any direction" that was promised me?

Here is my simple markup

\xymatrix{
A\ar[d]\ar[r]\xtwocell[0,1]{}\omit{<2>} & B\\
C\ar@{.>}[ur] &
}


which gives the following image

I want to change the direction that double arrow is pointing, point it to the corner object $C$, or reverse it. I can shift it by changing the number in \omit{<2>}, but how to change the orientation?

(Google showed me that the same question is asked here on the xy mailing list, but never answered)

See also my question at Label the source/target object in the middle of compositemaps from 2cell package of xy? for another attempted method at this diagram.

-

If you would consider using tikz-cd, this can easily be achieved with

• a named node (name=X) and
• the to node styles (see below).

The argument of \arrow that usually denotes the direction/target node will be ignored.

For a shorter arrow I’d use the short style from my answer to your other question Label the source/target object in the middle of compositemaps from 2cell package of xy?

You can use the keys short shift >, short shift < and short center to adjust the arrow.

## Code A

\documentclass[tikz,convert=false]{standalone}
\usepackage{tikz-cd}
\pgfkeys{
/tikz/commutative diagrams/to node/.style={%
/tikz/execute at begin to=\edef\tikztotarget{#1}},
/tikz/commutative diagrams/to node*/.style={
/tikz/commutative diagrams/to node={#1},
/tikz/shorten >=\pgfkeysvalueof{/tikz/commutative diagrams/to node shorten >}},
/tikz/commutative diagrams/to node shorten >/.initial=+.5ex}
\begin{document}
\begin{tikzcd}[column sep=large]
A \rar[][name=X]{X}
\dar[swap]{F}
& B \\
C \urar[dashed][swap]{R}
\arrow[Rightarrow, to node*=X]{}{\eta}
\end{tikzcd}
\end{document}


## Code B

\documentclass[tikz,convert]{standalone}
\usetikzlibrary{decorations.pathreplacing}
\usepackage{tikz-cd}
\newcommand*{\tikzcdset}{\pgfqkeys{/tikz/commutative diagrams}}
\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=.5,
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}}
}
\makeatother
\begin{document}
\begin{tikzcd}[column sep=large]
A \rar[][name=X]{X}
\dar[swap]{F}
& B \\
C \urar[dashed][swap]{R}
\arrow[Rightarrow, to node=X, short]{}{\eta}
\end{tikzcd}
\end{document}


## Output B

-
Yes, I would consider using this package. Is it possible to make the double arrow shorter? Seeing a 2cell span the diagram like that is a little jarring. –  Joe Hannon Aug 22 '13 at 5:48
@JoeHannon Could you elaborate on that? You can shorten the arrow at both ends with the keys shorten > and shorten < as shown in the example. There are also ways to shorten the line by a certain percentage of the path length in various different ways. It is also possible to place a normalsized \Rightarrow between C and X similar to the small arrow in your linked question. Feel free to edit your question with a mock-up of the image you want to achieve. –  Qrrbrbirlbel Aug 22 '13 at 6:32
In your diagram, it seems like the doublearrow spans from the lower-left corner to your invisible node. But typically we want 2cells to be shorter, hovering somewhere in the center of our commutative diagram. Sorry I can't be more specific, but I can say that the 2-cells displayed by the 2cell package are the right size (not surprising since 2cell was invented by a cat theorist for his book). If I can get a 2-cell of the size given by 2cell, but with the direction given by your tikz-cd example, then I will be happy. I did not understand your instructions about the shorten > keys, though. –  Joe Hannon Aug 22 '13 at 6:59
@JoeHannon I am not familiar with commutative diagrams or their vocabulary. Do you want something like this? –  Qrrbrbirlbel Aug 22 '13 at 8:46
Yes, that arrow does look shorter, and does not span the diagram. –  Joe Hannon Aug 22 '13 at 19:54