# Extra horizontal space when using \Big[ and \Big] instead of \left[ and \right]

I have the following equation

\sum_{k=0}^{N-1} \left\{ \tr \left[ Q^{-1} \left( P_{k+1}^N - A P_{k,k+1}^N - P_{k+1,k}^N A' + A P_k^N A' \right) \right] + \tr \left[ \left( x_{k+1}^N - A x_k^N \right)' Q^{-1} \left( x_{k+1}^N - A x_k^N \right) \right] \right\}


I don't like that the brackets around the two traces are different sizes. No big deal, I can use \Big[ and \Big] instead of \left[ and \right] for that part of the equation:

\sum_{k=0}^{N-1} \left\{ \tr \Big[ Q^{-1} \left( P_{k+1}^N - A P_{k,k+1}^N - P_{k+1,k}^N A' + A P_k^N A' \right) \Big] + \tr \left[ \left( x_{k+1}^N - A x_k^N \right)' Q^{-1} \left( x_{k+1}^N - A x_k^N \right) \right] \right\}


However LaTeX adds extra horizontal space to the left of that first right bracket. What I want is something like

\sum_{k=0}^{N-1} \left\{ \tr \Big[ Q^{-1} \left( P_{k+1}^N - A P_{k,k+1}^N - P_{k+1,k}^N A' + A P_k^N A' \right) \!\Big] + \tr \left[ \left( x_{k+1}^N - A x_k^N \right)' Q^{-1} \left( x_{k+1}^N - A x_k^N \right) \right] \right\}


where I have added a \! to back it up a little bit and match the spacing on the right bracket at the end of the equation. Clearly this is an inelegant solution; is there a better way to get the spacing I want?

• How do you define \tr? – egreg May 31 '16 at 22:47
• \newcommand{\tr}{\text{tr}} Sorry I left that out, it is a potentially important detail I guess – teerav42 May 31 '16 at 22:48
• The space is created by the inner \left and \right, which serve no purpose whatsoever. – egreg May 31 '16 at 22:50
• Are you referring to the inner \left( and \right)? Because those do serve a purpose. They change the size of those parentheses. It's quite a small difference, but it is there. – teerav42 May 31 '16 at 22:57
• Just replace \Big] with \Bigr]. – Bernard May 31 '16 at 23:26

Don't rely on \left and \right in cases like these: they don't always give the expected result, as you experienced, and they add extra horizontal space, which is the cause of what you see.

The braces and the brackets don't need to be so big as in the picture; the inner parentheses can just be at normal size.

\documentclass{article}

\usepackage{amsmath}

\DeclareMathOperator{\tr}{tr} % this is the correct way

\begin{document}

$\sum_{k=0}^{N-1} \bigl\{ \tr \bigl[ Q^{-1} ( P_{k+1}^N - A P_{k,k+1}^N - P_{k+1,k}^N A' + A P_k^N A' ) \bigr] + \tr \bigl[ ( x_{k+1}^N - A x_k^N )' Q^{-1} ( x_{k+1}^N - A x_k^N ) \bigr] \bigr\}$

\end{document}


You might want to split such a long formula:

\documentclass{article}

\usepackage{amsmath}

\DeclareMathOperator{\tr}{tr} % this is the correct way

\begin{document}

\begin{multline*}
\sum_{k=0}^{N-1} \bigl\{
\tr \bigl[ Q^{-1} ( P_{k+1}^N - A P_{k,k+1}^N - P_{k+1,k}^N A' + A P_k^N A' ) \bigr]
\\
+ \tr \bigl[ ( x_{k+1}^N - A x_k^N )' Q^{-1} ( x_{k+1}^N - A x_k^N ) \bigr] \bigr\}
\end{multline*}

\end{document}


• Thank you, this is very helpful. I am curious why you say that the brackets, braces, and parentheses don't need to be as big as I had them in my example. It seems to me that this is a stylistic preference. Is there a particular reason why having them smaller is better, or is that just more common/more widely used and accepted? – teerav42 May 31 '16 at 23:20
• @teerav42 The subject is, partly, a stylistic decision; however, a criterion to keep in mind is that delimiters are not required to fully cover the material between them. The smaller, the better. – egreg Jun 1 '16 at 5:53

Generally, you will get better spacing if you use \bigl, \bigr, \Bigl, \Bigr etc. Compare the last example to your three versions.

\documentclass{article}
\addtolength\textwidth{100pt}  % or else equations don't fit on the page
\usepackage{amsmath}
\DeclareMathOperator\tr{tr}
\begin{document}
$\sum_{k=0}^{N-1} \left\{ \tr \left[ Q^{-1} \left( P_{k+1}^N - A P_{k,k+1}^N - P_{k+1,k}^N A' + A P_k^N A' \right) \right] + \tr \left[ \left( x_{k+1}^N - A x_k^N \right)' Q^{-1} \left( x_{k+1}^N - A x_k^N \right) \right] \right\}$
$\sum_{k=0}^{N-1} \left\{ \tr \Big[ Q^{-1} \left( P_{k+1}^N - A P_{k,k+1}^N - P_{k+1,k}^N A' + A P_k^N A' \right) \Big] + \tr \left[ \left( x_{k+1}^N - A x_k^N \right)' Q^{-1} \left( x_{k+1}^N - A x_k^N \right) \right] \right\}$
$\sum_{k=0}^{N-1} \left\{ \tr \Big[ Q^{-1} \left( P_{k+1}^N - A P_{k,k+1}^N - P_{k+1,k}^N A' + A P_k^N A' \right) \!\Big] + \tr \left[ \left( x_{k+1}^N - A x_k^N \right)' Q^{-1} \left( x_{k+1}^N - A x_k^N \right) \right] \right\}$
$\sum_{k=0}^{N-1} \Bigl\{ \tr \Bigl[ Q^{-1} \bigl( P_{k+1}^N - A P_{k,k+1}^N - P_{k+1,k}^N A' + A P_k^N A' \bigr) \Bigr] + \tr \Bigl[ \bigl( x_{k+1}^N - A x_k^N \bigr)' Q^{-1} \bigl( x_{k+1}^N - A x_k^N \bigr) \Bigr] \Bigr\}$
\end{document}