[tex-live] Effect of, and restrictions on, %& pragmat

Heiko Oberdiek heiko.oberdiek at googlemail.com
Tue Mar 20 18:26:34 CET 2012

On Tue, Mar 20, 2012 at 04:50:13PM +0000, Philip TAYLOR wrote:

> But it is now so long since I last used WinEDT that I no longer
> remember the full and gory details of the "%&" pragmat that can
> be used in the first line of a TeX file to specify how it is
> to be processed.  May I therefore ask (in the context of TeX Live 2011),
> whether :
> 1) %& processing is enabled by default;

AFAIK yes.

> 2) if not, how to enable it;

* command line option:

* texmf.cnf:
  parse_first_line = t

> 3) its limitations : can it indicate only a format,
> 	or can it also indicate an engine ?

The first line is interpreted by the engine, thus the
engine cannot be specified. From the manual page of pdftex:

| -parse-first-line
|   If the first line of the main input file begins with %& parse it to
|   look for a dump name or a -translate-file option.
| -no-parse-first-line
|   Disable parsing of the first line of the main input file.

>  In other words, can I write :
> 		%& XeTeX
> 	then launch TeX on the resulting file yet still
> 	have it processed by XeTeX ?

You need to call "xetex" and XeTeX tries to find the format "XeTeX".

> 4) where such things are documented ?

* command line option --help
* manual page. In case of XeTeX you can use the manual page of
  pdfTeX and guess what could also apply to XeTeX.

Editors might also have some conventions to call the
right engine and program. AFAIK, emacs adds this in comments at
the end of the file. Thus you can check the documentation of
your editors.

Yours sincerely
  Heiko Oberdiek

MiKTeX seems to support this in a similar way,
the documentation for the command line options, e.g.:
I haven't found a configurations option similar to TeX Live's texmf.cnf.

More information about the tex-live mailing list