How to supress chktex errors in minted environment?

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

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

Call

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

\documentclass{article}
\usepackage{minted}
\begin{document}

\begin{minted}
a{zxx
\end{minted}

\end{document}

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.


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 mint package:

VerbEnvir
{
    verbatim comment listing lstlisting verbatimtab rawhtml errexam picture texdraw minted
}

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

Tags:

Minted

Chktex