Underleaf Logo
Underleaf
BlogPricing
Log InTry Free

Learn LaTeX

Getting Started

  • What is LaTeX?
  • LaTeX for Beginners

\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:

The three alphabets at a glance

CommandPackageCase supportTypical use
\mathbbamssymbCapitals onlyNumber sets, probability P and E
\mathcalbuilt inCapitals onlySigma-algebras, big-O, distributions
\mathscrmathrsfsCapitals onlyLagrangian, Laplace, sheaves
\mathfrakamssymbBoth casesLie algebras, ideals, cardinals
\mathbbmbbmBoth + digitsIndicator 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.

Try it free

Skip the syntax — let AI write it.

Snap a photo of an equation, a table, or full handwritten notes and Underleaf turns it into clean, compilable LaTeX in seconds. 10 free credits every month, no credit card required.

Convert your page
Handwritten notes converted into a typeset LaTeX document

\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:

The three alphabets at a glance

CommandPackageCase supportTypical use
\mathbbamssymbCapitals onlyNumber sets, probability P and E
\mathcalbuilt inCapitals onlySigma-algebras, big-O, distributions
\mathscrmathrsfsCapitals onlyLagrangian, Laplace, sheaves
\mathfrakamssymbBoth casesLie algebras, ideals, cardinals
\mathbbmbbmBoth + digitsIndicator 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.

Underleaf Logo
Underleaf

Empowering students and researchers with AI-powered tools for academic writing.

Go to appContact us

Company

PricingBlogTutorialsConference TemplatesConference Deadlines

Free Tools

Image to LaTeXExcel to LaTeXArXiv to LaTeXTikZ GeneratorLaTeX Table GeneratorCitation GeneratorThesis GeneratorChrome ExtensionAll Tools

Ask AI about Underleaf

Ask ChatGPTAsk ClaudeAsk Perplexity

© 2026 Underleaf. All rights reserved.