1) How can I make aspell
cope with words containing special characters like F\"orster
or \AA ngstrom
? I can't simply add these to the dictionary.
2) How can I make aspell
skip math mode? For example, in $a^bc$
it offers to replace bc
.
1) How can I make aspell
cope with words containing special characters like F\"orster
or \AA ngstrom
? I can't simply add these to the dictionary.
2) How can I make aspell
skip math mode? For example, in $a^bc$
it offers to replace bc
.
GNU Aspell comes with a dedicated TeX/LaTeX filter which can be activated with the --mode=tex
command-line option. The functionality of this filter is, however, still limited. In essence, when Aspell is in TeX/LaTeX mode it skips control sequences and checks/ignores macro arguments according to a list of macro signatures which can be extended on the command line or in one of Aspell’s configuration files. Moreover, when in TeX/LaTeX mode, Aspell skips comments by default. Check out the Aspell manual for the details.
Aspell is presently not able to handle words containing special characters given in traditional ASCII notation such as F\"orster
even though improving Aspell in this direction is a prominent item in the Aspell TODO list. Furthermore, it is not possible to tell Aspell to skip specific regions such as in-line formulae or selected LaTeX environments.
As for the latter issue, a capable front-end to Aspell might come to your rescue. An example is – what a surprise ;-) – the Emacs text editor. In fact, when Emacs visits a TeX/LaTeX input file the spellchecker (which can be customized to use Aspell as back-end by setting ispell-program-name
appropriately) skips all regions matching the regular expressions specified in ispell-tex-skip-alists
. By default, in-line formulae are not skipped, though. In order for this to happen, you have to extend ispell-tex-skip-alists
in your Emacs initialization file, e.g. using the following form:
(setcar ispell-tex-skip-alists
(append
(car ispell-tex-skip-alists)
'(("[^\\]\\$" . "[^\\]\\$"))))
(setq ispell-tex-skip-alists (list (append (car ispell-tex-skip-alists) '(<...>)) (append (cadr ispell-tex-skip-alists) '(<...>))))
, where the <...>
parts are filled according to the ispell-tex-skip-alists
format. Also, it seems that $...$
is skipped by default now and so I'm using ispell-tex-skip-alists
for other purposes.
Apr 7, 2015 at 20:12
Not quite answering the question, but ispell
(rather than aspell
) ignores most math environments (with the -t
option). To get it to not be confused by new macros, see http://einstein.sc.mahidol.ac.th/~scmal/LaTeX/mspell/index.html .
Regarding your second question, there is a patch for aspell which, among other things, makes it skip inline and displayed math formulae.
The detailed description of the patch is here:
http://lists.gnu.org/archive/html/aspell-devel/2011-02/msg00000.html
Unfortunately the patch is not yet in the official repository. I'm using it anyway since I compiled aspell from the source+patch myself. And it works fine.