Nested Undersets
Here, I introduce
\bsmile[<under-depth-offset>]{<main-text>}{<underset-text>}
If #2
is blank, the width of the typeset is derived from the \smile
...otherwise it is derived from the width of #2
.
The MWE
\documentclass{article}
\usepackage{stackengine}
\newcommand\bsmile[3][0pt]{\if\relax#2\relax\def\tmp{F}\else\def\tmp{T}\fi
\ensurestackMath{\stackengine{#1}{#2}{%
\stackengine{1pt}{\mbox{\huge$\smile$}}{\scriptstyle#3}{U}{c}{F}{T}{S}}
{U}{c}{F}{\tmp}{S}}}
\begin{document}
$90\bsmile{}{+90}\bsmile[16pt]{180}{+90}\bsmile{}{+180}360\bsmile{}{+240}600$
\end{document}
Here is a simple array.
\documentclass[fleqn]{article}
\usepackage{mathtools}
\usepackage{relsize}
\newcommand{\scriptclap}[1]{\mathclap{\scriptstyle #1}}
\newcommand{\LargerSmile}{\mathlarger{\mathlarger{\mathlarger{\mathlarger\smile}}}}
\begin{document}
Some text.
\[ \begin{array}[t]{*7{c@{}}}
90 && 180 && 360 && 600\\[-1ex]
& \LargerSmile & & \LargerSmile & & \LargerSmile &\\[-1ex]
&\scriptclap{+90} & &\scriptclap{+180} && \scriptclap{+240}&\\[-1ex]
& & \LargerSmile & & & &\\[-1ex]
& & \scriptclap{+90} & & & &\\
\end{array} \quad\dots \text{more stuff} \]
More text.
\end{document}
The more stuff
is just to show that you can align the top row with other parts of the formula. If this is not needed, remove [t]
after \begin{array}
.
For more complicated tasks I recommend TikZ with the tikzmark
library.
With a not so complicated syntax:
\documentclass{article}
\usepackage{amsmath,array}
\newcommand{\differences}[1]{%
\begingroup
\def\?##1{\hidewidth\scriptstyle\mathstrut##1\hidewidth\kern0pt}%
\def\U{\mbox{\huge$\smile$}}%
\settowidth{\dimen255}{\U}
\renewcommand{\arraystretch}{0}%
\setlength{\arraycolsep}{0pt}%
\begin{array}{*{20}{w{c}{\dimen255}}}
#1
\end{array}%
\endgroup
}
\begin{document}
\[
\differences{
90 && 180 && 360 && 600 \\
& \U && \U && \U \\
& \?{+90} && \?{+180} && \?{+240} \\
&& \U && \U \\
&& \?{+90} && \?{+60} \\
&&& \U \\
&&& \?{+30}
}
\]
\[
\differences{
640 && 231 && 100 && 91 && 1003 \\
& \U && \U && \U && \U \\
& \?{-409} && \?{-131} && \?{-9} && \?{+912} \\
&& \U && \U && \U \\
&& \?{+278} && \?{+122} && \?{921} \\
&&& \U && \U \\
&&& \?{-156} && \?{+799} \\
&&&& \U \\
&&&& \?{955}
}
\]
\end{document}
No more than four digits in the main numbers.