3

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.

1 Answer 1

3

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

You must log in to answer this question.