1

I have the following LaTeX code which has some custom macro's and environments which i would like to exclude from flyspell.

Some normal text

\begin{customenv}
Please dont flyspell-this
\end{customenv}

again some normal text (please flyspell this) and some \customcode{dont-flyspell-this}.

I know I need to write a function to pass to flyspell-mode-predicate but I'm haveing some trouble getting it to work for both the \customcode and the \begin{customenv} and \end{customenv}.

Any suggestions are welcome.

Update: It seems i can set the following:

(setq flyspell-tex-command-regexp
"\\(\\((\\(begin\\|end\\)[ \t]*{\\|\\(cite[a-z*]*\\|label\\|ref\\|eqref\\|usepackage\\|documentclass\\|customcode\\)[ \t]*\\(\\[[^]]*\\]\\)?{[^{}]*\\)\\|\\\\begin{\\(customenv[1-9]*\\)}\\(.\\|\n\\)*\\\\end{\\(customenv[1-9]*\\)}\\)")

This seems to work for the \customcode{stuff} but it still doesn't skip the text in customenv

3
  • The answer will probably look something like this.
    – legoscia
    Mar 9, 2015 at 13:30
  • 1
    indeed, however i can't seem to create a function that will work for both the custom macro and the custom enviroment at the same time. Mar 9, 2015 at 15:07
  • Could you write separate functions for the macro and the environment? If so, you can chain both easily.
    – juanleon
    Mar 10, 2015 at 8:01

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.