ChkTeX – Why ChkTeX Complains About Space After \itshape but Not \bfseries

chktex

If I use ChkTeX for the following LaTeX source:

\documentclass{article}
\begin{document}
The quick {\itshape brown fox\/} jumps over the {\bfseries lazy dog}.
\end{document}

then I get a warning:

ChkTeX v1.7.6 - Copyright 1995-96 Jens T. Berger Thielemann.
Compiled with PCRE regex support.
Warning 1 in test.tex line 3: Command terminated with space.
The quick {\itshape brown fox\/} jumps over the {\bfseries lazy dog}.
                   ^
No errors printed; One warning printed; No user suppressed warnings; No line suppressed warnings.
See the manual for how to suppress some or all of these warnings/errors.

I know what ChkTeX means and I can remove/suppress this warning by

  • inserting {} just after \itshape (though it inserts an extra space),
  • per line suppression, % chktex 1, or
  • adding \itshape in the Silent section of the custom chktexrc file.

But my question is why \itshape is not listed in Silent of the default chktexrc, while \bfseries and \slshape etc. are there.

Is there some typesetting reason to separate \itshape from other commands like \bfseries and \slshape? Or is it just missing in the default chktexrc, which is an issue that should be fixed in the ChkTeX repository?

Best Answer

Full disclosure: I am the current maintainer of ChkTeX.

I don't know of any reason for \itshape not to be in Silent, but it was written a long time ago (several maintainers ago) and I have not done a good job of keeping it up to date. Frankly, like @david-carlisle, I don't find that particular warning that helpful and so I have turned off. That means I don't find any of these false positives and so I don't add them to the default chktexrc. It's sort of a self-perpetuating cycle.

I think you should do or more of the following:

  1. Turn off the warning if you don't find it helpful in general.
  2. Add \itshape to Silent in your local chktexrc.
  3. Open a bug report.
    • Unfortunately, I haven't given ChkTeX the time it needs lately and so I have several bugs to get through at the moment.
    • Though I did just add this since it's so simple. :)
  4. Add line or file suppressions if it's an exception to the rule and/or you just can't be bothered to do anything else.
Related Question