Short:    Finds common errors in (La)TeX files
Author:   <jensthi@ifi.uio.no> (Jens T. Berger Thielemann)
Uploader: <jensthi@ifi.uio.no> (Jens T. Berger Thielemann)
Type:     text/tex

             #####  ###       ###    ########     ###     ##
           ###   ##  ##        ##       ##          ##   #
          @@         @@ @@@    @@  @@   @@  #######  @@ @
          @@         @@@  @@   @@ @@    @@   ##   #   @@
          &&         &&   &&   &&&&     &&   @@      & &&
           &&&   &&  &&   &&   && &&    &&   @@@@   &   &&
             %%%%%  %%%   %%% %%%  %%%  %%   &&   %%%    %%% v1.0
                                             &&   &
                                            %%%%%%%
                             ChkTeX v1.0
                             ~~~~~~~~~~~
This  program  was  written  in frustration of that some constructs in
LaTeX are sometimes non-intuitive, and easy to forget.  It was written
in  ANSI  C,  so  you  could use this at your UNIX/MSDOS/whatever site
also.  Full source included.

In  the  Amiga  version,  however,  the  program  is  localized.   The
localization was created by using C2LOCAL, the automatically generated
source  code  is  not  included.  A catalog for Norwegian is included,
plus a skeleton for further translation.

The  program  itself  does not have any machine requirements, an Amiga
compiled  version is included which should work on all Amigas.  You'll
get translations only on 2.1+, though.

                             Legal stuff
                             ~~~~~~~~~~~
ChkTeX,  its  documentation and its installation scripts are copyright
(C) 1995 Jens T. Berger Thielemann.

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.

                         Errors searched for
                         ~~~~~~~~~~~~~~~~~~~
Currently,  it  will  catch  the  following  errors,  the  error being
underlined:

----------------------------------------------------------------------

  \LaTeX is a typesetting package.
        ^
Most probably, you would like this to look like this:

  \LaTeX\ is a typesetting package.

An  environment  file  tells ChkTeX which commands that may end with a
normal  space,  like  `\bf'  or  similar, which don't produce any text
output.  In math mode, this checking is of course turned off.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  Please refer to figure \ref{foo}.
                        ^
This should rather look like this:

  Please refer to figure~\ref{foo}.

An  environment  file  tells  ChkTeX  which  commands  that  should be
prefaced with a non-breaking space.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  This is an example of use of accents: \'{i}.

This will not look pretty.  It should rather be:

  This is an example of use of accents: \'{\i}.

It  does also try to differ between whether we're in math mode or not.
It  is possible to customize which functions which needs the use of \i
or \j.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  This is an example, i.e. an demonstration.
                          ^
This will cause incorrect spacing, and should be written as:

  This is an example, i.e.\ an demonstration.

The  abbrevs  which  you wish to search for, are of course kept in the
very same env-file.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  I've seen an UFO! Right over there!
                   ^
Will once more cause incorrect spacing, it should read:

  I've seen an UFO\@! Right over there!

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  I don't know quite...I think it's wrong.

This ellipsis will not look good.  You should rather write:

  I don't know quite\ldots I think it's wrong.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  It wasn't anything - just a 2---3 star--shots, or something else.
                     ^         ^^^      ^^
In  all  cases,  an  incorrect dash-length was used, it should be like
this:

  It wasn't anything --- just a 2--3 star-shots, or something else.

This  check  is  rather  vague, as it will only check the character in
front of the dashes.  It uses the following table:

    o If the dashes are leaded by a space, there should be three `-'s.
    o If the dashes are leaded by a digit, there should be two `-'s.
    o If the dashes are leaded by a character, there should be one `-'.

This  is  more or less correct, according to my references.  Hopefully
this check can be improved (suggestions?).

----------------------------------------------------------------------

Wherever  `a space' is mentioned, we'll of course also detect tabs and
other spacing characters recognized by isspace().

In addition, it will keep track of brackets characters (`{}[]()'), and
make  sure  that  they  match.   Everything  found is of course pumped
nicely to stdout, with line number and error position.

To  get  a quick demonstration of ChkTeX' features, run it on the file
`Test.tex'.   Although  most  of  the  file  is nonsense in a TeXnical
manner  (lots  of  pseudo-commands),  it  will show what ChkTeX has to
offer.

                       Porting and translation.
                       ~~~~~~~~~~~~~~~~~~~~~~~~
Porting  should  be  rather easy.  However, to ensure that the porting
proceeds  painless,  read the first lines of the `ChkTeX.h' file.  Not
very much to do, and it will make life easier later.

If you wish to translate the strings used in the programs (should only
need  5  minutes of work), look in the Catalogs directory.  Write your
translations  in  the  file ChkTeX_locale.ct, and mail it to me.  I'll
include it in the next release.  In advance, thanks for your support.

                                Usage
                                ~~~~~
Easy-peasy:

ChkTeX <TeX-file>

No  options  -  currently.   You  should,  however, take a look at the
`.chktexrc'  file.   It  is  located  in `ENV:' and `ENVARC:' on 2.04+
Amiga's,  in  `S:'  on  1.3  Amiga's,  in your $HOME directory on UNIX
boxes.   This  depends  also upon what you did to the `ChkTeX.h' file.
It  should  be  rather self-explanatory, and should help you customize
the program to your own needs.

                                 Bugs
                                 ~~~~
No  fatal  ones,  I think, but the program currently has some problems
when  a command/parameter stretch over a two lines.  Also, the killing
of comments is still at bit brutal (but correct :-) ).

The  detection of whether we're in math mode is also not perfect.  The
only  codes  which are recognized for getting in/out of math mode are:
`$',   `$$',   `\(',   `\)',   `\['   and   `\]'.   Environments  like
\begin{displaymath},  user-defined  commands,  etc., do thus not work.
This  is  usually  no  problem, as it just creates a bit more warnings
than needed.



                        Contacting the author
                        ~~~~~~~~~~~~~~~~~~~~~
If  you  wish  to  contact  me  for whatever (more tests, bug reports,
suggestions, hellos, smiley's, etc.), write to:

  Jens Berger
  Spektrumvn. 4
  N-0666 Oslo
  Norway

  E-mail: <jensthi@ifi.uio.no>

Any signs of intelligent life is welcomed; that should exclude piracy.

Have fun.
