# Automatically scale an XY-Matrix in the Index of a math symbol

Consider the following code:

\documentclass[a4paper,12pt]{article}
\usepackage[all,2cell]{xy}
\UseAllTwocells

\newcommand{\partinto}[3][]{%
\xymatrix@C=.85em@1{%
*+{#2\,} \ar@{|-}[r]_-*-{\scriptstyle #1} & *+{\,#3} %
}}

\begin{document}
Let $\partinto[n]{\lambda}{d}$ be a partition of $d$ into at most $n$ parts.
Also, $\bigoplus_{\partinto[n]{\lambda}{d}} V_\lambda.$
\end{document}


My problem is, the xymatrix in the index of the big direct sum symbol does not scale. Is there any way I can make it automatically scale? I could certainly make a new command \scrpartinto which works as an index, but I would like to know a way to make \partinto scale automatically once it is used as an index.

-

\newcommand{\partinto}[3][]{\mathchoice
{
\xymatrix@C=.85em@1{%
*+{\displaystyle#2\,} \ar@{|-}[r]_-*-{\scriptstyle #1} & *+{\displaystyle\,#3}}
}
{
\xymatrix@C=.85em@1{%
*+{\textstyle#2\,} \ar@{|-}[r]_-*-{\scriptstyle #1} & *+{\textstyle\,#3}}
}
{
\xymatrix@C=.65em@1{%
*+{\scriptstyle#2\,} \ar@{|-}[r]_-*-{\smash{\raisebox{-.4ex}{$\scriptscriptstyle #1$}}} & *+{\scriptstyle\,#3}}
}
{
}
}


I've added nothing for scriptscript style, just adapt the code for script style, if you really need it.

-
brilliant, this is perfect! –  Jesko Hüttenhain May 9 '12 at 14:05