ChkTeX v1.6.1

Jens T. Berger Thielemann

1  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.

It is written in ANSI C and compiles silently under GCC using ``-Wall -ansi -pedantic'' and almost all warning flags. This means that you can compile & use the program on your favorite machine. Full source included.

The program also supports output formats suitable for further processing by editors or other programs, making errors easy to cycle through. Software is provided for beautifully interfacing against the AUC-TeX Emacs mode, CygnusED, GoldEd and various Amiga message browsers.

The program itself does not have any machine requirements; Amiga, MSDOS and OS/2 binaries are available. Of course, you'll need ARexx and ScMsg or VBrowse to benefit from the ARexx scripts.

2  Features

ChkTeX begins to get quite a few bells & 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.

2.1  New features

Modifications and additions since v1.6: Modifications and additions since v1.5: Modifications and additions since v1.4:

2.1.1  Program

Modifications to the executable itself:

2.1.2  Resource file

New concepts introduced in the setup file:

2.1.3  Other

Various other stuff I've done to the product:

2.2  Feature list

Still, it is important to realize that the output from ChkTeX is only intended as a guide to fixing faults. However, 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.

3  Legal stuff

ChkTeX, documentation, installations scripts, CWEB filters and other materials provided are copyright © 1995--96 Jens T. Berger Thielemann, unless explicitly stated otherwise.

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

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

3.1  Registration

`ChkTeX' is made available under the concept of Gift-Ware, which is a variant of Share-Ware. Share-Ware software authors often release `crippled' versions of their products, i.e. these programs do not support the same functionality as the registered versions you get when sending monetary contributions to the authors. It all comes down to `pay for the software you are using' in Share-Ware terms. With Gift-Ware registration it is different, you are not required to contribute money, but a gift will do. With `ChkTeX' you always get a fully functional program, there is no `crippled' test release which you can try for a limited time and then have to pay for in order to receive the working registered version.

It may seem as if `ChkTeX' was free, but this is not the case. Although there is no need to pay the author in order to get a fully functional version of the program you should consider making a contribution. You don't need to feel guilty if you cannot or do not want to give me something in return for the work I have put into `ChkTeX'. Show me that it was worth spending so much time listening to users, updating, rewriting and enhancing this program. Your contributions will provide the motivation for me to keep developing the program.

Send your contribution to the following address:
Jens Berger
Spektrumvn. 4
N-0666 Oslo
Norway
HTML

4  Availability

This program will be uploaded to CTAN; thus it can be found at any mirrors of those.

5  Installation

A few words on installation on various platforms:
Amiga:
Use the supplied Installer script.
MS-DOS & OS/2:
Copy the binary (``ChkTeX.exe'') to somewhere in your path, and place the ``chktexrc'' file in the same directory.

If you're running Emacs, you may wish to copy the file ``chktex.el'' to your elisp source directory, and add the following line to your ``.emacs'' file:
(require 'chktex)


UNIX:
Type ``configure'', ``make'' and finally ``make install''. To make sure everything proceeded correctly, type ``make check''. If you don't have superuser privileges and thus access to the default system areas, you should type ``configure --help'' to help you set up correct paths.

If you haven't installed any software like this before, that is distributed in source form, here are some guidelines to help you install it locally at your account. Please note that a mail to the system administrator may be less work for you. :-)

We assume that you have put the archive (``chktex.tar.gz'') in a subdir of yours, with path ``~/tmp''. We further assume that your shell is ``csh'' or ``tcsh''. Do the following:
  1. First of all, unpack the archive contents.
    > cd ~/tmp
    > gunzip chktex.tar.gz
    > tar xf chktex.tar
    
  2. Now, we can configure the program. There are some configuration options you should know about:
    ``--enable-emacs-hack'':
    Install a small file which adds ChkTeX to the command menu of AUC-TeX. This is to be considered as a hack, and may break in future versions of AUC-TeX. It works fine under AUC-TeX v2.9, though.

    This option needs the path of your elisp directory as argument, e.g. ``--enable-emacs-hack=/home/myself/elisp'' or similar.

    You'll also have to add the following line to your ``.emacs'' file:
    (require 'chktex)
    
    You can now access ChkTeX from the ``Command'' menu in AUC-TeX. To cycle through the messages, type C-x `.

    ``--enable-lacheck-replace''
    This enables a quick hack for making the AUC-TeX Emacs mode use ChkTeX instead of lacheck. This is done by installing a stub script which ``overrides'' the original lacheck executable.

    While more stable than the previous solution, this is also significantly less elegant --- in computing terms, this is the ``brute force'' approach.

    ``--enable-debug-info''
    ChkTeX has an ability to spit out various diagnostic messages using the ``-d'' flag. This behaviour is on by default. By adding the flag ``--disable-debug-info'' to the commandline, this will not be compiled in.

    This may be useful if you're running short of disk space (the time savings are neglible).

    If you are installing the program on your local account, use the following command:
    > configure --prefix ~/
    
    Add eventual extra flags as specified above. This command will generate a significant amount of output, this can usually be ignored.

  3. Finally, we can just build the program and install it.
    > make
    > make install
    
  4. Finished! The program is now installed and ready to use. You may now tell other people to put your bindir in their path in order to benefit from your work. All that remains is to make the shell aware of your installation.
    > rehash
    
    To make the remaining parts of your system aware of this, you'll have to log out and re-log in, I'm afraid. However, you should delay this until you've completed this installation procedure.

  5. If you wish to make sure that everything is OK (you ought to), you may now ask ChkTeX to do a self-test:
    > make check
    


Other platforms:
First of all, you have to copy the ``config.h.in'' file to a file named ``config.h''. Then, edit it to reflect your system. Do the same with ``OpSys.h'' (this file has been reduced significantly). If you wish, you may define ``DATADIR'' to the path you want the global resource file to be put.

Now, I would suggest that you take a peak at the ``OpSys.c'' file, and edit it appropiately, for more comfort. This should not be necessary, though, at least not the first time.

Finally, you may now compile and link all.c@ files. Define ``HAVE_CONFIG_H'' to 1 (on the command-line, for instance). If the ``config.h'' you wish to use has another name, define ``CONFIG_H_NAME'' to that (in that case, don't define ``HAVE_CONFIG_H'').

Put the directory path of the ``chktexrc'' file in a environment variable named ``CHKTEXRC''. The files ``deweb.in'' and ``chkweb'' should be moved to a directory in your path. These files may need further setup, as they haven't got the location of perl initialized.

If your compiler/the compiled program complains (or crashes!), you may try the hints listed below. Please note that it only makes sense to try these hints if your compiler fails to produce a working program.
  1. Increase the preprocessor buffers and line buffers. The ChkTeX sources define macros sized 3--4k (expanding to about the same), and passes arguments sized about 1k.
  2. Use the magic switch which lets us use large ``switch(...){...}'' statements; some of these statements have about 120 ``case'' entries.
  3. The sources require that at least the first 12 of each identifier is significant.
Note: You must install the new ``chktexrc'' file; ChkTeX will fail to function unless!

After doing this, you may enhance ChkTeX' behaviour by reading/editing the ``chktexrc'' file.

6  Contacting the author

If you wish to contact me for any reason or would like to participate in the development of ChkTeX, please write to:
Jens Berger
Spektrumvn. 4
N-0666 Oslo
Norway
E-mail: <jensthi@ifi.uio.no>
Any signs of intelligent life are welcomed; that should exclude piracy.

Since the original author is unreachable, the maintainer these days is:
Baruch Even
E-mail: <chktex@ev-en.org>

Have fun.


This document was translated from LATEX by HEVEA.