Getting Started
Text Formatting
Mathematical Expressions
Document Structure
Page Layout
Errors & Troubleshooting
\mathbb, \mathcal and \mathfrak: Special Math Alphabets in LaTeX
One preamble line covers all three: \usepackage{amssymb}. Strictly, \mathcal is built into LaTeX and only \mathbb and \mathfrak come from the AMS fonts — but nobody writes serious math without amssymb anyway, so load it and stop thinking about it.
Blackboard bold: the standard sets
The five symbols every paper needs at some point:
If you type these often, define shortcuts once — \newcommand{\R}{\mathbb{R}} and friends — and your source stays readable. Every long-lived preamble ends up with that block.
\mathbb is capitals-only
The AMS blackboard font contains A–Z and nothing else. \mathbb{k} does not give you a blackboard k for your field; depending on setup it prints a wrong glyph or errors out. Lowercase blackboard needs a different font:
The indicator function \mathbbm{1} is the case that sends everyone hunting for this. Probability people: it is bbm, not amssymb, and no amount of \mathbb{1} will produce it.
Calligraphic: \mathcal
\mathcal is the workhorse for sigma-algebras, categories, loss functions and general "fancy L" duty:
Also capitals-only. \mathcal{a} silently produces a wrong glyph from another slot of the font — not an error, just garbage in your PDF — which makes it nastier than the \mathbb failure because it can survive to publication.
Script: \mathscr, when \mathcal is not fancy enough
The mathrsfs package adds \mathscr, a more ornate script alphabet. Convention splits the fancy-L jobs: the Lagrangian and the Laplace transform traditionally take the \mathscr L, while loss functions and languages stay \mathcal:
Fraktur: \mathfrak
Fraktur is the standard alphabet for Lie algebras (lowercase: \mathfrak{g}, \mathfrak{sl}_2) and for ideals and cardinals in algebra and set theory. Unlike the other two, it has both cases:
Fraktur capitals are famously hard to tell apart in print — \mathfrak{A} and \mathfrak{U} routinely get confused by readers. If your notation is dense, favor the lowercase letters.
The three alphabets at a glance
| Command | Package | Case support | Typical use |
|---|---|---|---|
\mathbb | amssymb | Capitals only | Number sets, probability P and E |
\mathcal | built in | Capitals only | Sigma-algebras, big-O, distributions |
\mathscr | mathrsfs | Capitals only | Lagrangian, Laplace, sheaves |
\mathfrak | amssymb | Both cases | Lie algebras, ideals, cardinals |
\mathbbm | bbm | Both + digits | Indicator function 𝟙 |
In section headings: the bold-math trap
Put $\mathcal{L}$ in a \section title and the heading font goes bold but the math does not — bold blackboard and calligraphic fonts mostly do not exist, so the symbol sits there in regular weight looking wrong. Two honest fixes:
Rewording wins more often than people admit: headings also feed PDF bookmarks, where math silently degrades to mush anyway (hyperref will warn you with "Token not allowed in a PDF string").
Frequently asked questions
What package do I need for \mathbb?
amssymb. Add \usepackage{amssymb} to the preamble and \mathbb{R} works. (Technically the fonts live in amsfonts, which amssymb loads for you.) \mathcal needs no package at all; \mathfrak comes with amssymb too.
How do I write the real numbers symbol in LaTeX?
\mathbb{R} with the amssymb package loaded. Same pattern for the other standard sets: \mathbb{N}, \mathbb{Z}, \mathbb{Q}, \mathbb{C}.
Why doesn't \mathbb work on lowercase letters?
The AMS blackboard bold font only contains capitals, so \mathbb{k} gives garbage or an error. For lowercase blackboard letters load bbm and write \mathbbm{k}, or use dsfont's \mathds. The most common real case is the indicator function: \mathbbm{1}.
What is the difference between \mathcal and \mathscr?
Two different fonts for the same idea. \mathcal is the built-in calligraphic alphabet; \mathscr (from the mathrsfs package) is a more ornate script, and it is the traditional choice for the Lagrangian and Laplace/Fourier transform symbols. Both are capitals-only.
\mathbb, \mathcal and \mathfrak: Special Math Alphabets in LaTeX
One preamble line covers all three: \usepackage{amssymb}. Strictly, \mathcal is built into LaTeX and only \mathbb and \mathfrak come from the AMS fonts — but nobody writes serious math without amssymb anyway, so load it and stop thinking about it.
Blackboard bold: the standard sets
The five symbols every paper needs at some point:
If you type these often, define shortcuts once — \newcommand{\R}{\mathbb{R}} and friends — and your source stays readable. Every long-lived preamble ends up with that block.
\mathbb is capitals-only
The AMS blackboard font contains A–Z and nothing else. \mathbb{k} does not give you a blackboard k for your field; depending on setup it prints a wrong glyph or errors out. Lowercase blackboard needs a different font:
The indicator function \mathbbm{1} is the case that sends everyone hunting for this. Probability people: it is bbm, not amssymb, and no amount of \mathbb{1} will produce it.
Calligraphic: \mathcal
\mathcal is the workhorse for sigma-algebras, categories, loss functions and general "fancy L" duty:
Also capitals-only. \mathcal{a} silently produces a wrong glyph from another slot of the font — not an error, just garbage in your PDF — which makes it nastier than the \mathbb failure because it can survive to publication.
Script: \mathscr, when \mathcal is not fancy enough
The mathrsfs package adds \mathscr, a more ornate script alphabet. Convention splits the fancy-L jobs: the Lagrangian and the Laplace transform traditionally take the \mathscr L, while loss functions and languages stay \mathcal:
Fraktur: \mathfrak
Fraktur is the standard alphabet for Lie algebras (lowercase: \mathfrak{g}, \mathfrak{sl}_2) and for ideals and cardinals in algebra and set theory. Unlike the other two, it has both cases:
Fraktur capitals are famously hard to tell apart in print — \mathfrak{A} and \mathfrak{U} routinely get confused by readers. If your notation is dense, favor the lowercase letters.
The three alphabets at a glance
| Command | Package | Case support | Typical use |
|---|---|---|---|
\mathbb | amssymb | Capitals only | Number sets, probability P and E |
\mathcal | built in | Capitals only | Sigma-algebras, big-O, distributions |
\mathscr | mathrsfs | Capitals only | Lagrangian, Laplace, sheaves |
\mathfrak | amssymb | Both cases | Lie algebras, ideals, cardinals |
\mathbbm | bbm | Both + digits | Indicator function 𝟙 |
In section headings: the bold-math trap
Put $\mathcal{L}$ in a \section title and the heading font goes bold but the math does not — bold blackboard and calligraphic fonts mostly do not exist, so the symbol sits there in regular weight looking wrong. Two honest fixes:
Rewording wins more often than people admit: headings also feed PDF bookmarks, where math silently degrades to mush anyway (hyperref will warn you with "Token not allowed in a PDF string").
Frequently asked questions
What package do I need for \mathbb?
amssymb. Add \usepackage{amssymb} to the preamble and \mathbb{R} works. (Technically the fonts live in amsfonts, which amssymb loads for you.) \mathcal needs no package at all; \mathfrak comes with amssymb too.
How do I write the real numbers symbol in LaTeX?
\mathbb{R} with the amssymb package loaded. Same pattern for the other standard sets: \mathbb{N}, \mathbb{Z}, \mathbb{Q}, \mathbb{C}.
Why doesn't \mathbb work on lowercase letters?
The AMS blackboard bold font only contains capitals, so \mathbb{k} gives garbage or an error. For lowercase blackboard letters load bbm and write \mathbbm{k}, or use dsfont's \mathds. The most common real case is the indicator function: \mathbbm{1}.
What is the difference between \mathcal and \mathscr?
Two different fonts for the same idea. \mathcal is the built-in calligraphic alphabet; \mathscr (from the mathrsfs package) is a more ornate script, and it is the traditional choice for the Lagrangian and Laplace/Fourier transform symbols. Both are capitals-only.
Getting Started
Text Formatting
Mathematical Expressions
Document Structure
Page Layout
Errors & Troubleshooting
