11

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.

16

When reading the code, TeX gobbles spaces directly following a control word.

Compare

\LaTeX is great.

enter image description here

vs

\LaTeX{} is great.

enter image description here

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.

  • 1
    spaces are often essential after control words because if such a command is followed by another letter it's impossible to know where it ends without the space. and words like \TeX book are meant to not have spaces in them. – barbara beeton Sep 19 '17 at 19:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.