[tex-k] Re: mpost --parse-first-line
olaf at infovore.xs4all.nl
Mon Apr 12 18:36:27 CEST 2004
Reinhard Kotucha writes:
>>>>>> "David" == David Kastrup <dak at gnu.org> writes:
>>> In my opinion the only reliable solution is to use the exec
>>> system call to run the required program.
>> It's used anyway.
> You mean the exec in mpost which executes tex, I suppose.
> The problem is in tex, not in mpost.
>> You probably mean that it should explicitly do
>> latex &latex
>> instead of
>> tex &latex
> This would make sense if mpost would parse the first line of a
> verbatimtex/etex block but it doesn't look into it. The contents of
> the block is copied to a temporary file and then tex is executed
> (which has to parse the first line of this file).
Note that the implementation (at least with web2c) isn't like that.
mpost finds a btex...etex or verbatimtex...etex and calls
- makempx, which calls
-- mpto to extract the tex-source
-- tex to typeset the tex-source
-- dvitomp to convert the dvi output to input usable by mpost
If the '%&-parsing' is to change in this sequence to call a different
engine, it can be done in makempx.
On unix systems, makempx is a shell script, which should make it easy
to play with changes in the way the input files are handled. On
windows it is a binary.
You can use the TEX environment variable to pick the engine/default
format. It's default is 'tex --parse-first-line'.
Provided all engines are given different suffixes to use for their
format files, you can check whether a format exists with kpsewhich (in
a script) of kpse_find_file (in a binary), then use the suffix to
determine a suitable engine to run it with. If there's more than one
match we'd prefer the running engine, and otherwise it becomes a
(This space left blank for technical reasons.)
More information about the tex-k