[Tex/LaTex] How to get text above and below text

text manipulation

How would I do {text}_{i=1}^{i=n} with the written exactly above and below the text?

Hope you can help!

Best Answer

Here are two ways:

\stackunder{\stackon{\text{text}}{\scriptstyle i=n}}{\scriptstyle i=1}

enter image description here

The gap between the text and the over/under-set is defined with \setstackgap{S}{2pt} for the stackengine approach on the left.

Either of these approaches will work in \displaystyle (shown) or in \textstyle. Note, however, that in \textstyle, the line spacing will be affected.