5

I have a question about my diagram. How can I increase the gap between the arrows and the labels? I would like to have more space between the left arrow and the label (2). Thanks for any suggestions.

\documentclass{amsart}
\usepackage{graphicx}
\usepackage[all]{xypic}

\begin{document}
     \begin{equation*}
    \begin{gathered}
    \quad
        \SelectTips{cm}{} \xymatrix@C=4.5em@R=4.5em{ A
       \ar@<-1ex>@{=>}[d] _-{(3)}\ar@<1ex>@{=>}[r]^-{(1)}  & B  
            \ar@<1ex>@{=>}|{{\object@{/}}}[l]^-{(2)}         \\
         C         \ar@<1ex>@{=>}[r] \ar@<-1ex>@{=>}[u] |{\object@{/}}|{}_-{\;(4)}   & D 
     \ar@<1ex>@{=>}[l] \ar@<-1ex>@{=>}[u]_{\;(5)} }
     \end{gathered}
     \end{equation*}
\end{document}
2
  • Please make your code compilable (if possible), or at least complete it with \documentclass{...}, the required \usepackage's, \begin{document}, and \end{document}. That may seem tedious to you, but think of the extra work it represents for TeX.SX users willing to give you a hand. Help them help you: remove that one hurdle between you and a solution to your problem.
    – Adam Liter
    Jan 29, 2014 at 4:43
  • 1
    Thanks for the tip. I don't find it tedious, just forgot adding the commands you mentioned. I have recently edited my code. It is now compilable. Jan 29, 2014 at 5:34

3 Answers 3

8
  1. You can modify the spacing of labels globally by adding @L=dimen after \xymatrix. In this case remove all additional spaces like \; you've inserted in the code. For example:

    \documentclass{amsart}
    \usepackage{graphicx}
    \usepackage[all]{xy}
    
    \begin{document}
         \begin{equation*}
         \quad
            \SelectTips{cm}{} \xymatrix@L=6pt@C=4.5em@R=4.5em{ A
           \ar@<-1ex>@{=>}[d] _-{(3)}\ar@<1ex>@{=>}[r]^-{(1)}  & B
                \ar@<1ex>@{=>}|{{\object@{/}}}[l]^-{(2)}         \\
             C         \ar@<1ex>@{=>}[r] \ar@<-1ex>@{=>}[u] |{\object@{/}}|{}_-{(4)}   & D
         \ar@<1ex>@{=>}[l] \ar@<-1ex>@{=>}[u]_{(5)} }
         \end{equation*}
    \end{document} 
    

    enter image description here

  2. You can modify the spacing of the single label treating it as an object, that is to say replace ^{...} with ^*modifiers{...}. In your case you will need the modifier +<dimen>, so replace ^-{(2)} with something like ^*+<1em>{^{(2)}} and adjust 1em to your needs. For example:

    \documentclass{amsart}
    \usepackage{graphicx}
    \usepackage[all]{xy}
    
    \begin{document}
         \begin{equation*}
         \quad
            \SelectTips{cm}{} \xymatrix@C=4.5em@R=4.5em{ A
           \ar@<-1ex>@{=>}[d] _-{(3)}\ar@<1ex>@{=>}[r]^-{(1)}  & B
                \ar@<1ex>@{=>}|{{\object@{/}}}[l]^*+<1em>{^{(2)}}         \\
             C         \ar@<1ex>@{=>}[r] \ar@<-1ex>@{=>}[u] |{\object@{/}}|{}_-{\;(4)}   & D
         \ar@<1ex>@{=>}[l] \ar@<-1ex>@{=>}[u]_-{\;(5)} }
         \end{equation*}
    \end{document} 
    

    enter image description here

2

They key @L=dimen can be used to change the default margin for labels (see here). Taking out the spaces that you've manually added and adding @L=1.25ex roughly achieves the result that you want, I believe.

You can change the dimension as necessary, however.

\documentclass{amsart}
\usepackage{graphicx}
\usepackage[all]{xypic}

\begin{document}
     \begin{equation*}
    \begin{gathered}
    \quad
        \SelectTips{cm}{} \xymatrix@C=4.5em@R=4.5em@L=1.25ex{ A
       \ar@<-1ex>@{=>}[d] _-{(3)}\ar@<1ex>@{=>}[r]^-{(1)}  & B  
            \ar@<1ex>@{=>}|{{\object@{/}}}[l]^{(2)}         \\
         C         \ar@<1ex>@{=>}[r] \ar@<-1ex>@{=>}[u] |{\object@{/}}|{}_-{(4)}   & D 
     \ar@<1ex>@{=>}[l] \ar@<-1ex>@{=>}[u]_{(5)} }
     \end{gathered}
     \end{equation*}
\end{document}

enter image description here

1

How about another approach via Tikz-cd? It looks promising.

The arrow distance can be changed via xshift=<dim> and yshift=<dim>.

The node clearance can be changed via inner sep=<dim>.

The label distance can be changed via node [above, below, right, left=<dim>]{label}.

enter image description here

Code

\documentclass[margin=10pt]{standalone}
%\usepackage[margin=1cm]{geometry}
\usepackage{tikz-cd}

\begin{document}

\begin{tikzcd}[row sep=3cm,column sep=3cm,inner sep=3ex]
A   \arrow[thick,Rightarrow,yshift=2ex,]{r}[above=0.5cm]{(1)}        
    \arrow[thick,Leftarrow, xshift=2ex]{d}[description,sloped]{/}[right=0.5cm]{(4)} 
& B \arrow[thick,Rightarrow,yshift=-2ex]{l}[below=0.5cm]{(2)}[description]{/} \\
C   \arrow[thick,Leftarrow, xshift=-2ex]{u}{(3)}   
    \arrow[thick,Leftarrow, yshift=2ex]{r}{}        
& D \arrow[thick,Leftarrow, yshift=-2ex]{l}{}         
    \arrow[thick,Rightarrow,xshift=2ex]{u}[right=0.5cm]{(5)} 
\end{tikzcd}


\end{document}

You must log in to answer this question.

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