[Tex/LaTex] Automatic size parenthesis

bracketsmath-modespacing

I am writing a math paper and I have a lot of complicated expressions some with fractions or absolute values, some with normal symbols some with larger symbols etc. So when I use \left( or \right) for parenthesis, they are too big a lot of times (They have other issues of spacing as well which is handled in the mathtools package. But the size is still a problem).

Of course one way out is to manually enter \Big, \big etc. but this becomes problematic as then it is very difficult to be consistent across the document (For e.g. in one formula I use \Big and 20 pages later I use \bigg as I have completely forgotten that I used \Big earlier on).

So is there a way to write a macro that will check the size of the input and then put brackets as either (), \big( \big), \Big( \Big), \bigg( \bigg) or \Bigg( \Bigg)?. Any help would be appreciated!

Edit: See this code for a sample problem

\documentclass{amsart}
\usepackage{mathtools}

\DeclarePairedDelimiter\paren{\lparen}{\rparen}
\DeclarePairedDelimiter{\abs}{\lvert}{\rvert}

\begin{document}

The parentheses and absolute value are too big
\[
\int\abs*{\partial_{\alpha '}\frac{1}{Z_{\alpha '}}}^2 \text{ and } \int\paren*{\partial_{\alpha '}\frac{1}{Z_{\alpha '}}}^2
\]

compared to 
\[
\int\abs[\Big]{\partial_{\alpha '}\frac{1}{Z_{\alpha '}}}^2 \text{ and } \int\paren[\Big]{\partial_{\alpha '}\frac{1}{Z_{\alpha '}}}^2
\]

\end{document}

Best Answer

The (La)TeX way to typeset autoscaled delimiters is \left and \right. mathtools package provides the \DeclarePairedDelimiter command which corrects their spacing a bit, but still uses them in background

As detailed in Appendix G of the TeX book, there is no margin for the user to meddle with TeX way of handling the transformation of a mathematical list to a box, at least reagarding the boundaries.

I strongly recommend to use

  • \bigl, \biggl and similar command for left (i.e. Opening) delimiters
  • \bigr, \biggr and such for right (i.e. closing) delimiters

and manually scale them. Only this way you can guarantee an acceptable and good typographical look.

Please do not be concerned about consistency throughout your book: manually scaling the delimiters will yield the best in each case.