Expectation in LaTeX (\mathbb{E})
- LaTeX command
\mathbb{E}- Package
- Add to your preamble:
\usepackage{amssymb} - Mode
- Math mode only
- Copy the Unicode character
- 𝔼
U+1D53C
Where it is used
Blackboard bold E, the standard notation for expected value of a random variable.
Expectation appears everywhere in probability and machine learning: \mathbb{E}[X] = \sum_x x\,p(x), the risk \mathbb{E}_{(x,y)\sim\mathcal{D}}[\ell(f(x),y)], or variance as \mathbb{E}[X^2] - \mathbb{E}[X]^2. Put the distribution in a subscript to make the source of randomness explicit. Older texts use a plain roman E or \operatorname{E}; both are fine if used consistently. Note that \mathbb only provides uppercase letters, so \mathbb{e} gives garbage. Use square brackets for the argument and \left[ \right] when it contains tall fractions. Defining a macro such as \newcommand{\E}{\mathbb{E}} keeps notation uniform.
Minimal compilable example
Paste this into an empty .tex file and compile it with pdfLaTeX, XeLaTeX or LuaLaTeX.
\documentclass{article}
\usepackage{amssymb}
\begin{document}
Expectation: $\mathbb{E}$
\[ \mathbb{E}_{x \sim p}[f(x)] = \int f(x)\, p(x)\, dx \]
\end{document}Related symbols
- Expectation
\mathbb{E}[X] - Calligraphic L (Lagrangian)
\mathcal{L} - KL Divergence
D_{\text{KL}}(P \| Q) - KL divergence (short form)
\text{KL}(P \| Q) - Argmax
\arg\max - Argmin
\arg\min
Frequently asked questions
- How do I write Expectation in LaTeX?
- Type \mathbb{E} in math mode, for example $\mathbb{E}_{x \sim p}[f(x)] = \int f(x)\, p(x)\, dx$. Load amssymb first with \usepackage{amssymb}.
- Which package do I need for \mathbb{E}?
- \mathbb{E} needs amssymb: add \usepackage{amssymb} to your preamble before the document starts.
- Can I use \mathbb{E} in text mode, or only in math mode?
- Only in math mode. Outside $...$ LaTeX stops with "Missing $ inserted", so write $\mathbb{E}$ in running text. If you only need the glyph in text, paste the Unicode character 𝔼 instead (with XeLaTeX or LuaLaTeX and a font that has it).
최고의 AI LaTeX 편집기, Overleaf 대안
Octree는 15개 이상의 대학의 연구자들이 AI를 사용하여 논문을 더 빠르게 작성하도록 도움
- AI로 아름다운 TikZ 다이어그램 생성
- 이미지를 업로드하고 LaTeX로 원활하게 변환
- 논문 작성 및 서식에 대한 즉각적인 지원 받기