7

How can I change the style of a two-cell? Take the following minimal example:

\documentclass{article}
\usepackage[all,cmtip,2cell]{xy}
\UseTwocells

\begin{document}

$\xymatrix@C+1pc{C \rtwocell<4>  & D}$

\end{document}

There will be a downward double arrow in the middle of the diagram. How can I change its style? Say, to be a zigzag arrow. What I mean is, if it was a normal arrow in xypic, I would change its style like this: \ar@{~}[d].

1
  • Would you be willing to use another package such as the more modern and versatile tikz-cd? Commented May 13, 2014 at 1:06

2 Answers 2

6
+50

The arrow is changed via \arrowobject. By default this is \dir{=>} where => is defined in xy2cell.tex as

\newdir{=>}{!/5pt/\dir{=}!/2.5pt/\dir{=}*!/-5pt/\dir2{>}}

You can make a squiggly arrow with something like

\newdir{~>}{!/2.5pt/\dir{~}*!/-5pt/\dir2{>}}

and use this as

$\arrowobject{\dir{~>}}\xymatrix@C+1pc{C \rtwocell<4>  & D}$

Sample output

\documentclass{article}
\usepackage[all,cmtip,2cell]{xy}
\UseTwocells

\newdir{~>}{!/2.5pt/\dir{~}*!/-5pt/\dir2{>}}

\begin{document}

$\arrowobject{\dir{~>}}\xymatrix@C+1pc{C \rtwocell<4>  & D}$

\end{document}

Further details are in the reference manual xyrefer.pdf obtainable as texdoc xyrefer

For a connection without an arrowhead you can use one of

Second sample

$\arrowobject{\dir{~}}\xymatrix@C+1pc{C \rtwocell<4>  & D}$

\newdir{l~}{!/3.5pt/\dir{~}*!/-3.5pt/\dir{~}}
$\arrowobject{\dir{l~}}\xymatrix@C+1pc{C \rtwocell<4>  & D}$

The \newdir is a composite object built up of units separated by *. A unit !/3.5t/\dir{~} takes the tip ~ and slides it 3.5pt (back) along the path.

2
  • How can I get it not to have a tip? Like it would result if I used \ar@{~} in an xymatrix environment. Thanks. Commented May 12, 2014 at 19:13
  • @BrunoStonek I have updated my answer with this. Commented May 13, 2014 at 6:33
3

I know the question asks specifically about 2cell, but this is how you'd do it using the more modern tikz-cd package; the squiggly line was produced using a snake decoration from the decorations.pathmorphing library:

\documentclass{article}
\usepackage{tikz-cd}
\usetikzlibrary{decorations.pathmorphing}

\tikzset{no tip/.style={arrows=-}}

\begin{document}

\begin{tikzcd}
C \ar[r, bend left=50, ""{name=U, below}]
\ar[r, bend right=50, ""{name=D}]
& D
\ar[decorate, decoration={snake},from=U, to=D,no tip]
\end{tikzcd}

\end{document}

enter image description here

2
  • Nice, thank you for your answer. However, I'd prefer to stick to xypic , being used to the syntax and all... Commented May 13, 2014 at 12:08
  • @BrunoStonek Of course, I understand. Commented May 13, 2014 at 12:32

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .