Received: by nummer-3.proteosys id <01C19443.993D9A8C@nummer-3.proteosys>; Thu, 3 Jan 2002 11:44:19 +0100 In-Reply-To: <01GFX9HI6BWWA23BGU@MATH.AMS.COM> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----_=_NextPart_001_01C19443.993D9A8C" Return-Path: <@vm.gmd.de:LATEX-L@DHDURZ1.BITNET> X-MimeOLE: Produced By Microsoft Exchange V6.5 x-vm-v5-data: ([nil nil nil nil nil nil nil nil nil][nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil]) Content-class: urn:content-classes:message Subject: Re: Validating LaTeX output Date: Fri, 31 Jan 1992 00:11:04 +0100 Message-ID: X-MS-Has-Attach: X-MS-TNEF-Correlator: From: "Michael Downes" Sender: "LaTeX-L Mailing list" To: "Rainer M. Schoepf" Reply-To: "LaTeX-L Mailing list" Status: R X-Status: X-Keywords: X-UID: 561 This is a multi-part message in MIME format. ------_=_NextPart_001_01C19443.993D9A8C Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable > With the trip and trap tests Don Knuth has given us a tool to validate > TeX and Metafont. But up to now there is no similar tool to validate > LaTeX (nor any other macro package). Identical output from a given document can be reliably expected if ---The same version of TeX is used. However, for most documents, versions 2.9 (2.8? 2.7?) and later are functionally identical. ---The macro files that are loaded are identical. (Including any that are preloaded in a format file.) ---The TFM files used are identical. ---The document file itself is not changed (for example, garbled characters caused by e-mail transfer). If a document does not need to be edited, then discrepancies can be avoided by sending the DVI file instead of the .tex file as Bernard said. But you may still have to worry about TFM checksum discrepancies when you print it. And it is sometimes inconvenient to deal with encoding and decoding a DVI file for e-mail transfer. (On the other hand, it is more convenient in that the recipient doesn't need to re-typeset the document.) Comparing DVI files is the most reliable way of validating the output of a document. But other methods of validation that could be carried out during the typesetting of a document could be more helpful in locating the exact whereabouts of a discrepancy. If, for example, the version number and date for each loaded macro file were written into the log file, then a simple 'diff' of log files could be used to check for discrepancies ... except for the directory name problem, of course, and some upper/lowercase discrepancies between different operating systems. In the AMS in-house TeX-based system, I am in the process of writing macro file management macros, where each file records its version number and date in a unique control sequence (=3D the file name itself). Using this idea, latex.tex would create the control sequence \csname latex.tex\endcsname whose replacement text would be 2.09 <1 December 1991> and all other macro files must do the same. LaTeX would then be able to check all version numbers at the same time by maintaining a list of all loaded files (this involves preventing use of the primitive \input except through an intermediate function that adds the file name to the list): \@elt{lplain.tex}\@elt{lhyphen.tex}\@elt{lfonts.tex}\@elt{latex.tex}... and then a version consistency check can be made by including the statement \versioncheck{(lplain.tex 2.09 <1 December 1991)(lhyphen.tex ...} in the preamble of the document, with \versioncheck defined as \def\versioncheck#1{\def\@tempa{#1}% \def\@elt##1{(##1 \csname##1\endcsname)}% \edef\@tempb{\filelist}% \ifx\@tempa\@tempb % Then OK \else \errmessage{File version discrepancy: ...}% \fi \let\@elt\relax } This relies on conscientious updating of version numbers and dates in all macro files, and each file must define its own control sequence name to hold the version number and date. Therefore we can probably expect this method of checking to fail fairly often. But when it does work it will quickly give an accurate picture of where the discrepancies lie. Defining \csname filename\endcsname for each file also makes it easy to tell whether a file has already been loaded by using \@ifundefined{filename}. Frank's CheckSum produced by the 'doc' option would be useful for detecting file transmission errors or failure to update file version numbers and dates, but requires all files to be processed with the doc option. If this can be achieved in the future it should be very helpful. As for TFM files, it would be nice if their checksums were available to TeX via \fontdimen0, which is currently noexistent/inaccessible (even if you try to create it immediately after loading the font). Then a similar sort of check could be made by LaTeX for TFM consistency (lfonts.tex has already for many years used \fontdimen's to check consistency between the line and circle fonts, as you all probably know). But would a TFM checksum in sp units exceed \maxdimen? I haven't checked. Similarly, it might be useful if TeX made available control sequences like \texversion and \formatname and \formatdate that would hold, respectively, the strings "C Version 3.1", "plain", and "91.1.4" >from the following representative startup message: This is TeX, C Version 3.1 (format=3Dplain 91.1.4) 6 JAN 1992 08:49 The question of what to do when a discrepancy is detected and you still want to typeset the document remains open. Whoever has the more recent copy of the file(s) in question should send it to the other person? If it's a file that was preloaded in the format file then maybe you'll have to rebuild the format file. Garbled characters caused by file transfers: Here's an interesting TeX challenge: Can you define a macro to be used at the beginning of a document to check whether such a problem has occurred? Offhand, I think it shouldn't be too hard. (Probably it is safe to assume that the backslash character has passed through unchanged, but better if you don't assume curly braces { } are unchanged.) Michael Downes mjd@math.ams.com (Internet) ------_=_NextPart_001_01C19443.993D9A8C Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Re: Validating LaTeX output

> With the trip and trap tests Don Knuth has given = us a tool to validate
> TeX and Metafont. But up to now there is no = similar tool to validate
> LaTeX (nor any other macro package).

Identical output from a given document can be reliably = expected if

---The same version of TeX is used. However, for most = documents,
versions 2.9 (2.8? 2.7?) and later are functionally = identical.

---The macro files that are loaded are identical. = (Including
any that are preloaded in a format file.)

---The TFM files used are identical.

---The document file itself is not changed (for = example, garbled
characters caused by e-mail transfer).

If a document does not need to be edited, then = discrepancies can be
avoided by sending the DVI file instead of the .tex = file as Bernard
said. But you may still have to worry about TFM = checksum discrepancies
when you print it. And it is sometimes inconvenient = to deal with
encoding and decoding a DVI file for e-mail transfer. = (On the other
hand, it is more convenient in that the recipient = doesn't need to
re-typeset the document.)

Comparing DVI files is the most reliable way of = validating the output
of a document. But other methods of validation that = could be carried
out during the typesetting of a document could be = more helpful in
locating the exact whereabouts of a discrepancy. If, = for example, the
version number and date for each loaded macro file = were written into
the log file, then a simple 'diff' of log files could = be used to check
for discrepancies ... except for the directory name = problem, of
course, and some upper/lowercase discrepancies = between different
operating systems.

In the AMS in-house TeX-based system, I am in the = process of writing
macro file management macros, where each file records = its version
number and date in a unique control sequence (=3D the = file name itself).
Using this idea, latex.tex would create the control = sequence

  \csname latex.tex\endcsname

whose replacement text would be

  2.09 <1 December 1991>

and all other macro files must do the same. LaTeX = would then be able
to check all version numbers at the same time by = maintaining a list of
all loaded files (this involves preventing use of the = primitive \input
except through an intermediate function that adds the = file name to the
list):

\@elt{lplain.tex}\@elt{lhyphen.tex}\@elt{lfonts.tex}\@elt{latex.= tex}...

and then a version consistency check can be made by = including
the statement

  \versioncheck{(lplain.tex 2.09 <1 December = 1991)(lhyphen.tex ...}

in the preamble of the document, with \versioncheck = defined as

\def\versioncheck#1{\def\@tempa{#1}%
  \def\@elt##1{(##1 = \csname##1\endcsname)}%
  \edef\@tempb{\filelist}%
  \ifx\@tempa\@tempb % Then OK
  \else \errmessage{File version discrepancy: = ...}%
  \fi
  \let\@elt\relax }

This relies on conscientious updating of version = numbers and dates in
all macro files, and each file must define its own = control sequence
name to hold the version number and date. Therefore = we can probably
expect this method of checking to fail fairly often. = But when it does
work it will quickly give an accurate picture of = where the
discrepancies lie.

Defining \csname filename\endcsname for each file also = makes it easy
to tell whether a file has already been loaded by = using
\@ifundefined{filename}.

Frank's CheckSum produced by the 'doc' option would be = useful for
detecting file transmission errors or failure to = update file version
numbers and dates, but requires all files to be = processed with the doc
option. If this can be achieved in the future it = should be very
helpful.

As for TFM files, it would be nice if their checksums = were available
to TeX via \fontdimen0, which is currently = noexistent/inaccessible
(even if you try to create it immediately after = loading the font).
Then a similar sort of check could be made by LaTeX = for TFM
consistency (lfonts.tex has already for many years = used \fontdimen's
to check consistency between the line and circle = fonts, as you all
probably know). But would a TFM checksum in sp units = exceed \maxdimen?
I haven't checked.

Similarly, it might be useful if TeX made available = control sequences
like \texversion and \formatname and \formatdate that = would hold,
respectively, the strings "C Version 3.1", = "plain", and "91.1.4"
>from the following representative startup = message:

  This is TeX, C Version 3.1 (format=3Dplain = 91.1.4)  6 JAN 1992 08:49

The question of what to do when a discrepancy is = detected and you
still want to typeset the document remains open. = Whoever has the
more recent copy of the file(s) in question should = send it
to the other person? If it's a file that was = preloaded in
the format file then maybe you'll have to rebuild the = format file.

Garbled characters caused by file transfers: Here's an = interesting TeX
challenge: Can you define a macro to be used at the = beginning of a
document to check whether such a problem has = occurred? Offhand, I
think it shouldn't be too hard. (Probably it is safe = to assume
that the backslash character has passed through = unchanged, but
better if you don't assume curly braces { } are = unchanged.)

Michael = Downes           &= nbsp;           &n= bsp;      mjd@math.ams.com (Internet)

------_=_NextPart_001_01C19443.993D9A8C--