Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I use the following code to make xy-pic arrow labels multiline capable:

\let\oldlabelbox=\labelbox
\def\newlabelbox#1{%
\oldlabelbox{\vcenter{\normalbaselines%
    \let\\=\cr\ialign{$\labelstyle##\hfil$\crcr#1\crcr}}%
    }}
\let\labelbox\newlabelbox

The problem is that labels end up about .5ex to the right of where they should be. I guess I could put a negative space in there explicitly, but that would seem slightly inelegant.

I would like to know what in the above definition produces that offset.

share|improve this question

1 Answer 1

Next time it would be great if you would post a compilable minimal example.

There's no problem with spacing:

\documentclass{article}
\usepackage[all]{xy}
 \let\oldlabelbox=\labelbox
 \def\newlabelbox#1{%
  \oldlabelbox{\vcenter{\normalbaselines%
      \let\\=\cr\ialign{$\labelstyle##\hfil$\crcr#1\crcr}}%
  }}
 \let\labelbox\newlabelbox
\begin{document}
\xy(0,0)
\ar @{-->} (50,20) ^{X\\Y}="a"
\POS(0,10)*+\txt{Label\\Test} \ar "a"
\endxy
\end{document}

alt text

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.