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

  • Would you be willing to use another package such as the more modern and versatile tikz-cd? – Gonzalo Medina May 13 '14 at 1:06
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.

  • How can I get it not to have a tip? Like it would result if I used \ar@{~} in an xymatrix environment. Thanks. – Bruno Stonek May 12 '14 at 19:13
  • @BrunoStonek I have updated my answer with this. – Andrew Swann May 13 '14 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

  • Nice, thank you for your answer. However, I'd prefer to stick to xypic , being used to the syntax and all... – Bruno Stonek May 13 '14 at 12:08
  • @BrunoStonek Of course, I understand. – Gonzalo Medina May 13 '14 at 12:32

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.