# Moving labels in xypics

I have made a significantly complicated diagram of a system of chemical reactions in xy pics, but for all the reaction rates to be visable i have to change their placement on the arrows, either making them closer to arrows, further away or varying their occurance along the length of the arrow. So far I have not succeeded in making any of the commands from the documentation help with this.

Could someone show me how its done?

\documentclass{article}
\usepackage{color}
\usepackage[color,matrix,arrow]{xy}
\begin{document}
$\xymatrix{ &&A_1+A_2+L+L \ar@<-.5ex>[ddl]_{k_{a2}} \ar@<+.5ex>[ddr]^{k_{a1}}&&\\ &&&&\\ &A_1+A_2L+L\ar@<-.5ex>[ddl]_{k_{a22}} \ar@<-.5ex>[uur]_{k_{d2}} \ar@<+.5ex>[rdd]^{k_{a1}} \ar@<+.5ex>@[lightgray][rddd]^{\textcolor{lightgray}{k_{a21}}}& & A_1L+A_2+L \ar@<.5ex>@[lightgray][lddd]^{\textcolor{lightgray}{k_{a12}}} \ar@<.5ex>[ddl]^{k_{a2}} \ar@<+.5ex>[luu]^{k_{d1}} \ar@<+.5ex>[rdd]^{k_{a11}}&\\ &&&&\\ A_1+LA_2L\ar@<-.5ex>[uur]_{k_{d22}} \ar@<+.5ex>[ddr]^{k_{a221}} && A_1L+A_2L\ar@<.5ex>[uur]^{k_{d2}} \ar@<.5ex>[ddl]^{k_{a212}} \ar@<+.5ex>[uul]^{k_{d1}} \ar@<+.5ex>[ddr]^{k_{a121}} & & LA_1L+A_2 \ar@<+.5ex>[ddl]^{k_{a112}} \ar@<+.5ex>[uul]^{k_{d11}} \\ &&\textcolor{lightgray}{A_1LA_2+L}\ar@<.5ex>@[lightgray][uuur]^{\textcolor{lightgray}{k_{d12}}} \ar@<+.5ex>@[lightgray][uuul]^{\textcolor{lightgray}{k_{d21}}} \ar@<+.5ex>@[lightgray][dr]^{\textcolor{lightgray}{k_{a121}}} \ar@<.5ex>@[lightgray][dl]^{\textcolor{lightgray}{k_{a212}}} &&\\ &LA_2LA_1\ar@<.5ex>@[lightgray][ur]^{\textcolor{lightgray}{k_{d212}}} \ar@<.5ex>[uur]^{k_{d212}} \ar@<+.5ex>[uul]^{k_{d221}} \ar@<+.5ex>[ddr]^{k_{a2211}} & & LA_1LA_2\ar@<.5ex>[uur]^{k_{d112}} \ar@<.5ex>[ddl]^{k_{a1122}} \ar@<+.5ex>[uul]^{k_{d121}} \ar@<+.5ex>@[lightgray][ul]^{\textcolor{lightgray}{k_{d121}}} &\\ &&&&\\ & & (LA_1LA_2)_r,\ar@<.5ex>[uur]^{k_{d1122}} \ar@<+.5ex>[uul]^{k_{d2211}}& & \\ }$


Are you sure that you have had a look in the manual? Your problem is explicitly addressed in the paper that is mentioned on the CTAN site (Us­ing XY-pic on https://ctan.org/pkg/xypic).

I have never used this package before -- the code looks like a cat walked over a keyboard :). I guess that I will use my next online banking password by using a code snippet from the manual :).

\documentclass{article}

\usepackage[all]{xy}
%
\begin{document}

% \frame{} is just for illustration purposes.

% Taken from the Paper: Us­ing XY-pic on https://ctan.org/pkg/xypic
\frame{\begin{xy}
(0,0)*+{A}; (20,0)*+{B} **\dir{-}%
?>*\dir{>} ?*!/_2mm/{\alpha}
\end{xy}}

\frame{\begin{xy}
(0,0)*+{A}; (20,0)*+{B} **\dir{-}%
?>*\dir{>} ?*!/_4mm/{\alpha}
\end{xy}}

% ?<
\frame{\begin{xy}
(0,0)*+{A}; (20,0)*+{B} **\dir{-}%
?>*\dir{>} ?<*!/_2mm/{\alpha}
\end{xy}}

% ?>
\frame{\begin{xy}
(0,0)*+{A}; (20,0)*+{B} **\dir{-}%
?>*\dir{>} ?>*!/_2mm/{\alpha}
\end{xy}}

% ?(0.5)
\frame{\begin{xy}
(0,0)*+{A}; (20,0)*+{B} **\dir{-}%
?>*\dir{>} ?(0.5)*!/_2mm/{\alpha}
\end{xy}}

% ?(0.8)
\frame{\begin{xy}
(0,0)*+{A}; (20,0)*+{B} **\dir{-}%
?>*\dir{>} ?(0.8)*!/_2mm/{\alpha}
\end{xy}}

\end{document}


• That's helpful, I was only aware of this piece of documentation however, it doesn't solve the problem. As it doesn't explain how to incorporate those options with the ones my arrows are using. So far when I add spacing commands for the labels they remove the other options on the arrows – Abijah Feb 14 '18 at 11:40
• Then maybe you could minimize your code example to one arrow in order to make it easier to help and in order to focus on the actual problem. Right now your code is too complex for this kind of question in my humble opinion. – Dr. Manuel Kuehner Feb 14 '18 at 19:03

I decided on this as the code for the xymatrix:

    \xymatrix{
&&A_1+A_2+L+L \ar@<-.5ex>[dl]_{k_{a2}}
\ar@<+.5ex>[dr]^{k_{a1}}&&\\
&A_1+A_2L+L\ar@<-.5ex>[dl]_{k_{a22}}
\ar@<-.5ex>[ur]_{k_{d2}}
\ar@<+.5ex>[rd]^{k_{a1}}
\ar@<+.5ex>@[lightgray][rddd]^{\textcolor{lightgray}{k_{a21}}}&   & A_1L+A_2+L \ar@<.5ex>@[lightgray][lddd]^</2cm/{\textcolor{lightgray}{k_{a12}}}
\ar@<.5ex>[dl]^{k_{a2}}
\ar@<+.5ex>[lu]^{k_{d1}}
\ar@<+.5ex>[rd]^{k_{a11}}&\\
A_1+LA_2L\ar@<-.5ex>[ur]_{k_{d22}}
\ar@<+.5ex>[ddr]^{k_{a221}} && A_1L+A_2L\ar@<.5ex>[ur]^{k_{d2}}
\ar@<.5ex>[ddl]^{k_{a212}}
\ar@<+.5ex>[ul]^{k_{d1}}
\ar@<+.5ex>[ddr]^{k_{a121}}  & & LA_1L+A_2 \ar@<+.5ex>[ddl]^{k_{a112}}
\ar@<+.5ex>[ul]^{k_{d11}} \\
&&&&\\
&LA_2LA_1\ar@<.5ex>@[lightgray][r]^{\textcolor{lightgray}{k_{d212}}}
\ar@<.5ex>[uur]^{k_{d212}}
\ar@<+.5ex>[uul]^{k_{d221}}
\ar@<+.5ex>[ddr]^{k_{a2211}}      &\textcolor{lightgray}{A_1LA_2+L}\ar@<.5ex>@[lightgray][uuur]^{\textcolor{lightgray}{k_{d12}}}
\ar@<+.5ex>@[lightgray][uuul]^</3cm/{\textcolor{lightgray}{k_{d21}}}
\ar@<+.5ex>@[lightgray][r]^{\textcolor{lightgray}{k_{a121}}}
\ar@<.5ex>@[lightgray][l]^{\textcolor{lightgray}{k_{a212}}}        &  LA_1LA_2\ar@<.5ex>[uur]^{k_{d112}}
\ar@<.5ex>[ddl]^{k_{a1122}}
\ar@<+.5ex>[uul]^{k_{d121}}
\ar@<+.5ex>@[lightgray][l]^{\textcolor{lightgray}{k_{d121}}} &\\
&&&&\\
& & (LA_1LA_2)_r,\ar@<.5ex>[uur]^{k_{d1122}}
\ar@<+.5ex>[uul]^</1cm/{k_{d2211}}& & \\
}


the code for the individual arrows with the shifted labels were coded as:

\ar@<+.5ex>[uul]^</1cm/{k_{d2211}}

• I'm not sure if I understood what you wish, but to center a label use \ar[d]^-{f} for example (that is, use a dash - after the positioning ^ or _). – Sigur Feb 20 '18 at 11:43