I normally use my gedit spell check extension for the task, but wouldn't it be much better if you could fix any typos or otherwise during compilation time, in a sort of interactive mode?
11 Answers
It seems unreasonable to implement spell checking as a LaTeX package when there are excellent spell checkers for the terminal that can be incorporated into the compilation process. Before you compile you can do
aspell -t -c file.tex
or
ispell -t file.tex
Either lets you interactively spell check the whole file. The -t option is to tell the spell checker that the file is in TeX or LaTeX format so that it will ignore macros.
To combine this with the compilation process you can invoke them after each other such as
aspell -t -c file.tex && pdflatex file.tex
or you could make an alias to shorten the command you need to write. If you use latexmk you could make it run aspell or ispell for each compilation by a using a technique similar to what is described in https://tex.stackexchange.com/a/42166/5701.
If you prefer to simply get a list of misspelled words non-interactively, you can run:
cat file.tex | aspell list -t | sort | uniq
-
1@AymanElmasry Why would you want to implement it as a package? Is there are reason except for want of abstraction? In case you make it only for abstraction I see no reason to implement it as package when there are excellent terminal spell checkers already. If you make an alias or implement it via latexmk you would only need to write a short command such as
spellpdflatex file.texorlatexmk -r spellcheck file.texto spell check and compile. – N.N. Jan 30 '12 at 21:02 -
3@N.N You don't understand his question. He wants to fix typos during the compilation time as soon as they are start popping up in the log file. The only people who can answer this questions are pdfTeX developers. That doesn't exist and I am not sure even if it can be implemented. My best guess that is not theoretically possible to implement. – Predrag Punosevac Jan 31 '12 at 03:50
-
@PredragPunosevac I do understand it but argue that it seems unreasonable to do so when there are excellent spell checkers for the terminal already. – N.N. Jan 31 '12 at 07:21
-
3Just for completeness' sake, there is another command line spell check program called
hunspell. It can be invoked likehunspell -t file.texIt will go through each misspelled word one at a time interactively, unless you add the-lflag, in which case it will just list all occurrences on stdout. – gla3dr Nov 21 '14 at 20:58 -
2What does the -c do? I checked the manual: -c|check
to check a file and -t,--mode=tex enter TeX mode. Mac users with homebrew installed and with or without admin rights can do brew install aspell. Is there a way to make it ignore stuff inside for example – tommy.carstensen Nov 17 '17 at 12:43\url{}and\graphicspath{}? I found my answer here: https://tex.stackexchange.com/questions/34628/aspell-how-to-ignore-references-inside-citep-and-citet-references Just add--add-tex-command="graphicspath op"to the command line or modify~/.aspell.confas per one of the answers.
You can let TeX (rather luaTeX) do the spell checking for you! For example, in ConTeXt MkIV, you can use
\loadspellchecklist[en][wordlist.txt]
\setupspellchecking[state=start]
where en is the current language (you can set different word lists for different languages), and wordlist.txt is a sorted list of correct words. For a complete example, see the ConTeXt wiki
- 62,301
-
8@Nasser or look at the example on context wiki (linked in the question). Any misspelled word is colored red. – Aditya Jul 19 '14 at 15:14
-
1But it's possible that an inappropriate word is used, spelled correctly. No spelling-only checker will find and report that, and using one may give an unwarranted sense of security. Syntax checking (and a good proofreading) is also needed. – barbara beeton Aug 08 '19 at 14:00
-
1@barbarabeeton: Agreed. A good (and critical) proofreading is essential. – Aditya Aug 08 '19 at 15:15
Not an interactive solution, but you might want to have a look at the spelling package. The package requires the LuaTeX engine. Only the LaTeX format is supported, but support for other formats shouldn't be too hard to implement. Contributions are welcome!
- 1,151
-
What is the possibility of expanding the scope of the spelling package to pdfLaTeX as well, for example? – lucenalex Aug 27 '20 at 14:23
Not professional but still as an option: if one has Microsoft Word on the system, one could copy and paste the LaTeX source into Word, and following the red lines to correct them.
-
3one could also use the built-in grammar check of the latest IDE. after 4 years lot has changed. – naphaneal Nov 07 '16 at 17:17
If you use sublime text as an editor, you could try https://github.com/vaisaghvt/CheckTypos package.
- 149
-
5That GitHub page specifically reads: "This plugin does not check for spelling mistakes." – tommy.carstensen Nov 17 '17 at 12:30
It's not the 2010s anymore...
Just use a spell check package for your favorite Integrated Development Environment.
For instance, Code Spell Checker for Visual Studio Code.
TexStudio does spellchecking and underlines misspelled words. It also has a spell checking menu option. No need to compile.
- 2,615
In case you are using VS Code, you can install the LTeX – LanguageTool grammar/spell checkin which calls LanguageTool behind the scenes.
- 3,252
Like Gottfried William answered TeXstudio does spellchecking without needing to compile.
I will add to this that you can also download a dictionary from Open Office like https://extensions.openoffice.org/de/project/dutch-spelling-and-hyphenation-dictionary for additional langauge support, you just need to load the .oxt file inside TeXstudio.
I just set it this up and I'm satisfied with the result!
On the side you can go for Aspell like some mentioned but for me it's a hassle if you're just looking to correct spelling mistakes while typing in an edditor like TeXstudio.
I made my own texsc tool to simplify the usage of GNU aspell. You just do this and your LaTeX documents will be checked:
gem install texsc
texsc --ignore=citet,citep,verbatim book.tex chapter1.tex chapter2.tex
You can also specify your own additional vocabulary:
texsc --pws=vocab.pws book.tex
More info here and in this blog post.
- 12,021
aspellandispell? – a06e Oct 11 '17 at 10:46