3

I would like to have an overbrace inside an underbrace (not overlapping braces). Here is an equation I have been trying:

    \begin{equation}
    \max_{a \in A} \left\{\underbrace{ \left(v_a + v_y y \right) a - C(a)}_{\text{blabla}}
    \mathrlap{\overbrace{\phantom{v_y y ) a - C(a)}}^{\text{blablabla}}}
    + \mu_a \mathbb{E}(v_a | a, y) - \mu_y \mathbb{E}(v_y|a,y)\right\}.
    \end{equation}

So far, I am obtaining an overbrace shifted far to the right:

enter image description here

3
  • 2
    As always on this site, please provide a full minimal example. Not everyone know that \mathclap comes from mathtools
    – daleif
    Oct 7 '15 at 10:38
  • 2
    And what exactly is the overbrace suppose to cover? a-C(a)?
    – daleif
    Oct 7 '15 at 10:41
  • then just use \underbrace{ ... \overbrace{...}^{A}}_{B} just tested, works just fine.
    – daleif
    Oct 7 '15 at 10:54
3

Here's a solution that gets by without \mathrlap. Note also the declaration of \E as a "math operator", the use of \mid instead of | (in order to obtain some whitespace on both sides of the vertical bars), and the use of \biggl\{ and \biggr\} instead of \left\{ and \right\} (to avoid getting unnecessarily large curly braces).

enter image description here

\documentclass{beamer}
\usepackage{amsmath,amsfonts}
\DeclareMathOperator{\E}{\mathbb{E}}

\begin{document}
\begin{frame}

\[
    \max_{a \in A}
    \biggl\{
    \underbrace{ ( v_a + \overbrace{v_y y ) a - C(a)}^{ \text{blabla}}}_{\text{blabla}}
    {} + \mu_a \E(v_a \mid  a, y) - \mu_y \E(v_y\mid a,y)
    \biggr\}
\]

\end{frame}
\end{document}
4
  • Is is just me, or is the spacing around the + after the \underbrace wrong/missing?
    – daleif
    Oct 7 '15 at 11:21
  • @daleif - Good catch! I'll modify the code to insert {} before + in order to change its type from unary to binary operator.
    – Mico
    Oct 7 '15 at 11:29
  • Egreg recommends adding a brace around the whole thing instead. \underbrace is an Op atom.
    – daleif
    Oct 7 '15 at 11:55
  • 1
    @daleif - egreg's recommendation is certainly sound in general. In the present case, though, the term immediately before the + symbol is rather dominant visually, as it ends with an overbrace, a parenthesis, and and an underbrace. Using the {}-before+ approach provides just a teeny bit more whitespace ahead of the + symbol, letting the entire equation look a bit more balanced. :-)
    – Mico
    Oct 7 '15 at 12:52
0

After a while, I got it:

    \begin{equation}
    \max_{a \in A} \left\{
    \underbrace{ (v_a + 
    \mathrlap{\overbrace{\phantom{v_y y ) a - C(a)}}^{\text{blablabla}}}
    v_y y ) a - C(a)}_{\text{blabla}}
    + \mu_a \mathbb{E}(v_a | a, y) - \mu_y \mathbb{E}(v_y|a,y)\right\}.
    \end{equation}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.