Excluding TeX command parameters from Aspell check

The spellchecker aspell allows to exclude certain TeX commands from spellchecking. This article shortly summarizes the configuration parameters that control this behavior. The following options can either be used on the command-line, as environmental variable ASPELL_CONF, or inside a (personal/global) configuration file.

Adding a rule

The switch for creating a rule is called add-tex-command and it accepts the command name as first parameter and a string of [opOP] as second, which configures which paramters to ignore (o,p) and which ones to check (O,P).

The following switch tells aspell not to skip the first mandatory parameter, to skip second mandatory parameter, to skip first optional parameter, and not to skip second optional paramter

Removing a rule

To remove a filter rule, use the following command:

Check TeX comments

Two special switches enable and disable the checking of TeX comments:

An example

  • aspell check –add-tex-command=”myCommand op” dummy.tex
    passes.
  • aspell check –add-tex-command=”myCommand Op” dummy.tex
    marks KittyX as error.
  • aspell check –add-tex-command=”myCommand oP” dummy.tex
    marks DogX and DearX as error.
  • aspell check –add-tex-command=”myCommand OP” dummy.tex
    marks DogX, DearX, and KittyX as errors.

Best practices

Here are some lines from my ~/.aspell.conf:

The first command serves as marker for passages that are (for example) in German:

Reference

  • [1] Filtering in Aspell
  • [2] Source for the example

Leave a Reply

Your email address will not be published. Required fields are marked *

Please type the characters of this captcha image in the input box

Please type the characters of this captcha image in the input box