3

enter image description here

Attached is the code I'm using for drawing commutator diagrams. I want to increase the length of the arrows. How can I do that.

$$
\begin{xy}\xymatrix{
 E
  \ar[r]^*{e} 
&
 X
  \ar[r]<4pt>^*{s}
  \ar[r]<-4pt>_*{t} 
&
 Y \\
 Z
  \ar[u]<4pt>^*{\gamma_1}
  \ar[u]<-4pt>_*{\gamma_2}
  \ar[ur]_*{e \circ \gamma_1 = e \circ \gamma_2}
}\end{xy}
$$
  • Can you please post a minimal working example that compiles, is as small as possible and demonstrates your problem. – Andrew Dec 9 '16 at 9:07
  • @Andrew, I've attached the output as well. I just needed the arrows to be lengthy as you can see it's dense. – Yeah Dec 9 '16 at 9:12
  • 1
    Having the output is nice but the point of a MWE is that people can copy it, paste it into their favourite editor and start trying to fix your problem. When you only post code fragments people have to guess the packages you are using and generally stuff around quite a bit before they can even get your code to compile. This makes it harder for people to help you - and less likely that they will. – Andrew Dec 9 '16 at 10:14
5

It's quite easy:

\documentclass{article}
\usepackage{amsmath}
\usepackage[all,cmtip]{xy}

\begin{document}

\[
\xymatrix@R+1pc@C+1pc{
  E \ar[r]^*{e} & X  \ar[r]<4pt>^*{s} \ar[r]<-4pt>_*{t} & Y \\
  Z \ar[u]<4pt>^*{\gamma_1} \ar[u]<-4pt>_*{\gamma_2}
    \ar[ur]_*{e \circ \gamma_1 = e \circ \gamma_2}
}
\]

\end{document}

With @R+1pc I tell Xy-pic to increase by 1pc (12pt) the interrow space; similarly, @C+1pc increases the intercolumn space. You'd get the same result with

\xymatrix@+1pc{

which would apply the setting to both the interrow and intercolumn spaces. Specifying them separately allows for finer control.

enter image description here

Note you should use \[...\] and not $$, see Why is \[ ... \] preferable to $$ ... $$? You also need no xy environment.

The same with tikz-cd:

\documentclass{article}
\usepackage{amsmath}
\usepackage{tikz-cd}

\begin{document}

\[
\begin{tikzcd}[column sep=3em,row sep=3em]
  E \arrow[r,"e"] & X \arrow[r,shift left=.7ex,"s"] \arrow[r,shift right=.7ex,swap,"t"] & Y
  \\
  Z \arrow[u,shift left=.7ex,"\gamma_1"] \arrow[u,shift right=.7ex,swap,"\gamma_2"]
    \arrow[ur,swap,"e \circ \gamma_1 = e \circ \gamma_2"]
\end{tikzcd}
\]

\end{document}

enter image description here

2

The arrows can only be made longer by putting the objects at a larger distance from each other.

You could make the matrix bigger, by specifying for example \xymatrix@=2cm{. You can also specify row and column separation differently.

Or put dummy entries in it to make some arrows bigger:

\begin{xy}\xymatrix@=1cm{
 E
  \ar[rr]^*{e} 
&&
 X
  \ar[r]<4pt>^*{s}
  \ar[r]<-4pt>_*{t} 
&
 Y \\
 Z
  \ar[u]<4pt>^*{\gamma_1}
  \ar[u]<-4pt>_*{\gamma_2}
  \ar[urr]_*{e \circ \gamma_1 = e \circ \gamma_2}
}\end{xy}

By the way, in LaTeX you should use \[...\] rather than $$...$$.

  • Related to this: How do I put a curvy arrow to illustrate the commutativity of the diagram ? Thanks again. – Yeah Dec 10 '16 at 3:42
  • You specify a curved arrow with \ar@/_/ where optionally the _ can be followed by a length. This gives a down-curved arrow. With @/^/ it will be up-curved. So in my example you can add \ar@/_1cm/[urrr] to get a curved arrow from Z to Y. – Piet van Oostrum Dec 10 '16 at 6:37

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.