28

When I combine adaptive parentheses (\left(, \right)) with \underbrace, the parentheses adapt to span the underbrace. Example:

\left(\underbrace{e_{s,i,j}}_{\mathclap{=:x>0}} + \underbrace{e_{t,i,j}}_{\mathclap{=:y>0}}\right)

Is it possible to restrict the parentheses' height to the formula with*out* the underbraces? Moving the underbrace outside the parentheses is not an option because I may need to underbrace several and partial elements inside. Thanks!

EDIT: I helped myself now by using \bigg( instead of \left(, i.e. manually setting the size of the paranthesis. Solves my current problem but doesn't really answer the general question, does it?

4 Answers 4

20

I would suggest using a combination of \vphantom{<stuff>} (for correct vertical spacing) and breaking up the expression into three separate components to correct for the extensible brackets. For example, the following shows the difference between your attempt and using the above combination:

\documentclass{article}
% These definitions are taken from Herbert Voss' Mathmode document,
% available online via CTAN from: http://www.ctan.org/pkg/voss-mathmode
\def\mathllap{\mathpalette\mathllapinternal}
\def\mathllapinternal#1#2{%
\llap{$\mathsurround=0pt#1{#2}$}% $
}
\def\clap#1{\hbox to 0pt{\hss#1\hss}}
\def\mathclap{\mathpalette\mathclapinternal}
\def\mathclapinternal#1#2{%
\clap{$\mathsurround=0pt#1{#2}$}%
}
\def\mathrlap{\mathpalette\mathrlapinternal}
\def\mathrlapinternal#1#2{%
\rlap{$\mathsurround=0pt#1{#2}$}% $
}
\begin{document}
Here is some text.
\[
  \left(\underbrace{e_{s,i,j}}_{\mathclap{=:x>0}}+\underbrace{e_{t,i,j}}_{\mathclap{=:y>0}}\right)
\]
Here is some more text.
\[
  \left(\vphantom{e_{s,i,j}e_{t,i,j}}\right.% Left bracket
  \underbrace{e_{s,i,j}}_{\mathclap{=:x>0}}+\underbrace{e_{t,i,j}}_{\mathclap{=:y>0}}%
  \left.\vphantom{e_{s,i,j}e_{t,i,j}}\right)% Right bracket
\]
Here is some more text.
\end{document}​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​

This is what it looks like:

Mathmode spacing

You may have to fiddle around with the spacing of the brackets to suit your preference, using math spacing or \mathllap and \mathrlap.

1
8

I prefer \smash[b]:

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

\begin{document}
Here could be text.
\[
\left(2,\smash[b]{\underbrace{\frac{5}{3}}_{\mathclap{\approx 1.66666667}}} \right)
\vphantom{\underbrace{\frac{5}{3}}_{\approx 1.66666667}}
\]
Here could be more text.

\end{document}

because it would also work together with \DeclarePairedDelimiter (see https://tex.stackexchange.com/a/435707/128042):

\documentclass{article}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{mathtools}
\usepackage{hyperref}
\DeclarePairedDelimiter{\norm}{\|}{\|_{\href{https://de.wikipedia.org/wiki/Euklidische_Norm\#\%E2\%84\%932-Norm}{\ell_2(\mathbb{R}^2)}}}
\begin{document}
Here could be text. 
\[
\norm*{\left(2,\smash[b]{\underbrace{\frac{5}{3}}_{\mathclap{\approx 1.66666667}}} \right)}
\vphantom{\underbrace{\frac{5}{3}}_{\approx 1.66666667}}
\]
Here could be more text.

\end{document}

compiled result

\smash[b] is especially useful, if you have more complicated delimiters defined in the preamble like colored or linked delimiters (see https://tex.stackexchange.com/a/360871/128042)

A short description of \DeclarePairedDelimiter can be found here: Easily change behavior of \DeclarePairedDelimiter

A detailed description of \smash[b] here: https://tex.stackexchange.com/a/424204/128042

4
\documentclass{article}
\usepackage{mathtools}

\begin{document}

\[ \big(\underbrace{e_{s,i,j}}_{\mathclap{=:x>0}} +   
        \underbrace{e_{t,i,j}}_{\mathclap{=:y>0}}\big) \]

\end{document}​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​

enter image description here

1
  • 2
    Thanks. That's what I ended up doing as a first fix, but it doesn't scale (I have several of such spots and I don't want to pick the right size of brackets each time)
    – Nicolas78
    Jul 17, 2011 at 21:43
0

I would not recommend my answer, which is quite verbose, not very handy, and probably not bullet proof, but it is interesting enough to share hopefully.

The idea is to create the annotations outside the \left ( \right ) brackets, then to move them horizontally using the \hphantom macro. The \mathclap macro forces the annotations to overlap the annotated content.

You can use \hphantom{\hspace{...px}} for positionning, but using the annotated content is more accurate. However, using the annotated content can be tricky, and it's not easy to understand how to work with it. For example, try to understand why I have to use \vphantom here:

% search for this comment in the code below
\left ( \vphantom{ \delta } k \right  )

You will probably think of it for a couple of minutes. I'm sorry but I'm afraid my english is not good enough to try an explanation...

Here is a demo (tested with Stackedit v5.14.10). The only required macros are \freeunderset, freeoverbrace, the remaining is for fun or readability. Enjoy!

% required macros
\def\freeundersetstar#1#2#3{
  \mathclap{ \underset{ #2 }{ #1 } \hphantom{ #3 } }
}
\def\freeundersetnostar#1#2#3{
  \mathclap{ \underset{ #2 }{ \phantom{ #1 } } \hphantom{ #3 } }
}
\def\freeunderset#1#2#3{
  \@ifstar
  { \freeundersetstar{#1}{#2}{#3} } % debug macro
  { \freeundersetnostar{#1}{#2}{#3} } % actual macro
}
\def\freeoverbracestar#1#2#3{
  \mathclap{ \overbrace{ #1 }^{ \substack{ #2 } } \hphantom{ #3 } }
}
\def\freeoverbracenostar#1#2#3{
  \mathclap{ \overbrace{ \phantom{ #1 } }^{ \substack{ #2 } } \hphantom{ #3 } }
}
\def\freeoverbrace#1#2#3{
  \@ifstar
  { \freeoverbracestar{#1}{#2}{#3} } % debug macro
  { \freeoverbracenostar{#1}{#2}{#3} } % actual macro
}
% extra macros for fun
\def\0#1{}
\def\1#1{#1}
\def\2#1{#1\1{#1}}
\def\3#1{#1\2{#1}}
\def\+#1#2#3{#1{#3}#2{#3}}
\def\*#1#2#3{#1{#2{#3}}}
\def\hereup#1#2{ \substack{ \uparrow #1{ \\[-.5px]| } \\[2px] #2 } }
\def\heredown#1#2{ \substack{ #2 \\[1px] #1{ |\\[-.5px] } \downarrow } }
% extra macros for readability
\def\d{
  \mathrm d
}
\def\delta{
  \frac{ b - a }{ n }
}
\def\intdef{
  \int_a^b f( x ) \d x
  = \lim_{ n \to +\infty }
  \delta \sum_{ k = 0 }^{ n - 1 }
  f \left ( a + \delta k \right )
}
% experiment
\text{ experiment } \\
\boxed{
  \intdef
  \! % extra space fix
  \red{
    \freeunderset { k }
    { \hereup{ \1 }{ \text{ a tiny } \\ \text{ step } } }
    % search for this comment in the code below
    { \left ( \vphantom{ \delta } k \right  ) }
    %* % uncomment to reveal #1
  }
  \red{
    \freeoverbrace { \delta }
    { \text{ a tiny distance } \\ \text{ called $\scriptsize \d x$ } }
    { \left ( k \delta k \right  ) }
    %* % uncomment to reveal #1
  }
}
% control
\\[.25em]
\boxed{ \intdef } \\
\text{ control }

You must log in to answer this question.

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