8

I wonder if there is a way to create an equation like that where the "subscript" is placed underneath instead of in the bottom right corner. I also want the "subscript" to be center aligned with the number above.

enter image description here

1
  • 2
    \underset from amsmath does just this.
    – egreg
    Apr 6, 2013 at 14:15

1 Answer 1

7

A simple realization is with amsmath and \underset:

\documentclass{article}
\usepackage{amsmath}

\begin{document}
\[
y=\underset{(20)}{35}\cdot x + \underset{(3)}{39}\cdot z + \underset{(11)}{3859}
\]
\end{document}

enter image description here

However, you see that the first pair is perhaps too wide, because the subscript width is taken into consideration. If the subscript is never much wider than the number, you can use also \mathclap from mathtools; with a new command also the syntax is handier.

\documentclass{article}
\usepackage{mathtools}% also loads amsmath

\newcommand{\twonums}[2]{\underset{\mathclap{(#2)}}{#1}}

\begin{document}
\[
y=\twonums{35}{20}\cdot x + \twonums{39}{3}\cdot z + \twonums{3859}{11}
\]
\end{document}

enter image description here

1
  • That's exactly what I want. Thank you so much.
    – JACKY88
    Apr 6, 2013 at 14:41

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .