# Parenthesis size and white space in equation with long subscripts

I'm writing an equation which contains a relatively long subscritps under a summation, which is just next to a bracket. The code is the following

$$\mu_j=\E(X_j)=\E\left( \sum_{i\in Pa(X_j)}\lambda_{ij}X_i+W_j\right) =\sum_{i\in Pa(X_j)}\lambda_{ij}\mu_i+v_j.$$


With the commands \left, \right the brackets are too big and also there is too much with space between the beginning of the expression and the end of the summation. I've tried to use commands as \mathclap, \mathrlap together with \Biggl and similar in order to have a better looking equation, but I hadn't any satisfactory result. The problem is also that with these commands the alignment of the whole equation seems to decrease. Have you got any suggestions?

• Please always post complete (but small) documents (MWE). In this case your equation includes undefined commands \E so we can't run it, and if course the expression depends on its definition, similarly we can not see the page size you are using. – David Carlisle May 20 '12 at 0:04
• – Werner May 20 '12 at 0:35

If you swap the terms inside the brackets, the brackets are less of an obstacle:

\documentclass{article}
\usepackage{mathtools}% http://ctan.org/pkg/mathtools
\usepackage{amssymb}% http://ctan.org/pkg/amssymb
\newcommand{\E}{\mathbb{E}}% Requires amssymb
\begin{document}
$\mu_j=\E(X_j)=\E\bigg( W_j+\,\,\sum_{\mathclap{i\in Pa(X_j)}}\lambda_{ij}X_i\bigg) =\,\,\sum_{\mathclap{i\in Pa(X_j)}}\lambda_{ij}\mu_i+v_j.$
\end{document}

• Please note that \bigg( and \biggl( are different: the former builds an ordinary math atom, the latter an opening atom, which is what you want here. Of course it should also be \biggr). – egreg May 20 '12 at 10:37

Instead of trying to stack every information under the summation symbol, you can put extra information separately. Actually I suggest to put only the index over which the summation is carried out, under the symbol. I have put three versions one below the other for comparison:

\documentclass{article}
\usepackage{amsmath,amssymb}
\newcommand{\E}{\mathbb{E}}% Requires amssymb

\begin{document}

$\mu_j=\E(X_j)=\E\left( \sum_{i\in Pa(X_j)}\lambda_{ij}X_i+W_j\right) =\sum_{i\in Pa(X_j)}\lambda_{ij}\mu_i+v_j$

Leave only the index of summation and put  more details at the end:
$\mu_j=\E(X_j)=\E\bigg( \sum_{i}\lambda_{ij}X_i+W_j\bigg) =\sum_{i}\lambda_{ij}\mu_i+v_j, \qquad \text{where }\ i\in \underline{{Pa}}(X_{j})$
\end{document}


This will make the equation more readable IMHO.

• I really like the last idea you propose. Thank you very much – Manuele May 20 '12 at 9:44
• I don't like \forall in that context, maybe \text{where $i\in\mathit{Pa}(X_{j})$}. But I'd like to underline the \mathit{Pa} bit, which should be used for "multiletter identifiers" such as this one. – egreg May 20 '12 at 10:42
• @egreg: Pl. see the edit. Is that what you were indicating? – user11232 May 20 '12 at 13:24
• Yes, but I wouldn't use underlining. – egreg May 20 '12 at 13:27
• In your first code there's a spurious opening brace (you wrote \{ just before \hbox) that appears in the lower limit of the first sum. – Gonzalo Medina May 20 '12 at 17:11

Tricky to make it look good, perhaps

\documentclass{article}
\usepackage{amssymb}
\begin{document}
$\mu_j= E(X_j)=E\Bigl(\,\,\sum_{\hbox to 0pt{\hss\scriptstyle i\in Pa(X_j)\hss}}\lambda_{ij}X_i+W_j\Bigr)= \,\,\sum_{\hbox to 0pt{\hss\scriptstyle i\in Pa(X_j)\hss}}\lambda_{ij}\mu_i+v_j.$

\end{document}


• ah will fix the \{ sorry. Yes I meant to comment that the second sum would need to match, will fix that as well. – David Carlisle May 20 '12 at 10:25
• @GonzaloMedina thanks, I think I did upload an image again, perhaps I uploaded the old one:-( – David Carlisle May 20 '12 at 17:58