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.

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.

share|improve this question

1 Answer 1

up vote 5 down vote accepted
\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.

share|improve this answer
    
brilliant, this is perfect! –  Jesko Hüttenhain May 9 '12 at 14:05

Your Answer

 
discard

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.