# Trouble with the size of parentheses and spacing in an align environment when using the mleftright package

I am having some trouble with the mleftright package. For a particular math paper that I am working on, I created a macro that would allow me to write functional notations whose parentheses automatically adjust to the height of an argument. The macro that I used is

\newcommand{\func}[2]{#1 \mleft( #2 \mright)}

I used the mleftright package because of its touted advantages with spacing. Now, when I write $$\func{q}{f^{\flat}}$$, the parentheses surrounding the argument are way too large (this does not occur for in-line displays $...$). Writing $$\func{q}{f^{\sharp}}$$ does not produce any problems. I know that the flat symbol is a little taller than the sharp symbol, but this does not warrant the use of extra large parentheses to accommodate it as an argument in which it appears in superscript form.

Another problem is the behavior of mleftright in an align environment. For example, when running the following MWE

\documentclass[letter,10pt]{amsart}
\usepackage{mleftright}

\begin{document}

Observe that we have
\begin{align*}
F
&= G \\
&= \mleft[ e^{f^{g}} \cdot H \mright] \cdot J \\
&= K.
\end{align*}

\end{document}


I see an extra space separating the left square bracket from the equal sign. This is due to the fact that e^{f^{g}} has a tall output.

Now, I know that these problems also occur with \left[ and \right] and are not specific to the mleftright package, but could someone kindly propose a fix so that I can continue using the package, which has worked well for me up till now?

Thank you so much for your help! I appreciate it!

• The problem is in the shape of the bigger [; in this case, just \bigl[ and \bigr] are sufficient. The size provided by \left and \right is excessive. – egreg Feb 17 '16 at 21:36

The larger brackets have a wider sidebearing; you may want to correct it manually in such cases, but before attempting this, you should try using smaller brackets.

I show four instances, the second of which is what I'd use.

\documentclass[letterpaper,10pt]{amsart}
\usepackage{mleftright}

\usepackage{xcolor} % for the test
\newcommand{\myrule}{\smash{\color{red}\kern-0.1pt\vrule height 1cm depth 4cm width 0.1pt}}

\begin{document}

Observe that we have
\begin{align*}
F
&= \myrule G \\
&= [ e^{f^{g}} \cdot H ] \cdot J \\
&= [ e^{f^{g}} \cdot H\, ] \cdot J \\
&= \bigl[ e^{f^{g}} \cdot H \bigr] \cdot J \\
&= \mleft[ e^{f^{g}} \cdot H \mright] \cdot J \\
&= K.
\end{align*}

\end{document}


Manual correction would be with \! as in the code below

\documentclass[letterpaper,10pt]{amsart}
\usepackage{mleftright}

\usepackage{xcolor} % for the test
\newcommand{\myrule}{\smash{\color{red}\kern-0.1pt\vrule height 1cm depth 4cm width 0.1pt}}

\begin{document}

Observe that we have
\begin{align*}
F
&= \myrule G \\
&= [ e^{f^{g}} \cdot H ] \cdot J \\
&= [ e^{f^{g}} \cdot H\, ] \cdot J \\
&= \!\bigl[ e^{f^{g}} \cdot H \bigr] \cdot J \\
&= \!\mleft[ e^{f^{g}} \cdot H \mright] \cdot J \\
&= K.
\end{align*}

\end{document}


Here's a comparison of the bounding boxes of the brackets at various sizes (normal, \bigl, \Bigl, \biggl an \Biggl):