54

How can I get an expectation symbol which behaves like $\sum$? Specifically, I want the underscore to be like that of a summation. At the moment I use

$$\mathbb{E}_{x\in A}$$ 

However, I do not like this. It feels like I am writing a sum as

$$\Sigma_{x\in A}$$ 

Whereas the alternative

$$\sum_{x\in A}$$

is much nicer when in a centered equation. (The underscore appears directly below the sigma, instead of slight infront and below.)

Is there a way to make an expectation symbol which behaves like $$\sum$$ rather then $$\Sigma$$?

Werner
  • 603,163
EPN
  • 662

2 Answers2

65

Use \mathop{\mathbb{E}} to get math operator spacing and limits behaviour. Or \mathop{{}\mathbb{E}} If you want E to remain on the baseline.

David Carlisle
  • 757,742
42

If you want "limits" of this operator, e.g., x\in A, always to be typeset as a "subscript" (to the right and below the "E") rather than entirely below the "E" when in display math mode, you may want to use the \DeclareMathOperator instruction that is made available by loading the amsmath or amsopn packages.

Aside: The \mathop directive, in contrast, will make its argument behave exactly like \sum or \prod, in the sense that subscript and superscript arguments will be typeset fully below or above the operator when the directive is processed in display-math mode. Do check out @DavidCarlisle's answer for an application of the \mathop directive to your case.

\documentclass{article}
\usepackage{amsmath,amssymb}
\DeclareMathOperator{\E}{\mathbb{E}}
\begin{document}
$\E_{x\in A}$ and $\displaystyle \E_{x\in A}$
vs.\ $\displaystyle \mathop{\mathbb{E}}_{x\in A}$
\end{document}

enter image description here

Conversely, if you do want the x\in A particle to be typeset entirely below the operator when TeX is in display-math mode, you could use the instruction \DeclareMathOperator* (note the *) instead: \DeclareMathOperator*{\E}{\mathbb{E}}.

Mico
  • 506,678