# Math formatting "Pro Tips" edition: Stacking characters! - "?"

##### 1 Answer
Mar 30, 2015

I was trying to answer a chemistry question just now and came across a very useful function, especially for math expressions.

Here's how it goes

hashtag underbrace(whatever) hashtag

it'll look like this

$\underbrace{2 + 2 + 2}$

$\underbrace{\text{testing, testing...}}$

If you want, you can add a label to it by writing

hashtag underbrace(whatever)_(label) hashtag

you'll get

${\underbrace{2 + 2 + 2}}_{\text{3 times}}$

$4 + n + {\underbrace{x + \ldots + x}}_{\text{n times}} + 3 + 5$

You can use overbrace as well to get

$\overbrace{2 + 2 + 2}$

To write above the expression use

hashtag overbrace(whatever)^(label) hashtag

${\overbrace{x + x + x + \ldots + x}}^{\text{100 times}}$

Anyway, you can get pretty creative with this stuff, as I'm sure you will.

underbrace(AB + CD)_(color(blue)("reactants")) -> overbrace(CB + AD)^(color(green)("products")

underbrace(x^(2) * x^(2) * x^(2) * ... * x^(2))_("10 times") = x^(overbrace(2 + 2 + ... + 2)^("10 times")) = x^(20)

Another interesting one

hashtage stackrel(text you want on top)(text you want on the bottom) hashtag

it produces

stackrel("whatever text you want on top")("whatever text you want on the bottom")

If you want to use two or more underbrace or overbrace functions in a row, use this syntax

hashtag overbrace(whatever)^text(label) hashtag

or

hashtag underbrace(whatever)_text(label) hashtag

you can write stuff like

$z = {\overbrace{{\underbrace{a}}_{\textrm{r e a l}} + {\underbrace{i b}}_{\textrm{i m a g \in a r y}}}}^{\textrm{c o m p \le x \nu m b e r}}$

or

${\underbrace{n + n + n + {\underbrace{x + x + \ldots + x}}_{\textrm{Z \times}} + n + n + n}}_{\textrm{Y \times}}$