# Labels closer to the arrows with xy package

Few hours ago I have added my answer for this question How to make a math diagram on LaTex?

\documentclass[12pt]{standalone}
\usepackage[all,cmtip]{xy}
\usepackage[bb = boondox]{mathalfa}
\begin{document}
\xymatrix@R=.6pc@C=.6pc
{ & \mathbb{F} \ar[dl]_{\scriptscriptstyle\mu} \ar[dr]^{\scriptscriptstyle\nu}  & \\
\mathbb{P} & & \mathbb{M}
}
\end{document}


but the labels are a little too far from the arrows. I have not found in the manual what I am looking for. Is there a way to bring the labels closer to the arrows?

• \xymatrix@R=.6pc@C=.6pc { & \mathbb{F} \ar[dl]_{\scriptscriptstyle\mu\!\!} \ar[dr]^{\!\!\scriptscriptstyle\nu} & \\ \mathbb{P} & & \mathbb{M} }
– user121799
Jul 31, 2019 at 18:54
• @marmot Kind marmot therefore there is not into the documentation to bring the labels closer to the arrows. Jul 31, 2019 at 18:56

Here is a possible solution. You have to set the values by hand.

The idea is to print the default arrow with no labels and then insert an invisible arrow translated by some amount in parallel, with the label on it.

Observe the \ar[dl] \ar@<3pt>@{}[dl]_{}.

\documentclass[12pt]{standalone}
\usepackage[all,cmtip]{xy}
\usepackage[bb = boondox]{mathalfa}
\begin{document}
$\xymatrix@R=.6pc@C=.6pc{ & \mathbb{F} \ar[dl] \ar@<3pt>@{}[dl]_{\scriptscriptstyle\mu} \ar[dr] \ar@<-3pt>@{}[dr]^{\scriptscriptstyle\nu} & \\ \mathbb{P} & & \mathbb{M} }$
\end{document}

• I saw this in the manual, but I didn't think it was related to a shorter distance of the labels. Jul 31, 2019 at 19:11
• @Sebastiano, well, to be true, it moves everything: the arrow and label. It is very useful to draw 2 parallel arrows. Jul 31, 2019 at 19:30
• With lot of sincerity he'd move the labels from one side to the other: pag. 6 of xyguide.pdf :-). I approved however your code! My best regards. Jul 31, 2019 at 19:34
• @Sebastiano, sorry, I didn't follow your comment about pg 6. I see no problems there. Jul 31, 2019 at 19:43

Use \labelmargin, see 24i on page 40 of the reference manual.

\documentclass[12pt]{standalone}
\usepackage[all,cmtip]{xy}
\usepackage[bb = boondox]{mathalfa}

\begin{document}

\xymatrix@R=.6pc@C=.6pc{
& \mathbb{F} \ar[dl]_{\scriptscriptstyle\mu}
\ar[dr]^{\scriptscriptstyle\nu}  & \\
\mathbb{P} & & \mathbb{M}
}

\labelmargin-{2pt}

\xymatrix@R=.6pc@C=.6pc{
& \mathbb{F} \ar[dl]_{\scriptscriptstyle\mu}
\ar[dr]^{\scriptscriptstyle\nu}  & \\
\mathbb{P} & & \mathbb{M}
}

\end{document}


• "Gentilissimo" egreg thank you very much for your answer. At this moment I can not upvoted you. I have finished all my votes :-(. Thank you very very very much. But for respect of Sigur the check mark remains to him. I hope that my English is correct. Jul 31, 2019 at 20:54
• @Sebastiano That's your choice, between a proper solution and a hack. Jul 31, 2019 at 20:57
• @Sebastiano, don't worry and feel free to change your decision. Jul 31, 2019 at 21:18
• @Sigur I never liked to disrespect other people. Fairness and humility come first. I am the first to make mistakes and when I make mistakes I do apologize. In my questions almost everyone has a green check. If they are not there it is because I have evaluated them at the same level. You were both very good. Always every best to you and the good users. Aug 1, 2019 at 10:17
• @egreg Done! +1 for your very good answer. Aug 1, 2019 at 10:18