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

add-tex-command myCommand PpoO
--add-tex-command="myCommand PpoO"

Removing a rule

To remove a filter rule, use the following command:

rem-tex-command myCommand

Check TeX comments

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


An example


\def\@with[#1]#2{Hello #1, have you met #2?}
\def\@without#1{Goodbye #1.}

\myCommand[KittyX]{the DogX}
\myCommand{my DearX}
  • aspell check –add-tex-command=”myCommand op” dummy.tex
  • 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:

add-tex-command aspellNoCheck p
add-tex-command citep op
add-tex-command citet op
add-tex-command nomenclature opP # don't check the sort key and the abbreviation
add-tex-command url p

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



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

Leave a Reply