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

\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}

%% 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

\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}}

current output

Here's an example of the desired output (I got the effect I wanted fiddling with \hspace*{}

\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}}

Desired spacing Could someone tell me how I can modify the above code to get the desired results?

  • 1
    Can you please show an example of your output, as well as the output you want to have? Or at least make your example complete.
    – mickep
    Oct 4 at 13:49
  • I see your point, I've added more details. Thanks! Oct 4 at 19:02
  • Why do you use an align* environment when there's nothing to align across rows (since there's just one main row)?
    – Mico
    Oct 4 at 19:07
  • @Mico I only used align{} because the example I copied from used two lines of math. I didn't include the second line since it was superfluous. Oct 4 at 20:18

1 Answer 1


I'd use "ordinary" \underbrace and \overbrace directives, and I wouldn't bother with inserting line breaks.

enter image description here

\documentclass{article} % or some other suitable document class
\usepackage{mathtools}  % for '\mathclap' macro

\Pr(\text{Loss at $t = 1$}) 
{\underbrace{(1-s)}_{\mathclap{\text{Effect of natural selection}}}}
{\overbrace{0.368}^{\mathclap{\text{Pr.\ of loss of neutral allele}}}}

Addendum: In case readers are curious why I surrounded the \underbrace{...}_{...} and \overbrace{...}^{...} objects with curly braces: Doing so changes their TeX math status to "math-ordinary" which, in turn, improves their spacing relative to other objects such as \approx and \times.

  • 2
    +1 also for the braces around \overbrace and \underbrace but I'd explain them. We know but the OP might not...
    – campa
    Oct 4 at 19:49
  • @campa - Good suggestion! I've posted an addendum to motivate the use of the surrounding curly braces.
    – Mico
    Oct 4 at 20:34
  • Thanks for the solution and note on using {}. I came across \mathclap{} in the code I cribbed, but didn't know what it was actually doing. Oct 5 at 19:58

You must log in to answer this question.

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