3

I have an equation that is too long to fit on one line, so I put a few terms on a second line using amsmath's aligned environment. However, the first line of the equation contains an underbrace that causes the second line to be placed too far down below the original equation, like so:

too much space

I was able to reduce the gap by eye using a negative space after the first line break, but I would like to know how to reduce the gap in a way such that the spacing between the first and second line remains exactly the same as it would be without the underbrace, like this:

ideal spacing

I believe that the answer to my question involves getting the height of just the underbrace without the text above and inserting a negative space of that magnitude after the first line break, but I'm not sure how to do it.

My code is the following:

\documentclass[10pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{amsmath}
\begin{document}

\begin{equation*}
    \begin{aligned}
        P(\underbrace{C_{t}^{d}+I_{t}^{d}+G_{t}^{d}}_{=Y_{t}^{d}}-Y_{t}^{s})+\left(B_{t}^{p}+B_{t}^{g}\right)+\left(M_{t}^{d}-M_{t}^{s}\right)&=\left(1+r_{t-1}\right)\left(B_{t-1}^{p}+B_{t-1}^{g}\right)\\
        &+\left(M_{t-1}^{d}-M_{t-1}^{s}\right)
    \end{aligned}
\end{equation*}

\end{document}

1 Answer 1

4

Please compare:

\documentclass[10pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{amsmath}
\begin{document}


You have:
\begin{equation*}
    \begin{aligned}
        P(\underbrace{C_{t}^{d}+I_{t}^{d}+G_{t}^{d}}_{=Y_{t}^{d}}-Y_{t}^{s})+\left(B_{t}^{p}+B_{t}^{g}\right)+\left(M_{t}^{d}-M_{t}^{s}\right)&=\left(1+r_{t-1}\right)\left(B_{t-1}^{p}+B_{t-1}^{g}\right)\\
        &+\left(M_{t-1}^{d}-M_{t-1}^{s}\right)
    \end{aligned}
\end{equation*}

You want:
\begin{equation*}
    \begin{aligned}
        P(\smash{\underbrace{C_{t}^{d}+I_{t}^{d}+G_{t}^{d}}_{=Y_{t}^{d}}}-Y_{t}^{s})+\left(B_{t}^{p}+B_{t}^{g}\right)+\left(M_{t}^{d}-M_{t}^{s}\right)&=\left(1+r_{t-1}\right)\left(B_{t-1}^{p}+B_{t-1}^{g}\right)\\
        &+\left(M_{t-1}^{d}-M_{t-1}^{s}\right)
    \end{aligned}
\end{equation*}
or rather
\begin{equation*}
    \begin{aligned}
        P(\smash{\underbrace{C_{t}^{d}+I_{t}^{d}+G_{t}^{d}}_{=Y_{t}^{d}}}-Y_{t}^{s})+\left(B_{t}^{p}+B_{t}^{g}\right)+\left(M_{t}^{d}-M_{t}^{s}\right)&=\left(1+r_{t-1}\right)\left(B_{t-1}^{p}+B_{t-1}^{g}\right)\\
        &\qquad+\left(M_{t-1}^{d}-M_{t-1}^{s}\right)
    \end{aligned}
\end{equation*}

\end{document}

enter image description here

The final indentation improves the readability.

1
  • This works perfectly, thanks. Sep 18, 2021 at 2:51

You must log in to answer this question.

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