TransWikia.com

How do I put text above and under an expression?

TeX - LaTeX Asked by Teun Zijp on June 23, 2021

I’m trying to outline something in a function, by putting text under and above the equation. Text under the equation works fine, but the text above the equation is moved to the right of the equation, which is maybe normal for powers, but I hoped it would behave the same as how it works for sum signs.

begin{align} 
Biglangle hat{A}(t) Bigrangle_S &= int U_m^*(vec{r}) hat{H}     U_n(vec{r}) dd^3 r
& = displaystyleBiglangle 
underset{text{color{darkgreen}Time independent}}{displaystyle
    {displaystyle{color{red}overbracket[1.2pt]{color{black}psi_S(t)}} 
        color{black}Big| 
        color{darkgreen}underbracket[1.2pt]{color{black}hat{A} Big|}
        color{red}overbracket[1.2pt]{color{black}psi_S(t)}
    }displaystyle^{text{color{red}Time dependent}}
} Bigrangle
end{align}

I want to point out a few terms in this equation

I also thought that maybe there was a thing that works similar to underset, but then puts the text above the equation. I tried both overset and stackrel.

```
begin{align} 
Biglangle hat{A}(t) Bigrangle_S &= int U_m^*(vec{r}) hat{H}     U_n(vec{r}) dd^3 r
& = displaystyleBiglangle 
underset{text{color{darkgreen}Time independent}}{displaystyle
stackrel{text{color{red}Time dependent}}{
    displaystyle{color{red}overbracket[1.2pt]{color{black}psi_S(t)}} 
    color{black}Big| 
    color{darkgreen}underbracket[1.2pt]{color{black}hat{A} Big|}
    color{red}overbracket[1.2pt]{color{black}psi_S(t)}
}
} Bigrangle
end{align}

It does (somehow) print the same output as shown above, but it gives me an error message. For overset:

Limit controls must follow a math operator.
overset ...nrel@@ {mathop {kern z@ #2}limits 
                                              ^{#1}}

as well as for stackrel:

Limit controls must follow a math operator.
stackrel #1#2->mathrel {mathop {#2}limits 
                                          ^{#1}}

I have no clue what that means, or how I should write the code so that it does the thing I want. Also, does anyone know where overset and stackrel are useful for, as it apparently can’t do the thing I want it to do?

One Answer

Meanwhile, I did find the way to do what I want using raisebox, but I didn't find where overset is used for.

& = displaystyleBiglangle 
underset{text{color{darkgreen}Time independent}}{displaystyle
    raisebox{20pt}{parbox{0cm}{text{footnotesizecolor{red}Time dependent}}}{
        displaystyle{color{red}overbracket[1.2pt]{color{black}psi_S(t)}} 
        color{black}Big| 
        color{darkgreen}underbracket[1.2pt]{color{black}hat{A} Big|}
        color{red}overbracket[1.2pt]{color{black}psi_S(t)}
    }
} Bigrangle

An equation with a few terms pointed out.

Oh and usage of footnotesize will ensure that it's roughly the same size as the text under the equation.

Answered by Teun Zijp on June 23, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP