[tex-live] TeX file preamble proposal

Gerben Wierda Sherlock at rna.nl
Thu Jul 24 12:46:34 CEST 2003

I encounter different programs which may react to the first line of a 
TeX file. Some front ends write something there. texexec can react to 
something in that line. TeX itself can. All want that first line and 
all have a different idea of the structure.

I would like to propose the following:

1. The initial comment block in a TeX file may contain information for 
external programs
2. Information for external programs will be preceded by %!, if % is 
not followed by ! it is deemed to be a plain comment
3. The first alphanumerical word after %! is the name of the program 
the rest of the line is meant for, this word is followed by an = sign. 
Whitespace around the = sign and around the word is ignored.
4. The word `program' is reserved. A line "%! program = foo" will set 
the file to be executed by foo only.


%% This is file foo.tex, part of the bar project
%! texexec = --pdf --mode=screen
%! TeXShop = root:../bar.tex engine=ConTeXt

Another example:

%! program=pdflatex
%! pdflatex = --interaction batchmode

This structure (a better one could be designed) should replace also the 
'parse first line' in TeX.

The first thing to do would be to add a 'parse-preamble-comment' option 
to TeX itself. In time, this comment could replace the working of 
parse-first-line but that one needs to remain in place for backward 

When TeX puts this in place in a standardized way, all frontends would 
probably adapt to it and using multiple frontends would become a 
possibility improving the portability and flexibility of TeX.

I know TeX does not need to change for this per se (drivers and front 
ends other than TeX could just forget about the first line), but I 
think a standardisation from TeX would be followed easily by outside 
programs and it would work as a solution for existing conflicts.

What is you reaction to the general idea?


More information about the tex-live mailing list