[metapost] Outputtemplate influences %& format comment parsing in verbatimtex
Ben Frank
ben.frank at mail.de
Sun Dec 24 19:42:48 CET 2023
Hi,
On 24.12.23 19:33, luigi scarso wrote:
> Here I have
>
> $> mpost test.mp <http://test.mp>
> This is MetaPost, version 2.02 (TeX Live 2023) (kpathsea version 6.3.5)
> (/<...>/tex-2023/texmf-dist/metapost/base/mpost.mp <http://mpost.mp>
> (/<...>/tex-2023/texmf-dist/metapost/base/plain.mp <http://plain.mp>
> Preloading the plain mem file, version 1.005) ) (./test.mpfatal: Command
> failed: etex --parse-first-line --interaction=nonstopmode mpK6cPmm.tex;
> see mpxerr.log
> >> test.mp <http://test.mp>
> >> test.mpx
> ! ! Unable to read mpx file.
> l.10 label.lft(btex
> \textbf{J} etex,origin);
> Transcript written on test.log.
That's the error I mentioned you would get because the wrong format is
chosen due to the wrongly output format comment.
As I said in my original post, you get the wrong format when the
`outputtemplate` line is parsed by Metapost but the right format is
chosen if you comment it out.
To repeat my original question:
> Why does it [the example] not compile when fed to mpost as is (because
> of the space before %&latex carrying into the output preventing its
> parsing as a format comment) but compile fine when the outputtemplate
> line is commented (i.e., the space seems to be gobbled as expected)?
I.e., my question boils down to why is there a ` %&latex` in the TeX
stream which prevents processing as a LaTeX document because the space
prevents the parsing of the format comment. And my observation is that
this space seems to be part of the interaction with `outputtemplate`
because commenting out the `outputtemplate` line results in `%&latex`
(without space) which is a working format comment.
As I said, you will not get the error with
```
% outputtemplate := "%j-%2c.mps";
% ^^ commenting this out will make it work
verbatimtex %&latex
\documentclass{article}
\begin{document}
etex
beginfig(1)
label.lft(btex \textbf{J} etex,origin);
endfig;
end;
```
That is, the `outputtemplate` influences the space handling. And I would
like to know why and whether that is a bug or if it is a known feature,
what is its rationale (i.e. outputtemplate influencing how verbatimtex
inserts spaces into the TeX stream).
I hope this repetition of my question helps understanding what I am
asking. Otherwise, feel free to ask a more detailed question, although I
am not sure I can provide anything you cannot reproduce on your
installation.
Best,
Ben
More information about the metapost
mailing list.