1

As the title says, the \underbrace in my code is not aligned, while the \overbrace in not creating any problems. This is visible in the first picture: enter image description here

I would like to get something like this:enter image description here

Here is the code that I'm using

\documentclass[11pt,a4paper,openany]{report}

\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[italian]{babel}
\usepackage[dvipsnames]{xcolor}
\usepackage{mathtools}

\newcommand{\deff}[1]{\large{\underline{\textbf{#1}}}}
\newcommand{\X}{\mathcal{X}}
\newcommand{\Y}{\mathcal{Y}}
\newcommand*{\Vimplies}{\mathrel{\text{\raisebox{.25ex}{\rotatebox[origin=c]{270}{$\implies$}}}}}

\begin{document}

DIM.
\begin{gather*}
    \lefteqn{
        \textcolor{red}{
            \underbrace{\phantom{a) \iff b)}}_{a) \implies b) \;\land\; b) \implies a)}}}
    a) \iff 
        \textcolor{ForestGreen}{
            \overbrace{\textcolor{black}{b) \iff c)}}^{b) \implies c) \;\land\; c) \implies b)}}    \\
    \Vimplies                                                                                       \\
    \boxed{a) \implies b) \implies c) \implies a)}
\end{gather*}
\[\lefteqn{\underbrace{\phantom{1+2+3}}_{a+b+d}}1+2+\overbrace{3+4+5}^{e+f+g}\]

\end{document}

1 Answer 1

1

Because both the under- and over-brace labels are wider than the braces themselves, they need to be \mathclapped.

\documentclass[11pt,a4paper,openany]{report}

\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[italian]{babel}
\usepackage[dvipsnames]{xcolor}
\usepackage{mathtools}

\newcommand{\deff}[1]{\large{\underline{\textbf{#1}}}}
\newcommand{\X}{\mathcal{X}}
\newcommand{\Y}{\mathcal{Y}}
\newcommand*{\Vimplies}{\mathrel{\text{\raisebox{.25ex}{\rotatebox[origin=c]{270}{$\implies$}}}}}
\newsavebox\MBox
\newcommand\Cline[2][red]{{\sbox\MBox{$#2$}%
  \rlap{\usebox\MBox}\color{#1}\rule[-1.2\dp\MBox]{\wd\MBox}{0.8pt}}}

\begin{document}

DIM.
\begin{gather*}
    \lefteqn{
        \textcolor{red}{
            \underbrace{\phantom{a) \iff b)}}_{\mathclap{a) \implies b) \;\land\; b) \implies a)}}}}
    a) \iff 
        \textcolor{ForestGreen}{
            \overbrace{\textcolor{black}{b) \iff c)}}^{\mathclap{b) \implies c) \;\land\; c) \implies b)}}}    \\
    \Vimplies                                                                                       \\
    \boxed{a) \implies b) \implies c) \implies a)}
\end{gather*}
\[\lefteqn{\underbrace{\phantom{1+2+3}}_{a+b+d}}1+2+\overbrace{3+4+5}^{e+f+g}\]

\end{document}

enter image description here

0

You must log in to answer this question.

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