Skip to content


chktex documentation

Configuration in MegaLinter

Variable Description Default value
LATEX_CHKTEX_ARGUMENTS User custom arguments to add in linter CLI call
Ex: -s --foo "bar"
LATEX_CHKTEX_FILTER_REGEX_INCLUDE Custom regex including filter
Ex: (src\|lib)
Include every file
LATEX_CHKTEX_FILTER_REGEX_EXCLUDE Custom regex excluding filter
Ex: (test\|examples)
Exclude no file
LATEX_CHKTEX_CLI_LINT_MODE Override default CLI lint mode
- file: Calls the linter for each file
- list_of_files: Call the linter with the list of files as argument
- project: Call the linter from the root of the project
LATEX_CHKTEX_FILE_EXTENSIONS Allowed file extensions. "*" matches any extension, "" matches empty extension. Empty list excludes all files
Ex: [".py", ""]
LATEX_CHKTEX_FILE_NAMES_REGEX File name regex filters. Regular expression list for filtering files by their base names using regex full match. Empty list includes all files
Ex: ["Dockerfile(-.+)?", "Jenkinsfile"]
Include every file
LATEX_CHKTEX_PRE_COMMANDS List of bash commands to run before the linter None
LATEX_CHKTEX_POST_COMMANDS List of bash commands to run after the linter None
LATEX_CHKTEX_CONFIG_FILE chktex configuration file name
Use LINTER_DEFAULT to let the linter find it
LATEX_CHKTEX_RULES_PATH Path where to find linter configuration file Workspace folder, then MegaLinter default rules
LATEX_CHKTEX_DISABLE_ERRORS Run linter but consider errors as warnings false
LATEX_CHKTEX_DISABLE_ERRORS_IF_LESS_THAN Maximum number of errors allowed 0

IDE Integration

Use chktex in your favorite IDE to catch errors before MegaLinter !

IDE Extension Name Install
Atom linter-chktex Visit Web Site
Visual Studio Code latex-workshop Install in VsCode

MegaLinter Flavours

This linter is available in the following flavours

Flavor Description Embedded linters Info
all Default MegaLinter Flavor 105 Docker Image Size (tag) Docker Pulls

Behind the scenes

How are identified applicable files

  • File extensions: .tex

How the linting is performed

  • chktex is called one time by identified file (file CLI lint mode)

Example calls

chktex -q myfile.tex
chktex -q -l .chktexrc myfile.tex

Help content

ChkTeX v1.7.6 - Copyright 1995-96 Jens T. Berger Thielemann.
Compiled with POSIX extended regex support.
ChkTeX comes with ABSOLUTELY NO WARRANTY; details on this and
distribution conditions in the GNU General Public License file.
Type "ChkTeX -h" for help, "ChkTeX -i" for distribution info.
Author: Jens Berger.
Bug reports:
Press Ctrl-D to terminate stdin input.

                         Usage of ChkTeX v1.7.6

chktex [-hiqrW] [-v[0-...]] [-l <rcfile>] [-[wemn] <[1-42]|all>]
       [-d[0-...]] [-p <name>] [-o <outfile>] [-[btxgI][0|1]]
       file1 file2 ...

                       Description of options:
Misc. options
    -h  --help      : This text.
    -i  --license   : Show distribution information
    -l  --localrc   : Read local .chktexrc formatted file.
    -d  --debug     : Debug information. Give it a number.
    -r  --reset     : Reset settings to default.

Muting warning messages:
    -w  --warnon    : Makes msg # given a warning and turns it on.
    -e  --erroron   : Makes msg # given an error and turns it on.
    -m  --msgon     : Makes msg # given a message and turns it on.
    -n  --nowarn    : Mutes msg # given.
    -L  --nolinesupp: Disables per-line suppressions.

Output control flags:
    -v  --verbosity : How errors are displayed.
                      Default 1, 0=Less, 2=Fancy, 3=lacheck.
    -V  --pipeverb  : How errors are displayed when stdout != tty.
                      Defaults to the same as -v.
    -s  --splitchar : String used to split fields when doing -v0
    -o  --output    : Redirect error report to a file.
    -q  --quiet     : Shuts up about version information.
    -p  --pseudoname: Input file-name when reporting.
    -f  --format    : Format to use for output

Boolean switches (1 -> enables / 0 -> disables):
    -b  --backup    : Backup output file.
    -x  --wipeverb  : Ignore contents of `\verb' commands.
    -g  --globalrc  : Read global .chktexrc file.
    -I  --inputfiles: Execute \input statements.
    -H  --headererr : Show errors found in front of \begin{document}

Miscellaneous switches:
    -W  --version   : Version information

If no LaTeX files are specified on the command line, we will read from
stdin.   For explanation of warning/error messages, please consult the
main documentation ChkTeX.dvi, or ChkTeX.pdf:

Any of the above arguments can be made permanent by setting them in the
chktexrc file (~/.chktexrc).

Installation on mega-linter Docker image

  • Dockerfile commands :
FROM as chktex
COPY --from=chktex /usr/bin/chktex /usr/bin/
RUN cd ~ && touch .chktexrc