Why does chktex lint "command terminated with space"?
Applying {}
to the command will disable the lint, but this is tedious to do for all commands.
When reading the code, TeX gobbles spaces directly following a control word.
Compare
\LaTeX is great.
vs
\LaTeX{} is great.
In this case a warning makes sense.
I am assuming TeX was designed this way because in TeX programming it improves readability if you are able to insert spaces.
Please note that spaces are ignored after control words only, not after control characters or active characters. Consequently ~␣
would insert two spaces and should therefore be avoided.
A control word starts with exactly one character of catcode 0 (usually \
) and is followed by an arbitrary number (greater than 0) of characters of catcode 11 (letter).
Example: \LaTeX
A control character starts with exactly one character of catcode 0 (usually \
) and is followed by exactly one characters which has not catcode 11 (letter).
Examples: \␣
, \&
An active character is exactly one character of catcode 13.
Example: ~
For characters with math code active (for example '
) this is irrelevant because spaces are always ignored in math mode, anyway.
\TeX book
are meant to not have spaces in them.
Commented
Sep 19, 2017 at 19:25
chktex
dislike that and want it to be \TeX{}book
(or some other acceptable form for it) :s