[tex-k] Re: mpost --parse-first-line
Reinhard Kotucha
reinhard.kotucha at web.de
Mon Apr 12 02:25:32 CEST 2004
>>>>> "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
> 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).
Another example:
-------------------------------------------------------
%&latex
\documentclass{minimal}\stop
-------------------------------------------------------
When latex was based on tex, you could type
tex myfile
and tex then loaded the appropriate format file. Now you have to type
etex|pdfetex|latex|pdflatex myfile
with tex you get the message:
This is TeXk, Version 3.14159 (Web2C 7.5.2)
\write18 enabled.
%&-line parsing enabled.
(Fatal format file error; I'm stymied)
What I mean is that tex should not only determine the format file but
also the engine required by the format and then exec the engine.
Of course, this isn't as easy as it looks. The information which
engine is required by a format file can be derived from fmtutil.cnf,
but people might have their own formats, which are not installed by
fmtutil/texlinks.
Today, the --parse-first-line option doesn't make much sense in
ordinary tex or latex files because the format file now determines
whether dvi or pdf is produced.
In the example above, you get dvi even if you type "pdflatex myfile".
On the other hand, if tex is running in the background like in mpost,
it is useful to be able to put the information into the file. Here,
--parse-first-line is very useful.
A good solution would be to extend the "first line syntax" so that the
engine can be specified as well.
%latex &latex
The name of the format file is then obsolete because if latex (the
symlink to pdfetex) is launched, the latex format file is loaded
automatically. But maybe the &[a-z]+ is required as a magic number to
distinguish between such an instruction and an arbitrary comment like
%latex required
Or does it make sense to introduce something like %! to force an exec
system call?
Then
%!latex
will exec latex, while
%&latex
just uses the engine specified on the command line (or the default
engine in mpost) and loads latex.fmt, and
%!etex &myformat
will exec etex and load myformat.fmt
Of course, %! is straightforward, it's what people would type on the
command line. But there should be a list of trusted programs in
texmf.cnf so that something like
%!rm -rf
will be ignored.
Regards,
Reinhard
--
----------------------------------------------------------------------------
Reinhard Kotucha Phone: +49-511-4592165
Marschnerstr. 25
D-30167 Hannover mailto:reinhard.kotucha at web.de
----------------------------------------------------------------------------
Microsoft isn't the answer. Microsoft is the question, and the answer is NO.
----------------------------------------------------------------------------
More information about the tex-k
mailing list