Short answer: LaTeX doesn’t check spelling
Compiling a document with pdfLaTeX, XeLaTeX, or LuaLaTeX typesets it. It doesn’t report misspelled words. Spell checking happens in one of two places: the editor you type in, or a separate command-line tool that reads your .tex files.
The catch is that LaTeX source isn’t plain prose. Commands such as \section{...}, labels such as \label{sec:intro}, citation keys, and math all look like words to a checker that doesn’t understand TeX. Some setups skip those parts. Others flag them, and you have to sort the real errors from the noise.
Choose a checker by where you write
Start with the tool you already use:
- Overleaf in the browser: a built-in spell checker with a language setting.
- Desktop TeX editors: some, such as Texmaker, include their own checker. See the editor-by-editor guide.
- VS Code: the Code Spell Checker extension. See the VS Code setup.
- Any editor or build script: Aspell or Hunspell on the command line. See the command-line guide.
Overleaf in the browser
Overleaf includes a spell checker in its editor, and you can choose the language. Look for the spell-check language option in the editor’s settings menu. Menu labels change over time, so search the menus if the option isn’t where this guide describes.
If the check runs in your browser, your browser’s spell-check support can affect the results too. In a November 2024 issue on the Overleaf Workshop project’s GitHub page, a maintainer said that Overleaf had moved spell checking into the browser, and the same thread pointed users to local setups for work outside the browser. Behavior may have changed since then, so test it in your own project before you rely on it.
Spelling on a Mac
In many Mac apps that use Apple’s text system, the system spell checker is under the Edit menu, in Spelling and Grammar. Look there for the option to check spelling as you type. This only affects apps that use that system. Most TeX editors have their own checker, so the system setting may not reach your .tex file. For setting up LaTeX itself on macOS, see can I use LaTeX on a Mac?
For a checker that works in Terminal, install Aspell or Hunspell with Homebrew. Then run aspell dump dicts to see which language dictionaries Aspell can find. If the language you need isn’t listed, look for a dictionary package for your setup. The command-line guide has the commands.
VS Code
VS Code gets spell checking for .tex files from an extension, usually Code Spell Checker. LaTeX Workshop builds and previews your document, but it doesn’t do the spell check itself. The VS Code setup guide covers both extensions and the language settings.
Command line: Aspell and Hunspell
Aspell and Hunspell both have a TeX mode that skips most LaTeX commands. You run them over a file and get a list of misspelled words. This works with any editor, and it’s easy to add to a build script.
English and German: match the dictionary to the document
The spell-check dictionary is separate from the document’s typesetting language. \usepackage[ngerman]{babel} tells LaTeX how to hyphenate and typeset German. It doesn’t choose the dictionary your spell checker uses. Set both: the babel language for typesetting, and the spell-check language in your editor.
English: pick one variant, American (en-US) or British (en-GB), and use it for the whole document. A US dictionary will usually flag “colour,” and a UK dictionary may flag “color” or other US spellings.
German: choose a German dictionary, such as de-DE. German compound words are long, so a dictionary may flag real words that a native speaker would accept. Add the ones you use often to your word list.
Mixed documents: a German text with English technical terms will produce more false positives. Add the English terms to your word list.
Keep commands and math out of the results
A few habits cut down the noise:
- Use a TeX-aware mode. Aspell’s
--mode=texand Hunspell’s-tskip most commands. Code Spell Checker also handles common LaTeX commands, though not always. - Leave correct math alone. Variables and function names in math mode often get flagged. Don’t rewrite correct math to satisfy a spell checker.
- Expect custom macros to be flagged. Names from
\newcommandand\newenvironmentaren’t in any dictionary. Add them to your word list. - Keep a word list. Author names, acronyms, and package names such as
biblatexandTikZare often flagged. Add them once, and they stop coming back.
Common problems
- No underlines in Overleaf: check the spell-check language first, then reload the page and try a word you know is misspelled.
- No underlines in VS Code: confirm the Code Spell Checker extension is enabled for
.texfiles and that your language is set. If you use VS Code for the web, the extension may not run at all. - Too many errors: a wrong language setting causes most of the noise. Check it before you start editing your word list.
Related guides
- How can I check spelling in LaTeX? covers Aspell and Hunspell commands in TeX mode.
- LaTeX spell check in Sublime Text, Atom and Texmaker covers setup for those three editors.
- LaTeX spell check in VS Code with LaTeX Workshop covers the VS Code setup and its limits.