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}
\bigl(and\bigr). AFAIK, there are no automatically calculating algorithms other than\leftand\right. What you see there are the drawbacks of such algorithms. About consistency: you should always get the parenthesis which looks right. There's not a consistency issue imo. – Moriambar Apr 13 '17 at 20:12leftandrightcalculate the sizes by creating a subformula, around which they wrap (as far as I understand). Unfortunately, the subformula includes all of the sub elements (how is LaTeX gonna know if something is too high or too low to be comprised in parentheses?) This yields unwanted results, such as the limits of a sum to be comprised by the parentheses, which in turn make the parentheses too big – Moriambar Apr 13 '17 at 21:20\left(and\right)are not satisfactory. – Troy Apr 14 '17 at 06:51\documentclass{article} \usepackage{scalerel,stackengine} \stackMath \ignoremathstyle \newcommand\Comp[1]{\scaleleftright{(}{\addstackgap[1pt]{#1}}{)}} \begin{document} $f\Comp{g(x)}$ \[ p\Comp{ q\Comp{ \displaystyle\frac{x}{y}\Comp{g\Comp{h(x)} } } } \] \end{document}– Steven B. Segletes Apr 14 '17 at 16:39