chktex
chktex documentation
- Version in MegaLinter: 1.7.8
- Visit Official Web Site
- See How to configure chktex rules
- If custom
.chktexrc
config file isn't found, .chktexrc will be used
- If custom
Configuration in MegaLinter
- Enable chktex by adding
LATEX_CHKTEX
in ENABLE_LINTERS variable - Disable chktex by adding
LATEX_CHKTEX
in DISABLE_LINTERS variable
Variable | Description | Default value |
---|---|---|
LATEX_CHKTEX_ARGUMENTS | User custom arguments to add in linter CLI call Ex: -s --foo "bar" |
|
LATEX_CHKTEX_COMMAND_REMOVE_ARGUMENTS | User custom arguments to remove from command line before calling the linter 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- project : Call the linter from the root of the project |
file |
LATEX_CHKTEX_FILE_EXTENSIONS | Allowed file extensions. "*" matches any extension, "" matches empty extension. Empty list excludes all filesEx: [".py", ""] |
[".tex"] |
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_UNSECURED_ENV_VARIABLES | List of env variables explicitly not filtered before calling LATEX_CHKTEX and its pre/post commands | None |
LATEX_CHKTEX_CONFIG_FILE | chktex configuration file nameUse LINTER_DEFAULT to let the linter find it |
.chktexrc |
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 |
LATEX_CHKTEX_CLI_EXECUTABLE | Override CLI executable | ['chktex'] |
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 |
MegaLinter Flavours
This linter is available in the following flavours
Flavor | Description | Embedded linters | Info | |
---|---|---|---|---|
all | Default MegaLinter Flavor | 125 |
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.8 - 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: https://savannah.nongnu.org/bugs/?group=chktex
or darthandrus@gmail.com
Press Ctrl-D to terminate stdin input.
Usage of ChkTeX v1.7.8
~~~~~~~~~~~~~~~~~~~~~~
Template
~~~~~~~~
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. A bit field with 5 bits.
Each bit shows a different type of information.
-r --reset : Reset settings to default.
-S --set : Read it's argument as if from chktexrc.
e.g., -S TabSize=8 will override the TabSize.
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 and per-file 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 before \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, ChkTeX.ps or ChkTeX.pdf:
http://www.nongnu.org/chktex/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 ghcr.io/assignuser/chktex-alpine:latest as chktex
COPY --link --from=chktex /usr/bin/chktex /usr/bin/
RUN cd ~ && touch .chktexrc && cd /