I'm currently using the nice hack defining \smalloverbrace for reducing the size of my \overbrace and \underbrace.
%% Commands for more compact over and underbraces
%% \smalloverbrace
%% See: https://tex.stackexchange.com/a/419690/110759
\makeatletter
\def\smalloverbrace#1{\mathop{\vbox{\m@th\ialign{##\crcr\noalign{\kern3\p@}%
\tiny\downbracefill\crcr\noalign{\kern3\p@\nointerlineskip}%
$\hfil\displaystyle{#1}\hfil$\crcr}}}\limits}
\def\smallunderbrace#1{\mathop {\vtop {\m@th \ialign {##\crcr $\hfil \displaystyle {#1}\hfil $\crcr \noalign {\kern 3\p@ \nointerlineskip }
\tiny\upbracefill \crcr \noalign {\kern 3\p@ }}}}\limits}
\makeatother
\newcommand{\clap}[1]{\makebox[0pt]{#1}}
%% end code for \smalloverbrace and \smallunderbrace
I'd like to modify it further so that the spacing between math elements ignores the size of the text in the over/underbrace. (I understand you may think this is unwise, but I have a need for it in making lecture slides.)
Here's an example using the current set up
\begin{align*}
\Pr( \text{Lost at } t = 1) &\approx \smallunderbrace{(1-s)}_{\shortstack{Effect of \\ Natural selection}} \smalloverbrace{0.368}^{\shortstack{Pr. of loss of\\neutral allele}}
\end{align*}
Here's an example of the desired output (I got the effect I wanted fiddling with \hspace*{}
\begin{align*}
\Pr( \text{Lost at } t = 1) &\approx \hspace*{-0.25in} \underbrace{(1-s)}_{\small \shortstack{Effect of \\ Natural selection}} \hspace*{-0.4in}\overbrace{0.368}^{\small \shortstack{Pr. of loss of\\neutral allele}}
\end{align*}
Could someone tell me how I can modify the above code to get the desired results?
align*
environment when there's nothing to align across rows (since there's just one main row)?align{}
because the example I copied from used two lines of math. I didn't include the second line since it was superfluous.