spell paper.texThe trouble with this is that typically many strings occur in a Latex document that may not be valid words in English, but that aren't typos either. To reduce a number of such strings, one may try:
detex paper.tex | spellMy experience is that even here the output is much too verbose. My solution is calling a UNIX script that consists of:
unlatex < $1 | ize | spell -b +/someproperpath/stoplistHere, unlatex is the following Perl script:
#!/someproperpath/perl -wThis removes Latex commands and some more strings that usually lead to false alarms of typos, cf. detex.
# Removes Latex commands, and some more.
foreach (<STDIN>) {
s/[A-Za-z\.]+@[A-Za-z\-\.]+/ /g; # smith@smith-town.edu
s/\\[A-Za-z]*/ /g; # \SomeCommand
s/{[A-Za-z0-9\/\*-]*}/ /g; # {enumerate}
s/\[[A-Za-z0-9,]*\]/ /g; # [tb]
s/[^A-Za-z]+/ /g; # not a sequence of letters
s/[A-Z][A-Z][A-Z]*/ /g; # PDA
s/(^|\s)([A-Za-z]($|\s)\s*)+/ /g;# isolated letters
print "$_\n"
}
Further, ize is the following Perl script:
#!/someproperpath/perl -wThis allows me to use the `American' ending ''-ize'' instead of ''-ise'', in combination with the British spelling for other words (the flag -b of spell). I.e. my spell checker allows both ''organize'' and ''organise'', yet does not allow ''favor'' (American) next to ''favour'' (British).
# replaces -ize by -ise
%suffix = (
"ze","se",
"zed","sed",
"zes","ses",
"zer","ser",
"zers","sers",
"zing","sing",
"zation","sation",
"zations","sations");
foreach (<STDIN>) {
foreach $key (keys %suffix) {
s/([a-zA-Z][a-zA-Z][iy])$key([^a-zA-Z]|$)/$1$suffix{$key}$2/g;
}
}
The stoplist is a file that contains such words as:
Nederhofand everything else that I don't want to appear in the output of the spell checker.
Stuhlsatzenhausweg
fulfils
program
programs
For most Latex documents, the resulting output is compact enough to spot spelling errors at a glance.
On some UNIX platform, a program ispell is available, with which one can interactively correct spelling errors. Personally, I detest the interactive mode of ispell, and use:
ispell -t -l < paper.tex