Skip to main content

The PreTeXt Guide

Section D.2 Aspell

Aspell is a spell-checker which you can easily configure to skip every piece of text used as a name of an XML element, and to skip PreTeXt elements that are likely to contain text that is not really made up of words and sentences. For example, the element <chapter> might not be flagged by some mainstream spell checkers, but most likely the element <mdash/> will be flagged by every spell checker, including the default configuration of Aspell. And your <m> elements are full of , not words. Unfortunately, Aspell will not follow your xi:xinclude directives, so you need to run it against each of your files if you have modularized your source. A command-line invocation would like like:
aspell -c ~/aota/src/fish.xml
Installation on Linux should be straightforward through your distribution’s package manager. On a Mac, the executable, and a dictionary for your language, can be installed easily via MacPorts ([provisional cross-reference: macports]). Recent improvements on Windows (ca. 2019-06-06) perhaps imply that WSL or the Ubuntu Linux install may provide an easy avenue. Please report steps that result in a successful Windows installation, so we can include them here.
Configuration is achieved via a “hidden” file at the top of your home directory, namely .aspell.conf. A Mac will try to keep you away from hidden files, which are the ones whose name begins with a period. Let SublimeText give you an assist here. In Listing D.2.1 we show a first run at a useful configuration file. You definitely want to add the SGML filter, since this is what tells Aspell that you are working on XML files
 1 
SGML is the precursor of XML.
, so that all element names, attributes, etc. will not be checked. The remainder is a suggested list of PreTeXt elements to skip. Suggestions for additions are welcome here.
add-filter sgml

# elements with lots of code
# but not "pre", since it is like a "p"
add-sgml-skip c
add-sgml-skip cd
add-sgml-skip program
add-sgml-skip console
add-sgml-skip sage

# image formats
add-sgml-skip latex-image
add-sgml-skip asymptote
add-sgml-skip sageplot

# elements that display XML elements
add-sgml-skip tag
add-sgml-skip tage
add-sgml-skip attr

# initialisms and friends
add-sgml-skip init
add-sgml-skip acro
add-sgml-skip abbr

# math (latex)
add-sgml-skip m
add-sgml-skip me
add-sgml-skip men
add-sgml-skip md
add-sgml-skip mdn
add-sgml-skip usage # in "notation"

# not really content, by and large
add-sgml-skip docinfo
Listing D.2.1. Aspell Configuration File
You can run Aspell in a sort of batch, non-interactive mode by adding the -a switch and then providing your source on standard input and directing results from standard output. But I do not find it very useful.