# In exponents, parenthesis too small, \big too big

When something big (a fraction, a sum, an integral...) appears within a pair of parenthesis, one can typically use \left(...\right) to get delimiters large enough to surround the contents. The delimiters are actually often too large: then \bigl(...\bigr), \Bigl(...\Bigr), \biggl(...\biggr), and \Biggl(...\Biggr) are useful. Those delimiters, unfortunately, do not scale when appearing in \scriptsize (in exponents and the like). In that context, a simple (...) may be too small, \left(...\right) too large, and \bigl(...\bigr) too large as well (first three lines below). I tried using \displaystyle to get delimiters of an intermediate size, but I find even that too big (fourth line). What code should I use to get delimiters of a correct size?

The figure is generated by the following code (plus some cropping).

\documentclass{article}
\usepackage{amsmath}
\begin{document}
$x^{\sum_{i=1}^{N} (\frac{a_i + 1}{2b_i} + c_i)}$% too small
$x^{\sum_{i=1}^{N} \left(\frac{a_i + 1}{2b_i} + c_i\right)}$% too big
$x^{\sum_{i=1}^{N} \bigl(\frac{a_i + 1}{2b_i} + c_i\bigr)}$% too big
\newcommand{\normall}[1]{\mathopen{\displaystyle#1}}%
\newcommand{\normalr}[1]{\mathclose{\displaystyle#1}}%
$x^{\sum_{i=1}^{N} \normall(\frac{a_i + 1}{2b_i} + c_i\normalr)}$% a bit big
\end{document}

-
I had to add \Huge  to my MWE to produce the image big enough, but that made the last pair of parentheses be of a good size. Is there a way to make the website rescale graphics when including them, so that the ratios would remain constant? – Bruno Le Floch Dec 18 '12 at 8:35
I usually scale and crop by hand in a bitmap editor before uploading – David Carlisle Dec 18 '12 at 9:17
In this example, consider defining $m$ as that expression and writing $x^m$. Even with the right-size parenthesis, the whole expression is too complicated to read. – lhf Dec 18 '12 at 11:10
@lhf I beg to disagree. In practice, this x^... is just a small part of the expressions I need to manipulate. Those expression depend on multiple parameters, and giving names to the many parts of the expressions only scatters the understanding of what is going on, and in particular makes it harder to detect how the expressions depend on the various parameters. Admittedly, if the expression was just this, I would probably give a name to (a_i + 1) / (2b_i) + c_i. – Bruno Le Floch Dec 18 '12 at 13:58

This is a version of \big that's a bit smaller at 10pt size, but scales with em and with \scriptsize.

\documentclass{article}

%\def\big#1{{\hbox{$\left#1\vbox to8.5\p@{}\right.\n@space$}}}
%\def\bigl{\mathopen\big}
%\def\bigr{\mathclose\big}

\makeatletter
\def\myl{\mathopen\mybig}
\def\myr{\mathclose\mybig}
\def\mybigx#1{\dimen@#1\relax
\mathchoice
{\vbox to \dimen@{}}%
{\vbox to \dimen@{}}%
{\vbox to .7\dimen@{}}%
{\vbox to .5\dimen@{}}}%

\def\mybig#1{{\hbox{$\left#1\mybigx{.8em}\right.\n@space$}}}
\makeatother
\begin{document}

$x^{\sum_{i=1}^{N} \myl(\frac{a_i + 1}{2b_i} + c_i\myr)}$

$\textstyle x^{\sum_{i=1}^{N} \myl(\frac{a_i + 1}{2b_i} + c_i\myr)}$

$\scriptstyle x^{\sum_{i=1}^{N} \myl(\frac{a_i + 1}{2b_i} + c_i\myr)}$

$\scriptscriptstyle x^{\sum_{i=1}^{N} \myl(\frac{a_i + 1}{2b_i} + c_i\myr)}$

\end{document}

-

Following David Carlisle idea of making \big etc scale when appearing in indices or exponents, I redefine \bBigg@ of amsmath to use \mathchoice. The dimension \big@size controls the size of \big delimiters (then \Big is 1.5 times bigger, \bigg twice as big, and \Bigg 2.5 times). The factors .7 and .5 for script size and script script size come from David's answer. It may be better to derive the size of \big from the size of a single (, I don't know.

\documentclass{article}
\usepackage{amsmath}
\makeatletter
\let\bBigg@@\bBigg@
\renewcommand{\bBigg@}[2]{{%
\mathchoice
{\bBigg@@{#1}{#2}}%
{\bBigg@@{#1}{#2}}%
{\big@size=.7\big@size\bBigg@@{#1}{#2}}%
{\big@size=.5\big@size\bBigg@@{#1}{#2}}}}%
\makeatother
\begin{document}
$x^{\sum_{i=1}^{N} (\frac{a_i + 1}{2b_i} + c_i)}$
$x^{\sum_{i=1}^{N} \bigl(\frac{a_i + 1}{2b_i} + c_i\bigr)}$
$x^{\sum_{i=1}^{N} \Bigl(\frac{a_i + 1}{2b_i} + c_i\Bigr)}$
$x^{\sum_{i=1}^{N} \left(\frac{a_i + 1}{2b_i} + c_i\right)}$
\end{document}


With this code, the delimiters (, \big(, \Big( have the same proportions relative whether appearing in normal \textstyle or in exponents/indices.

-
The .7 and .5 are because LaTeX by default does \DeclareMathSizes{\@xpt}{\@xpt}{7}{5} so at 10pt a notional 7pt font is used for scripts and a notional 5pt font used for scriptscripts (of course actual size depends on fd files for the fonts, and the fonts themselves) Rather than hard coding those multipliers you could get the values from the NFSS data so at 5pt you stay at 5pt not shrimk to 2.5 , fontmath.ltx has \DeclareMathSizes{5}{5}{5}{5} – David Carlisle Dec 18 '12 at 15:17
@DavidCarlisle It might be easier to do \setbox0\hbox{$($}\setbox2\hbox{$\scriptstyle($}\big@size\dimexpr\big@size*(\ht‌​2+\dp2)/(\ht0+\dp0)\relax than muck around with NFSS data. – Bruno Le Floch Dec 18 '12 at 15:36
delving into NFSS data structures is more fun though:-) and I know it's quick these days but measuring a bracket every time seems somehow wrong. – David Carlisle Dec 18 '12 at 16:08
@BrunoLeFloch, I'm trying out your solution, but I don't observe that the delimiters have the same proportion as in \textstyle as you mention (even with the measuring suggested in the comment) - the brackets are still too big. After trying smaller values than 0.7 and 0.5 and observing no effect, I asked tex.stackexchange.com/q/150355 - since the response was not what I'm looking for, I started again from your answer. Experimenting again, the numbers do have an effect if made bigger, but I seem to encounter a lower bound when making them smaller. Maybe you have an idea? Thanks. – Axel Dec 18 '13 at 21:13