Creating LaTeX documents

spell checking
LaTeX files, Unix

Spell-checking is expected of any self-respecting word processor, so it should also be possible in LaTeX. And it is. But the method will vary according to your computer and software version.

In the basic Unix system where you manually type the latex (or pdflatex) command, spell-checking must be done on the plain-text *.tex files. The Unix command spell almost does the job, but it does not recognize TeX macros and complains inappropriately about them. So, you should filter out all TeX/LaTeX macros before feeding a *.tex file to the spell program, and for this you use the detex command.

So, for example, to check the spelling of file sect1.tex, use the command

unix>  detex sect1.tex | spell
...which will display any supposed misspellings to the monitor, ignoring TeX/LaTeX macros and comments. Many names and unusual technical words may be falsely accused -- ignore them if you know better than the computer! If there is a long list of ``misspelled words'', however, you may want to put the spell report into a file of its own for future reference, e.g.,
unix>  detex sect1.tex | spell > spelling.errors
You can check the spelling of all the TeX/LaTeX files at one time using the Unix wildcard character `*';
unix>  detex *.tex | spell > spelling.errors
How do you find the locations of misspelled words in your LaTeX files? Your text editor has a search function, but you can also get a quick find using the Unix command ``grep''. For example, to find where the misspelled word thier occurs (the file name and line number of each occurrence), the Unix command grep and typical results might look like this:
unix>  grep -n -w thier *.tex
chapter1.tex:83:Some folks get thier kicks from going to
chapter1.tex:502:      with thier  children   from a previous
chapter5.tex:1770: and thier $N$ dependents.
(The -w option prevents reporting of lines which only contain the string ``thier'' within larger words, such as ``wealthier''.)