[OS X TeX] The metadata is in the log file

Joachim Kock jkock at start.no
Mon Sep 13 22:56:53 CEST 2004

Hello again,

since the question of document-root tags is in the air, and also in
connection with recent discussions about getting rid of auxiliary files
like log files, I would like to keep you informed about recent developments
in tetexComm, Alpha's alternative interface to tetex.

The slogan is that the metadata is in the log file!

Of course this is just a slogan, and not a claim that the log file should
be the solution to the metadata problem, but it does illustrate a metadata
aspect of log files that seems not to have been observed before:

With the most recent version of tetexComm you don't have to indicate
document-roots in those secondary tex files, because if you invoke tex on
them there is a mechanism that guesses the root file with great accuracy by
briefly scanning nearby log files.  This is instantaneous in most cases,
and takes a fraction of a second in more complicated situations.  (In
extreme cases, like if the tex file is sourced from two different roots,
then the user will be asked to choose.)

It's a short Tcl script (of course!) but it should be easy to implement
in other scripting languages like lisp or perl (or perhaps applescript?),
if for some reason you are not using Alpha :-)

The algorithm is simple: if there is a log file with the same basename, and
that log file does not end with "No pages of output", then the file itself
is chosen as root.  Otherwise look for log files in the same directory, and
check if they have logged a sourcing of the file in question.  Otherwise,
step one and then two directories up, and if still no appropriate log file
is found, check also if there should be log files in subdirectories of the
current directory.  (If no clues are found at all, then typeset the calling
file, like every other tex system would have done.)  (If for some reason
you are sourcing files over greater distances then you'll have to dig into
the Tcl code and set the depth to something greater than 2...)

Needless to say: if there is an explicit indication, then that indication
is followed.  (In Alpha, such indications are implemented in terms of the
notion of filesets, but as I argue in another posting, I think the right
place is in the header of the file itself.)

Clearly, you can easily construct a situation where the mechanism will
fail, the easiest example being if someone deleted the log file!  This is
an inherent weakness of external metadata.  In any case, you only use this
feature if you think it is useful for you, and in that case you are likely
willing to collaborate with the mechanism instead of trying to fool it.

tetexComm is part of the latest beta release of AlphaX (b16), but the
latest version is not in that release, since it has not yet been widely
tested.  You can take the latest version at


Joachim Kock <kock at math.uqam.ca>
Département de mathématiques -- Université du Québec à Montréal
Case postale 8888, succursale centre-ville
Montréal (Québec), H3C 3P8 -- Canada

Få din egen @start.no-adresse gratis på http://www.start.no/
--------------------- Info ---------------------
Mac-TeX Website: http://www.esm.psu.edu/mac-tex/
           & FAQ: http://latex.yauh.de/faq/
TeX FAQ: http://www.tex.ac.uk/faq
List Post: <mailto:MacOSX-TeX at email.esm.psu.edu>

More information about the macostex-archives mailing list