14

How do I place a underbrace in a subscript?

I_{2,(\underbrace{3,3,3,3,3}_5)}

does not typeset correctly (the 3's are not subscript sized)

Stefan Kottwitz
  • 231,401
Bart Snapp
  • 1,339

2 Answers2

14

How about a quick and simple I_{2,(\underbrace{\scriptstyle3,3,3,3,3}_5)}?

Jan Hlavacek
  • 19,242
8

Jan already gave a good answer. However, I'd say it's a real weakness of \underbrace that you have to do this manually. (One might even call it a bug.) Here's a surprisingly complicated redefinition of \underbrace that automatically inserts \scriptstyle if needed.

\documentclass{article}
\makeatletter
\let\saved@underbrace\underbrace
\renewcommand*\underbrace[1]{\@ifnextchar_{\ub@with{#1}}{\ub@without{#1}}}
\def\ub@with#1_#2{\mathpalette\underbrace@i{{#1}{_{#2}}}}
\newcommand*\ub@without[1]{\mathpalette\underbrace@i{{#1}{}}}
\newcommand*\underbrace@i[2]{\underbrace@ii#1#2}
\newcommand*\underbrace@ii[3]{\saved@underbrace{#1#2}#3}
\makeatother
\begin{document}
$I_{2,(\underbrace{3,3,3,3,3}_5)}$
\end{document}

One of the problems I had to overcome is very similar to this question of mine: The underscore must go inside the mathpalette (if present).

Hendrik Vogt
  • 37,935