Is there a way to make chktex play nice with the minted package? Right now, it seems to assume that normal checks apply to the content of the minted environments and produces a lot of warnings.

2 Answers 2


Prepare a file called chktexrc.local in the same directory as the file you have to check, containing

    verbatim comment listing verbatimtab rawhtml errexam picture texdraw
    filecontents pgfpicture tikzpicture minted


chktex -l chktexrc.local filename.tex

(where filename stands for the name of the file, of course).

I tested it with the file gregoire.tex




and the normal call of chktex gregoire.tex gives

ChkTeX v1.7.4 - Copyright 1995-96 Jens T. Berger Thielemann.
Compiled with POSIX extended regex support.
Warning 15 in  line 6: No match found for `{'.

Warning 17 in gregoire.tex line 9: Number of `{' doesn't match the number of `}'!

whereas the call chktex -l chktexrc.local gregoire.tex produces

ChkTeX v1.7.4 - Copyright 1995-96 Jens T. Berger Thielemann.
Compiled with POSIX extended regex support.
No errors printed; No warnings printed; No user suppressed warnings; No line suppressed warnings.

Note: the VerbEnvir list in the default chktexrc file doesn't cover several other “verbatim-like” environments; it has been updated for pgfpicture and tikzpicture, but it misses several other common environments such as those provided by listings and fancyvrb. However, the list cannot be complete, as these packages allow for defining new environments; probably adding

Verbatim BVerbatim lstlistings

would be useful nonetheless.

  • 2
    If you call it .chktexrc (or chktexrc on Windows), you don't have to use the -l option, it will be picked up automatically. Sep 23, 2015 at 4:24
  • @IvanAndrus Sure, but I don't like the proliferation of invisible files.
    – egreg
    Sep 23, 2015 at 7:25
  • Should be lstlisting instead of listings.
    – khatchad
    Dec 29, 2015 at 2:17
  • @RaffiKhatchadourian The code is simply copied from the default chktexrc file with the addition of minted. If one wants to also cover lstlisting, also this name must be added; but the question didn't mention it. I'm displeased by the downvote, but the answer is correct as it stands.
    – egreg
    Dec 29, 2015 at 10:44
  • 1
    @RaffiKhatchadourian You can add \mintinline:{}{} to the WipeArg list and \mintinline{python}{print(x**2)} would be ignored. Otherwise it just warns about a parenthesis without a space in front of it.
    – egreg
    Jan 1, 2016 at 22:08

You can use the default chktexrc found here (store in your directory as .chktexrc or use the global one). I changed the following in this file to accommodate the minted package:

    verbatim comment listing lstlisting verbatimtab rawhtml errexam picture texdraw minted

    \label:{} \ref:{} \vref:{} \pageref:{} \index:{} \cite:[]{}
    \input:{} \verbatiminput:[]{} \listinginput:[]{}{}
    \verbatimtabinput:[]{} \include:{} \includeonly:{} 
    \bibitem:[]{} \mintinline:[]{}{}

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.