\left[ and \right] resizing differently for very similar formulae. Don't know how to fix it.
The different height of the brackets is caused by the descender of the letter j
compared to i
.
One way: Use k
instead of j
(or any other letter without descender)
Or perhaps using \bigl[
and \bigr]
is an option (or if scaling isn't an issue \big[
and \big]
?)
\documentclass{article}
\usepackage{amsmath}
\newcommand{\foo}[1]{\bigl[#1\bigr]}
\begin{document}
Since $\foo{B} = \foo{\sum_j b_jB_j}$ and $\foo{C} = \foo{\sum_i c_i C_i}$ by definition.
\hrule
\end{document}
The \hrule
is just for comparison only. Certainly, there are other ways to achieve this.
Note: \big[
etc. works too, but the scaling is different. It's a matter of taste rather then a law.
A simple fix for these annoying little size mismatchs in otherwise similar formulas is to use \vphantom
:
Since $\foo{B} = \foo{\sum_j b_jB_j}$ and $\foo{C} = \foo{\sum_{i\vphantom{j}} c_{i\vphantom{j}} C_{i\vphantom{j}}}$ by definition.
One \vphantom
should be sufficient of course, in the present case, the one of the \sum
operator as its subscript is typeset lower than others.
Alternatively, if you'd rather have all of the same height, you can use \smash
on the j
subscripts, as suggested by WChargin in a comment. This is useful if the formula is in a multiline paragraph and you want to reduce the extra line spacing.
\documentclass{minimal}
\newcommand{\foo}[1]{\left[#1\right]}
\begin{document}
Since $\foo{B} = \foo{\sum_{\smash{j}} b_jB_j}$ and $\foo{C} = \foo{\sum_i c_i C_i}$ by definition.
\medskip
Since $\foo{B} = \foo{\sum_j b_jB_j}$ and $\foo{C} = \foo{\sum_{\vphantom{j}i} c_i C_i}$ by definition.
\end{document}
Another possible solution is having a minimum size automatically:
\documentclass{minimal}
\newcommand{\minsize}{\vrule width 0pt height 1.5ex depth 1ex\relax}
\newcommand{\foo}[1]{\left[\minsize #1\right]}
\begin{document}
Since $\foo{B} = \foo{\sum_j b_jB_j}$ and $\foo{C} = \foo{\sum_i c_i C_i}$
by definition.
Now it will scale up --- but not down: $\foo{B} = \foo{\sum\limits_\frac{j}{j} b_jB_j}$
\end{document}
...but then it will make the smaller ones too big:
You can adjust the minimum size playing with the height
and depth
parameters of the rule defined in \minsize
.