aspell, ispell, and mspell

Up until a few years ago the best spell checker was called ispell. Since then a new spell checker has been developed called aspell which is now the standard spell checker for Linux. aspell finds more possibilities for a misspelled word, but unless you are really bad at spelling, the huge number of suggested words is rather distracting.

Both ispell and aspell know to ignore any word beginning with \ in a .tex file. However, only ispell will ignore stuff between \[ and \] or between \begin{equation} and \end{equation}. aspell will try to spell check your equations - this is something you definitely don't want! So at the moment ispell is better than aspell for checking spelling in .tex files.

There is still a slight problem with using ispell on .tex files. Most people use the user defined macros \beq and \eeq instead of \begin{equation} and \end{equation}. ispell does not know about these macros and so will spell check stuff between \beq and \eeq. To get around this mspell (a short script - the 'm' is for macro) copies the file to a temporary file in which the \beq and \eeq macros are expanded, and then runs ispell on the temporary file.

Installing ispell and mspell

You can download ispell from here or from the ispell homepage. You will also need to download mspell.tgz which contains local.h and mspell.

Log on as root (or go to some temporary directory if you are using ubuntu). You first need to check whether the directory /usr/local/man exists. If it doesn't, you need to create it by doing

mkdir /usr/local/man

Then move the two tar files to the root directory and unpack them using

tar xvfz ispell-*.tar.gz ; tar xvfpz mspell.tgz

Move local.h to inside the ispell directory, then cd to inside the ispell directory. If you are using ubuntu or another recent version of linux you will need to edit the file config.sh and change
TERMLIB='-ltermcap'
to
TERMLIB='-lncurses'
and type

make all

If you get an error about yacc you will need to install yacc. On ubuntu you can do this by entering

sudo apt-get install bison

If after trying make all again you get an error message about -lncurses you will need to install the corresponding library by entering

sudo apt-get install libncurses5-dev

Once make all no longer gives an error message you can enter

make install

or

sudo make install

if you are using ubuntu. This will put ispell in /usr/local/bin. You will need to move mspell to /usr/local/bin or somewhere else in your path.

From a non-root xterm type

ispell

If you see a message saying "Ispell compatibility script for Aspell" it means that there is already a command called ispell, but this will really just execute aspell. You should therefore change the name of /usr/bin/ispell to, for example, /usr/bin/ispell-a

The real ispell command (with no arguments) should prompt you for a word for it to check.

Using ispell and mspell to spell check a file

You should first open an editor (if you haven't already) - you will be making the changes to the file yourself. Then inside an xterm do

mspell filestem.tex

If it finds a word that it thinks is misspelled it will display the word inside the sentence and list some possible alternative correctly spelled words. You then have 3 choices:

If the word is really misspelled, then find it in the original file and correct it. Then go back to the xterm and press the space bar.

If you are sure the word is not misspelled - it is just that the dictionary doesn't have it yet, then you can add it to your personal dictionary by pressing either 'i' or 'u'. If it is a name or acronym and so must be capitalized as shown, then press 'i'. If it is an ordinary word (and so could appear as all lower case) then press 'u'. Your personal dictionary is located in your home directory and is called something like .ispell_britishxlg. The spell checker looks at your personal dictionary as well as its own dictionary, so if you add a word, next time it will not complain about it.

Finally it will probably complain about words with LaTeX commands in the middle to produce accents e.g. Alfv\'{e}n. In this example, it will think that 'Alfv' is a misspelled word. It is up to you whether you choose to add 'Alfv' to your personal dictionary by pressing 'i' (even though Alfv is not really a word), or just to ignore it (by pressing the space bar) and put up with it complaining next time.
After making the changes to the file (and not forgetting to save it) you should run mspell again to check that you made the changes correctly. Hopefully the second time there will be no mistakes!

US and non-US spelling

At present the file local.h is set for standard (non-US) English spelling. If you want US spelling you will need to change that file before compiling, or use the -d option in ispell to select the US English dictionary (see the man page for ispell).

There is one problem with checking non-US English spelling using ispell. (It is a problem with the non-US English dictionary rather than with ispell itself.) It complains about words such as localize, summarize, magnetize, etc. It says that these words should end with -ise. In fact, either -ise or -ize is permissible but -ize is preferable as it is listed first in the Oxford English Dictionary which is taken as giving 'standard international English'. [Note, however, that analyse and catalyse should not end with -yze in non-US English.] When ispell complains about such -ize words you will need to press 'u' to insert them into your personal dictionary.