Spell Checking

LaTeX Spell Check in VS Code with LaTeX Workshop

Set up LaTeX spell check in VS Code using Code Spell Checker, choose a language and word list, and learn where VS Code's web version falls short.

On this page
  1. Short answer
  2. Install the extensions
  3. Set the language in cspell.json
  4. Add LaTeX-specific words
  5. Commands and math
  6. Optional: grammar checking with LTeX
  7. Where the setup breaks
  8. Troubleshooting
  9. Related guides

Short answer

Spell checking for .tex files in VS Code comes from an extension, usually Code Spell Checker. LaTeX Workshop builds and previews your document, but it doesn’t do the spell check. Install both, set your language in a cspell.json file, and add project terms to the word list.

Install the extensions

  1. Install LaTeX Workshop to compile and preview your document. It needs a TeX distribution such as TeX Live or MacTeX, which you install separately.
  2. Install Code Spell Checker from Street Side Software. It underlines misspelled words in .tex files.
  3. Open a .tex file. Misspelled words should show a wavy underline.

If nothing is underlined, see the troubleshooting section near the end of this guide.

Set the language in cspell.json

Create a file named cspell.json in the project folder you open in VS Code:

{
  "version": "0.2",
  "language": "en-US"
}

For German, set "language": "de-DE". Code Spell Checker may need a German dictionary package; check the extension’s documentation if German words stay underlined. Keeping the file in the project root means it applies to every .tex file in the project.

Add LaTeX-specific words

Names, acronyms, and package names are often flagged. Add them to the words list:

{
  "version": "0.2",
  "language": "en-US",
  "words": ["biblatex", "TikZ", "Overleaf"]
}

You can also hover over a flagged word and use the quick fix to add it to the workspace. The extension then writes the word into your configuration.

Commands and math

Code Spell Checker usually handles common LaTeX command names. Custom macros from \newcommand and environment names may still be flagged, so add them to words as you find them. Math content can also produce noise.

Optional: grammar checking with LTeX

LTeX adds grammar and spell checking, powered by LanguageTool. It’s useful for longer prose. It runs on Java, so you may need a Java runtime, and it can be slower than a spell-only extension.

If you use both extensions, a word may get two underlines. Turn off spell checking in one of them for .tex files to avoid the double marks.

Where the setup breaks

Two limits appear in the extensions’ issue trackers:

  • VS Code for the web. A Code Spell Checker issue reports that the extension doesn’t run in VS Code for the web, such as vscode.dev. Use desktop VS Code for spell checking.
  • Overleaf virtual workspaces. When you edit an Overleaf project through the Overleaf Workshop extension, the spell checker runs in a virtual workspace. There, the config must be JSON, JSONC, or YAML. A JavaScript config file, or one that depends on node_modules, doesn’t load. Use cspell.json.

The same issue thread reports that Overleaf’s custom URI scheme must be enabled before the checker works. Run cspell.showActionsMenu from the command palette, choose the option to include the scheme, and restart VS Code if prompted.

Troubleshooting

  • Nothing is underlined. Check that Code Spell Checker is enabled for the file, and that the file is saved with a .tex extension.
  • Find out why a file isn’t checked. Open the file and run cSpell.openFileInfoView from the command palette. It shows the language and settings the checker used for that file.
  • German words are flagged. Confirm the language in cspell.json is de-DE, then try reloading the window.

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 →