4

I'm using \underbrace{}_\text{} to explain the meaning of a variable: equation using underbrace As you can see in the image, underbrace pushes the equations aside to make space for the text. I would like to get something like this instead: enter image description here

Question: Is it possible to remove this pushing behavior to get the desired result?

Thanks for helping! :D

1 Answers1

4

Yes, there is a way: you can use \makebox[0pt] and the relevant text size (\footnotesize or scriptsize), or \clap, defined in mathtools. Using some code in mathtools, we can define an \EV and a \given commands for the expected value of a random variable, which has variable-sized delimiters:

\documentclass{article}
\usepackage[utf8]{inputenc}%
 \usepackage{mathtools}

\providecommand\given{}
\DeclarePairedDelimiterXPP\EV[1]{E}[]{}{
\renewcommand\given{\nonscript\:\delimsize\vert\nonscript\:}
#1}

\begin{document}

\[ \EV{R_{i, t}\given I_{t-1}} = γ_{0,t-1} + \underbrace{\gamma_{0,t-1}}_{\makebox[0pt]{\footnotesize conditional market risk premium}}β_{i, t-1} \]%
\bigskip
\[ \EV[\big]{R_{i, t}\given I_{t-1}} = γ_{0,t-1} + \underbrace{\gamma_{0,t-1}}_{\clap{\scriptsize conditional market risk premium}}β_{i, t-1} \]%

\end{document} 

enter image description here

Bernard
  • 271,350
  • Works perfectly! For future reference: \footnotesize makes the text have the same size as footnotes, if you remove it you get a bigger text underneath the equation; \makebox creates a box to contain text. – Guilherme Salomé Oct 15 '16 at 17:56
  • 1
    I don't think a bigger size is advisable here. Actually, maths in underbrace is typed in scriptstyle, so text might even be typed in \scriptsize. – Bernard Oct 15 '16 at 18:24
  • Here's a convenience function: \newcommand{\myunderbrace}[2]{\underbrace{#1}_{\makebox[0pt]{\scriptsize \ensuremath{#2}}}}. I believe an overbrace equivalent would be pretty much the same, just with the \overbrace and ^ replacements. – jared Sep 11 '23 at 06:10