ispell in Emacs LaTeX mode
Asked Answered
C

6

19

When I run Emacs command ispell-buffer on an Emacs buffer which is in the LaTeX mode, ispell checks spelling also inside math expressions.

I'd very much like to disable this. Is there an easy way to do it?

I've read about detex but detex does not seem to be integrated into Emacs.

Condottiere answered 23/1, 2010 at 3:25 Comment(0)
L
8

It shouldn't do this, if you are using latexisms (eg. \[ ... \], equation environments, &c) to invoke math mode. Check the contents of ispell-tex-skip-alists; cf. section 6 of the ispell FAQ for what kind of thing should be there.

You can use $..$, $$..$$ to mark out maths using ispell-tex-skip-alists, but beware getting them out of kilter...

Postscript

Check also the value of the ispell-parser variable: this should be 'tex, otherwise ispell will not look for $...$ and $$...$$ regions.

Libra answered 24/1, 2010 at 11:17 Comment(0)
D
3

Yes, you can: install aspell instead of ispell, and use flyspell with it.

Docile answered 23/1, 2010 at 3:49 Comment(2)
He may already be doing that. The command is still called ispell in Emacs, even if it actually invokes aspell.Irinairis
Further to what @Chris said, both ispell and aspell can parse Tex maths, so this possibility isn't likely to help the qner.Libra
C
1

This doesn't answer your question directly, but I have found Flyspell, an on-the-fly spell checker, incredibly useful when editing LaTeX documents. It still spellchecks inside equations, but it is much easier to ignore a few extra red underlines than ispell's interactive commands.

Conn answered 23/1, 2010 at 3:42 Comment(0)
I
0

You may know this, but you can press A during spell checking to add a word to the buffer-local dictionary (that's capital A, lowercase a adds it to the global dictionary). It's not ideal, but this is how I usually suppress spell-checking of technical terms and variable names, etc., in my LaTeX documents.

Irinairis answered 23/1, 2010 at 16:30 Comment(0)
I
0

This AUCTeX mailing list thread : "spell checker (ispell-buffer) complains about products in math modes" has some workarounds and the answer demonstrates how to use ispell-tex-skip-alists.

Internecine answered 29/1, 2010 at 14:31 Comment(0)
I
0

Another approach is to use ispell-skip-region-alist. The following example is to exclude org-mode src blocks:

(add-to-list 'ispell-skip-region-alist '("#\\+begin_src". "#\\+end_src"))
Indefeasible answered 28/7, 2017 at 11:30 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.