[Tex/LaTex] \[ChkTeX\] 21: This command might not be intended. [21]


My document contains several math definitions similar to this:

some text \(\Gamma\) and the sentence continues

when I run chktex, I get a lot of warnings:

[ChkTeX] 21: This command might not be intended. [21]

The document renders correctly, what does this warning means and how should I address it?


Here is the code:

some text \(\Gamma\) and the sentence continues

Here is the minimum command line that vscode executes:

chktex -wall example.tex 

and the output:

ChkTeX v1.7.6 - Copyright 1995-96 Jens T. Berger Thielemann. 
Compiled with POSIX extended regex support. 
Warning 21 in example.tex line 3: This command might not be intended. 
some text \(\Gamma\) and the sentence continues
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.

Best Answer

This is a perfect example of where -wall can bite you with ChkTeX. This warning is simply a check for any command which is doesn't start with a letter or a space. So ) counts as that. Personally, I find this a bit silly, but I'm reluctant to completely delete it in case some people find it useful. From the documentation:

I implemented this because a friend of mine kept on making these mistakes.      
Easily done if you haven’t gotten quite into the syntax of LATEX.

\LaTeX\ is an extension of \TeX\. Right?
\LaTeX\ is an extension of \TeX. Right?

Here it's easy to see how a novice could make that mistake, and why this might be a useful warning. However, it's not the type of mistake that I have made for a long time and it causes other problems like the one you mention. I suppose I could special case \( and \), but I'm not sure that would actually be much help. Eventually you'll need to use \. or \: or ...

What I recommend is adding to your chktexrc all the warnings that you are interested in, or even start with -wall and remove the ones that aren't useful to you. Your life will be much better. At least to the extent that a simple program like ChkTeX can make it better. :) You can also add your own simple warnings (based on regular expressions).

Full Disclosure: I'm the current maintainer of ChkTeX.