Search code examples
emacselisporg-modeauctexflyspell

FlySpell in Org-Mode recognize latex syntax like auctex


Original Response: I was trying to figure out how in auctex mode latex doesn't seem to highlight any latex functions with flyspell turned on. Is this a custom dictionary file or how is this implemented? Can this be easily incorporated into an org-mode file so it doesn't highlight inserted latex code that will get exported.

Edit: Simple example taken from top of file and in the text. Basically so latex syntax like ref or label inside {} won't be spell checked (this has been fixed by using (setq ispell-parser tex). Then also setting up a function that specific labels with #+ as the first text on the line won't be checked. I would want the caption checked but not #+LABEL: or #+TYP_TODO: (not shown. Also a way to add TODO keywords to not get checked. I can think of a way to do this is on startup add these to the LOCALWORDS: ispell places at the bottom of the file if not already there but is there an easier or better way to do this.

#+TAGS: NOTE REPORT export noexport MEETING
#+TYP_TODO: TODO Weekly WAITING NEXT | Meeting DONE
#+STARTUP: hidestars content hideblocks

The exponential running mean is shown for various alpha values in Figure \ref{fig:saturation_varying_alphaval_00f6set2}.  
     #+CAPTION:    Plot of varying alpha values for the exponential running mean ($EM$) with $S_{min} = 0.0008 \text{ and } P_m = 0.20$
     #+LABEL:      fig:saturation_varying_alphaval_00f6set2
     #+ATTR_LaTeX: width=0.4\textwidth placement=[h!tb]

Solution

  • flyspell internally uses ispell-mode. To change the way that ispell parses files set the variable ispell-parser to 'tex.

    (add-hook 'org-mode-hook (lambda () (setq ispell-parser 'tex)))