[NTG-pdftex] Creating identical PDF files with different pdfTeX runs

Heiko Oberdiek oberdiek at uni-freiburg.de
Fri Mar 17 00:06:47 CET 2006


On Thu, Mar 16, 2006 at 11:06:57PM +0100, Martin Schröder wrote:

> On 2006-03-16 22:39:10 +0100, Hans Hagen wrote:
> > the second one could be an add=on for pdftex: a special log mode, where 
> > pdftex writes a file with all annotations (name, page, rectangle, maybe 
> > also the while dict) and a second one which lists all the used fonts, 
> > encoding files, map lines and glyphs (encoding subset)
> 
> I still think that this information can be found with
> \tracingoutput etc.

TeX's \tracing output is a very bad source for automatical comparisons:
TeX just prints the formatted result as text:
* Funny linebreaks.
* Sometimes the output is limited and marked by "etc.".
* Information is lost, the .log file doesn't tell the catcode
  of character tokens, even you cannot see what a token is:
    \def\msg#{\immediate\write16}
    \def\testA{\foobar}
    \msg{\string\testA: [\meaning\testA]}
    \edef\testB{\string\foobar\space}
    \msg{\string\testB: [\meaning\testB]}
    \msg{%
      \noexpand\testA and \noexpand\testB
      \ifx\testA\testB
        are equal%
      \else
        differ%
      \fi
      .%
    }
    \end
  \testA expands to one command token, the expansion of
  \testB consists of seven other token and one space token,
  But the output in the .log file is equal in both cases.
* Semantics is lost. The .log file must be analyzed to get
  some of the semantics back, what is a box listing, what is
  a macro expansion, ...

Thus it would be nice to have a debug/tracing file, where
the output is written as XML with semantics.
Then macro definitions, box contents, ... could be easier
compared and also the differences could easier be detected
and marked.

For debugging, analyzing packages it would be useful to
have a command that generates a kind of snapshot, e.g.
all macros with their meanings or the status of registers.
Then two stages, e.g before, after package loading or 
some action could be compared: which macros or registers
are differnt, ... This could be used to show the wanted
effect and to deteced unwanted side effects, ...

To retain compatibility the tracing/debug output could go
in a separate debug file with additional commands,
the counterparts of the \tracingcommands that write into the
new debug file and additional commands, such as the snapshot
commands, e.g.

\xtracingoutputfile{\jobname-debug.xml}
\xtracingmacros=1
\xtracing...
\xsnapshot{count}% all count registers <> 0
\xsnapshot{macro}% all defined command tokens with meaning
...

The result would be written to \jobname-debug.xml and can
then further processed: filtering, statistics, displaying
comparisons, displaying, ...

Yours sincerely
  Heiko <oberdiek at uni-freiburg.de>
-- 


More information about the ntg-pdftex mailing list