ChkTeX - LaTeX semantic checker

The latest version is: 1.7.5 - GPG Signature released on December 7, 2015. There are also older versions available, should they be necessary. ChkTeX is also available on CTAN and as part of TeXLive.

|             #####  ###       ###    ########     ###     ##
|           ###   ##  ##        ##       ##          ##   #
|          @@         @@ @@@    @@  @@   @@  #######  @@ @
|          @@         @@@  @@   @@ @@    @@   ##   #   @@
|          &&         &&   &&   &&&&     &&   @@      & &&
|           &&&   &&  &&   &&   && &&    &&   @@@@   &   &&
|             %%%%%  %%%   %%% %%%  %%%  %%   &&   %%%    %%% v1.7.5
|                                             &&   &
|                                            %%%%%%%


Development happens in a Subversion repository on Savannah.

Major new features of the 1.7 branch include

• Support user defined warnings written in perl compatible regular expressions or POSIX regular expressions (determined at compile time).
• Suppress errors for a single line or a file with a LaTeX comment.
• Added support for macros which change math mode such as \ensuremath and \text.
• Allow specifying Silent keywords with regular expressions
• ConTeXt \start... \stop... tracking
• DashExcpt list for exceptions to dash rules
• Use the exit status to indicate warnings were found
• Several bug fixes.

Introduction

This program has been written in frustration because some constructs in LaTeX are sometimes non-intuitive, and easy to forget. It is _not_ a replacement for the built-in checker in LaTeX; however it catches some typographic errors LaTeX oversees. In other words, it is Lint for LaTeX. Filters are also provided for checking the LaTeX parts of CWEB documents. Features are summarized below or you can read the manual (pdf).

The program also supports output formats suitable for further processing by editors or other programs, making errors easy to cycle through. The AUCTeX Emacs mode supports ChkTeX in recent versions. ChkTeX is also known to interface with LyX, and there are also 3rd party interfaces to BBEdit, TeXShop, and Sublime Text. If you would like an interface to your editor of choice, or even better if you can provide one, please let me know.

Features

ChkTeX begins to get quite a few bells and whistles now. However, you should be aware of that in most cases, all this is transparent to the user. As you will see, ChkTeX offers the ability to adapt to many environments and configurations. See the NEWS file for information about new features and when they were added.

Feature list

     * Supports over 40 warnings. Warnings include:
+ Commands terminated with space. Ignores \tt'', etc.
+ Space in front of references instead of ~''.
+ Forgetting to group parenthesis characters when
sub-/superscripting.
+ Italic correction (\/'') mistakes (double, missing,
unnecessary).
+ Parenthesis and environment matching.
+ Ellipsis detection; also checks whether to use \dots'',
\cdots'' or \ldots''.
+ Enforcement of normal space after abbreviation. Detects most
abbreviations automagically.
+ Enforcement of end-of-sentence space when the last sentence
ended with capital letter.
+ Math-mode on/off detection.
+ Quote checking, both wrong types ("'') and wrong direction.
+ Recommends splitting three quotes in a row.
+ Searching for user patterns (regular expression or literal).
+ Space in front of \label'' and similar commands.
+ Use of x'' instead of $\times$'' between numbers.
+ Multiple spaces in input which will be rendered as one space
(or multiple spaces, where that is undesirable).
+ Warns about text which may be ignored.
+ Mathematical operators typeset as variables.
+ No space in front of/after parenthesis.
+ Demands a consistent quote style.
+ Punctuation inside inner math mode/outside display math mode.
+ Use of TeX primitives where LaTeX equivalents are available.
+ Space in front of footnotes.
+ Bogus characters following commands.
* Fully customizable. Intelligent resource format makes it possible
to make ChkTeX respect your LaTeX setup. Even command-line options
may be specified globally in the chktexrc'' file.
* Warnings can be suppressed on single lines or files via LaTeX comments.
* Supports \input'' command; both TeX and LaTeX version. Actually
includes the files. TEXINPUTS''-equivalent search path.
* Intelligent warning/error handling. The user may promote/mute
warnings to suit his preferences. You may also mute warnings in
the header of a file; thus killing much unwanted garbage.
* Scripts included for checking CWEB files written in LaTeX.
(Requires perl v5).
* Supports both LaTeX 2.09 and LaTeX2e.
* Flexible output handling. Has some predefined formats and lets the
user specify his own format. Uses a printf()'' similar syntax.
lacheck'' compatible mode included for interfacing with the
AUCTeX Emacs mode.
* Wildcard matching (Amiga only). Matches file patterns internally,
thus saving a lot of work. This is, however, platform-specific
code -- on UNIX boxes this is done by the shell.
* Written in ANSI C. configure'' script included for easy setup
and installation on UNIX systems.


Still, it is important to realize that the output from ChkTeX is only intended as a guide to fixing faults. It is by no means always correct. This means that correct LaTeX code may produce errors in ChkTeX, and vice versa: Incorrect LaTeX code may pass silently through.

Acknowledgments

Many thanks to Baruch Even who has been maintaining ChkTeX by himself for quite some time. Many thanks also to the TeX Live maintainers (Peter Breitenlohner in particular) for supplying many patches, and to Antonio DiCesare for many bug reports and suggestions.

Legal stuff

   ChkTeX, documentation, installations scripts, CWEB filters and other
unless explicitly stated otherwise.

This program is free software; you can redistribute it and/or modify
the Free Software Foundation; either version 2 of the License, or (at

This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to:

The Free Software Foundation, Inc.
675 Mass Ave
Cambridge
MA 02139
USA