10

When typesetting expressions with multiple adjacent parentheses, I like to use \bigl and \bigr on the outermost parentheses to make it easier to read, especially with 3 or more parentheses in a row. Unfortunately, this doesn't work in sub/superscripts: the resulting parentheses are huge (relative to the enclosed text) instead of slightly bigger than normal. Is there a substitute for \bigl and \bigr which can be used in this case?

The simplest example of the kind of thing I use this for is \bigl(f(x) + g(x)\bigr). In particular, \left and \right aren't really what I'm looking for.

5
  • 1
    Please provide an example of a formula that features \big fences.
    – Mico
    Commented Mar 24, 2015 at 23:59
  • 2
    That's something I commented a few days ago, I think those commands should be defined with \mathpalette to use a \scriptstyle font when necessary (the benefit is not great in this case, though).
    – Manuel
    Commented Mar 25, 2015 at 0:14
  • 1
    Personally, I wouldn't bother; to be honest, I wouldn't use \bigl and \bigr for that formula even at text size. With three fences in sequence, I'd probably have the outermost slightly bigger; but having three consecutive fences in a superscript is a “don't do it”.
    – egreg
    Commented Mar 25, 2015 at 8:08
  • Anyway, the question is interesting, but the answer would require big surgery on amsmath.
    – egreg
    Commented Mar 25, 2015 at 8:14
  • @egreg It is true, there is usually a way to avoid huge expressions in subscripts. Commented Mar 25, 2015 at 13:12

2 Answers 2

5

This is a halfway answer, because it only takes care of the font used in subscripts, not of the height the delimiters have to cope with.

\documentclass{scrartcl}
\usepackage{mathtools,lmodern}

\makeatletter
\def\bBigg@#1#2{{\mathpalette{\bBigg@aux{#1}{#2}}\relax}}
\def\bBigg@aux#1#2#3%
  {\@mathmeasure\z@{\nulldelimiterspace\z@}%
     {#3\left#2\vcenter to#1\big@size{}\right.}%
   \box\z@}
\makeatother


\begin{document}

\[
  x^{\bigl(f(x) + g(x)\bigr)}
\]

\end{document}

enter image description here

(I hope I did it right.)

EDIT

Here's another idea which also scales the height down when in a sub- or superscript so the parenthesis are not that big. Still, this is a messy answer (I just looked at the definition and changed a bit of things).

With this code

\makeatletter
\def\bBigg@#1#2{{\mathpalette{\bBigg@aux{#1}{#2}}\relax}}
\def\bBigg@aux#1#2#3%
  {\@mathmeasure\z@{\nulldelimiterspace\z@}%
     {#3%
       \setlength\dimen@{\dimexpr#1\big@size
         \ifx\scriptscriptstyle#3*26/50\fi
         \ifx\scriptstyle#3*34/50\fi
        \relax}
       \left#2\vcenter to\dimen@{}\right.}%
   \box\z@}
\makeatother

here's a comparison with \scriptstyle and \scriptscriptstyle with the original definition of \big.

enter image description here

2
  • I can't claim to understand this, but it appears to do what I'm looking for. Commented Mar 25, 2015 at 13:23
  • To readers who would like to understand a bit more: \bBigg@ was originally defined in amsmath. It puts the delimiter into a box to control the delimiter's size. However, in doing so, the state of being in superscript or subscript is lost. The use of \mathpalette solves this problem.
    – 54690
    Commented Aug 16, 2023 at 13:11
6

The \vstretch macro of the scalerel package is like a \scalebox{1}[]{}, except it works inside math mode and preserves the current math style. Thus, one can define \bigs, \bigrs, etc. to take advantage of this feature.

I have currently set the stretch values to 1.15 and 1.3, but you can change to suit. In the left \parbox, I show it operating automatically in \textstyle, \scriptstyle, as well as \scriptscriptstyle.

In the right \parbox, I use even bigger sizes, to demonstrate two things: 1) one can incorporate both \vstretch and \hstretch into the enlarged glyph; and 2) for double-height constructs, such as around a \frac, the size of the "big" might need to change depending on the math style, since the \frac itself changes the math style of its contents.

\documentclass{article}
\usepackage{scalerel}
\def\bigs#1{\vstretch{1.15}{#1}}
\def\bigrs#1{\vstretch{1.3}{#1}}
\def\biggs#1{\vstretch{1.45}{\mkern-1mu\hstretch{1.3}{#1}\mkern-1mu}}
\def\biggrs#1{\vstretch{1.6}{\mkern-1mu\hstretch{1.5}{#1}\mkern-1mu}}
\def\Biggrs#1{\vstretch{1.75}{\mkern-1mu\hstretch{1.6}{#1}\mkern-1mu}}
\begin{document}
\parbox[b]{1in}{\parskip 1ex
$x^{\bigrs(x + \bigs(x(x+3)\bigs)\bigrs)}$\par
      $\bigs(f(x) + g(x)\bigs)$ \par
   $x^{\bigs(f(x) + g(x)\bigs)}$ \par
$y_{x^{\bigs(f(x) + g(x)\bigs)}}$ \par
}
\parbox[b]{1in}{\parskip 1ex
$       \biggs(\frac{\bigs(f(x) + g(x)\bigs)}{2}\biggs)$ \par
$   x^{\biggrs(\frac{\bigs(f(x) + g(x)\bigs)}{2}\biggrs)}$ \par
$y_{x^{\Biggrs(\frac{\bigs(f(x) + g(x)\bigs)}{2}\Biggrs)}}$ \par
}
\end{document}

enter image description here

2
  • The problem I have with this answer is that a stretched normal parenthesis is not the same as a large parenthesis. This is particularly noticeable if you're using a delimiter like [, as after a vertical stretch the horizontal elements will be thicker than the vertical element. Commented Mar 25, 2015 at 13:14
  • 1
    @JanLadislavDussek I agree that it is not the perfect solution, as it is not "extension" in the true sense, but merely stretch. Brackets [ are the weak link here. With them, there is the option to scale, rather than stretch, but that is not ideal either, especially in the large sizes. Commented Mar 25, 2015 at 18:34

You must log in to answer this question.

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