Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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 
% http://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.

share|improve this question
add comment

1 Answer

up vote 5 down vote accepted
\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.

share|improve this answer
    
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
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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