Spell Checking

How can I check spelling in LaTeX?

LaTeX has no spell checker of its own. Learn how to check spelling with Aspell or Hunspell in TeX mode, or with the spell check in your editor.

On this page
  1. Short answer
  2. Check with Aspell in TeX mode
  3. Check with Hunspell in TeX mode
  4. Check inside your editor
  5. Why you get false positives
  6. Keep a word list
  7. Related guides

Short answer

LaTeX doesn’t check spelling. Compiling a document only typesets it. To check spelling, use the spell checker in your editor, or run a command-line tool such as Aspell or Hunspell in TeX mode. TeX mode tells the tool to skip most LaTeX commands, which should reduce false positives on things like \section and \label.

Check with Aspell in TeX mode

Aspell runs on Linux, macOS, and Windows. On Debian or Ubuntu, install it with the dictionaries you need:

sudo apt install aspell aspell-en aspell-de

Interactive check

Run Aspell’s check command on your file:

aspell --mode=tex --lang=en_US check main.tex

Aspell steps through each flagged word and offers corrections. Its check command can change your file when you accept a correction, so copy or commit the file first.

List misspelled words

To get a list without changing anything, use the list command, which reads from standard input:

aspell --mode=tex --lang=en_US list < main.tex | sort -u

The sort -u step removes duplicates, which makes the list easier to scan.

German

Use --lang=de once the German dictionary is installed:

aspell --mode=tex --lang=de list < main.tex | sort -u

To see which dictionaries Aspell can find, run aspell dump dicts.

Check with Hunspell in TeX mode

Hunspell is the spell checker used by many desktop programs. On Debian or Ubuntu, install an English dictionary with sudo apt install hunspell hunspell-en-us, and a German one with hunspell-de-de.

hunspell -t -d en_US -l main.tex | sort -u

Here -t selects TeX input, -d picks the dictionary, and -l lists misspelled words without changing the file. If Hunspell can’t find the dictionary files, it reports an error about the dictionary rather than checking the file.

Check inside your editor

Editor checkers are often easier to use day to day, because underlines show up as you type.

  • Overleaf has a built-in spell checker with a language setting. The pillar guide explains how it works and what to expect.
  • Texmaker and some other desktop TeX editors include their own checkers. The editor guide covers them.
  • VS Code uses the Code Spell Checker extension. The VS Code setup walks through it.

Why you get false positives

Expect some noise from any checker. Common sources include:

  • Custom commands. TeX mode skips most built-in commands, but macros from \newcommand often get flagged.
  • Labels and citation keys. Keys such as \label{fig:overview} and \cite{vaswani2017} aren’t prose.
  • Math. Variables and function names usually aren’t dictionary words.
  • Names and technical terms. Author names, product names, and package names such as biblatex or TikZ aren’t in general dictionaries.
  • Wrong language. A German document checked against an English dictionary will flag many of its words.

Keep a word list

Repeated false positives are better handled with a word list than by editing the document.

In Aspell’s interactive check, press a to add a word to your personal word list, or i to ignore it for the current session. Aspell keeps the personal list between runs. Hunspell also supports a personal dictionary; its man page covers the option.

The complete guide to spell checking

Spell Checking LaTeX Documents in Overleaf, on Mac and Beyond
Read the guide

Keep exploring

Guides from other topics

All topics →