6

How do I

  1. remove the additional space around \underbrace
  2. justify the text under it, if the latter is longer than the text above it?

To illustrate the issue:

\documentclass{article}
\usepackage{amsmath}
\usepackage{mathtools}

\newcommand{\underbracewithoutspace}[2]{\mathrlap{\underbrace{\phantom{#1\strut}}_{#2}}#1}

\begin{document}

\begin{equation}
\underbrace{a+b}_{\text{a long blah blah blah}}+c
\end{equation}

% using the technique of 
% https://tex.stackexchange.com/questions/24912/remove-additional-space-around-underbrace  
\begin{equation}
\underbracewithoutspace{a+b}{\text{a long blah blah blah}}+c
\end{equation}

\end{document}

The first line (plain \underbrace) tries to center the text under the brace, while the second version (taken from this question: Remove additional space around \underbrace{…}) puts the brace under the wrong symbol.

5
\newcommand{\undertab}[1]{\clap{%
  \scriptsize\begin{tabular}{@{}c@{}}#1\end{tabular}}}

\underbracewithoutspace{a+b}{\undertab{a long\\ blah\\ blah}}+c

I wouldn't look for justification in such narrow columns.

  • Thanks! What I'm after is not justification per se, it's correct positioning of the text/formula under the brace if it's longer than what's above it. As a more minor issue: is there a way of aligning what's above the brace with what's below it? In this example, I'm after aligning the a in the 'a long ' with the a in the formula. – Zhenya Sep 22 '11 at 19:26

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.