# Spell checking LaTeX documents

What's the best strategy for spell checking LaTeX documents?

• This question is noticeably lacking in Windows-specific answers. (For those of us using Windows-native editors rather than emacs, vi.) I suspect if I ask a Windows-specific question, it will be merged here... ? – Mohan Sep 29 '12 at 23:45

It sort of depends on the system you're working on.

I'm using GNU/Linux and here aspell does a good job. For instance, to check test.tex in Danish, I would do like this from the terminal:

aspell -c -t test.tex -d da


The option -c tells aspell to check the file, -t puts it in TeX mode, and -d gives the base name of the main dictionary to use. On Ubuntu/Debian, this can be installed using:

sudo aptitude install aspell


Aspell is also available as a Windows executable. It can but run from the command line or from any good text-editor (i.e. one that supports macros to run external programs).

• You can also use the --mode=tex or -t options to put aspell into tex mode, which ignores the spelling of standard tex commands. If you have defined additional tex commands these can be added to or removed from the ignore list using --add-tex-command=<list>, --rem-tex-command=<list>. – ihuston Jul 26 '10 at 20:57
• Hunspell also has a TeX/LaTeX mode, -t, if one is using a language aspell does not support. – Khaled Hosny Aug 29 '10 at 8:30
• I use this to do a spellcheck in Swedish "aspell --lang=sv --mode=tex -c my_file.tex" – Johan Aug 29 '10 at 11:48
• "Aspell is also available as a Windows executable." I love that you can install Ubuntu on Windows 10. This lets you open bash from the Windows command prompt and install and use (a more recent) version of aspell from there. Only drawback I've encountered so far, is that bash switches directories if called from a network drive. – florland Jun 11 '18 at 14:38
• for those who, like me, are struggling with the --add-tex-command option: if you want to ignore \\citep and citet citation commands, just use it's -add-tex-command "citep op" --add-tex-command "citet op" (op stands for "ignore the optional parameter as well, use "Op" if you do not want to ignore it) – Ansa211 Jun 27 '19 at 13:40

Spell-checking can commonly be handled by your text editor. I'm not sure what the windows LaTeX editors have, but it's common to use vi or emacs in linux, and the editor's spell checking is pretty sufficient. Also, because these editors are syntax-aware, your spell-checking can be as well.

• I personally use M-x flyspell-mode with AucTeX in Emacs which checks spelling as you type. – Quadrescence Jul 26 '10 at 19:37
• As another example, if you use TextMate on Mac OS X to edit your Latex documents, you can use its spell-checking features. Seems to work fairly well. – Jukka Suomela Jul 26 '10 at 20:25
• Personally use the new set :spell in Vim 7, and Automatic Spell Checking available in all system languages in Kile. – EricR Aug 4 '10 at 15:52
• I'd point out that every dedicated TeX editor I know of has a spell checker: this applies to all platforms. It's such an obvious requirement that editors would not really succeed without it. – Joseph Wright Aug 29 '10 at 8:22

There's a reasonable on-line spell-checker at Micro Spell.

You might want to have a look at the spelling package. Though not yet matured, it already works reasonably well. The spelling package requires the LuaTeX engine. Main features of the package are:

• Text is extracted during typesetting and written to a file that can be checked by your favourite spell-checker application.
• Spelling errors can be highlighted in PDF output.

(The maintainer of the spelling package.)

Old question but I figured I'd throw in my two cents. An approach that I use, following a careful read-through to make sure that I catch as much as I can, is to first convert the latex document to RTF (using the latex2rtf package), and then open it up in Word. The figures tend to be ignored, however the wording and grammar at least can be handled by Word's excellent spelling and grammar checker.

I use a mac and I have cocoaspell, which works for the whole computer. As I use Aquamacs, I then enable flyspell (spell check on the fly), and it is all done!

detex doc.tex | spell

• Hi, I would like to know, where should I write this command in order to let latex check my spelling? I have tried to write it after \begin{document}, but it doesn´t work. Should I create a new tex file and give this command? – Vivian Nov 30 '16 at 13:41
• detex is a command line program. It needs to be installed on your system, and you need to run it in a terminal at a command prompt. – mankoff Nov 30 '16 at 19:28
• Try aspell or ispell. May need to be installed with 3rd party package manager. – mankoff Mar 9 '17 at 19:32

It depends not only on the packages suggested but also on the language that you are using and on the front-end you edit your text. If you are a Windows user, I recommend WinEdt which is a paid front-end for LaTeX. It has dictionaries for many languages and underlines in red the words which are written incorrectly. A right click on an underlined word shows alternatives for it. If you write in different languages, you can also combine different dictionaries.

If you problem is hyphenation, however, remember to configure MiKTeX and your document for the language considered. There may be problems still, but you can correct them manually with \hyphenation.

I have good experiences with the spell checker of TeXStudio, but I guess there are many other editors with good LaTeX compatible spell checkers. You find a good list in this question.

A second option that some of my colleagues practice is to copy'n'paste the pdf output to Word. This may sound cumbersome and probably is, but the time you will/should take to proof read your document will exceed the time amount for the copy and paste by order of magnitudes.

• It is time consuming way to paste in word, but it worth because the office 2013 can check some grammar errors not only the spells. – selwyndd21 Sep 26 '13 at 2:13

As it hasn't been mentioned, note also Texmaker:

Cross-platform (on Linux I use 4.1.1 as it is the last static build available for download, otherwise my OS is too old), apparently it has it's own spell-check dictionaries (program directory contains e.g. en_GB.aff, en_GB.dic - not sure if these use aspell or standalone engine); comments are skipped (I like), commands are skipped (I like), filecontents with bibliography entries are skipped (surprised at this, like), math is skipped (like) -- though some packages/arguments are still checked/underlined, and \cite arguments too (see Make spellchecker ignore contents of certain commands in TexMaker). In any case, this looks quite good to me...

Although this is an old question, here is what I have found to work well if you have access to Word. It is similar to the suggestion of espais. pdflatex the document and then open the PDF in Word (which Word 2013 can do).

When proof-reading a document what I am looking for are not just spelling mistakes but more broadly typos; for example repeated words (e.g., "the the"). Word is actually quite good at catching these mistakes.

The only minor problem I have found is that certain types of formatting can confuse Word's conversion from PDF. For instance watermarks caused problems (but in my case they were easy to turn off).

The check_spelling command from my R package TeXCheckR is designed to enhance the features in hunspell.

Synopsis:

library(TeXCheckR)
check_spelling("file-to-check.tex")


Features:

• Ignores the contents of commands which don't print, for example the contents of \labels and cite commands, which hunspell spuriously raises as possible spelling errors. You can also add commands whose contents will be ignored.
• The ability to add words to the dictionary on a document-by-document basis, by adding % add_to_dictionary: stackexchange to the preamble.

• The ability to fail on certain words, to maintain consistency % stop_if_present: organize

• The ability to detect acronyms and add them automatically to the dictionary, so the following will pass.

The Quebec Xylophone Enterprise Foundation (QXEF) is fictional.

• Author names in the bibliography are automatically added (with a note).

• Valid English contractions are not considered spelling errors.

• The contents of \input and \include files are checked recursively.

Due to an oversight, I check against the en_GB dictionary and don't provide the user to select a dictionary. In the next version, I'll allow any hunspell dictionary. (It's trivial to update this: just don't want to pester CRAN.)

• Consistently ignored in the requests and answers regarding spell checkers is the fact that spell checking is not enough. Syntax checking (and good proofreading) is also necessary. Evidence: a correctly spelled, but quite erroneous notice posted on a (physical, not electronic) Stanford bulletin board some years ago: "The semester will being on September 4." – barbara beeton Aug 8 '19 at 16:21