Re: mpost --parse-first-line

Olaf Weber <[email protected]>
Newsgroups gmane.comp.tex.tetex.beta
Message-ID <[email protected]>
Reinhard Kotucha writes:
>>>>>> "David" == David Kastrup <[email protected]> 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

>> right?

> 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
toss-up.

-- 
Olaf Weber

               (This space left blank for technical reasons.)
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.