Re: Outputtemplate influences %& format comment parsing in verbatimtex

luigi scarso <[email protected]> Sun, 24 Dec 2023 20:49:49 +0100
Newsgroups gmane.comp.tex.metapost
Message-ID <CAG5iGsC2ff18gAdsJ-iyRLRPKdq=a803tX8aABNshBzndjikVg@mail.gmail.com>
--===============3966186034998545579==
Content-Type: multipart/alternative; boundary="000000000000350aa0060d46c1eb"

--000000000000350aa0060d46c1eb
Content-Type: text/plain; charset="UTF-8"

On Sun, 24 Dec 2023 at 19:42, Ben Frank <[email protected]> wrote:

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

ok
$> mpost -record -debug test.mp
shows what happens:

 %&latex
   \documentclass{article}
   \begin{document}

\gdef\mpxshipout{\shipout\hbox\bgroup%
  \setbox0=\hbox\bgroup}%
\gdef\stopmpxshipout{\egroup  \dimen0=\ht0 \advance\dimen0\dp0
  \dimen1=\ht0 \dimen2=\dp0
  \setbox0=\hbox\bgroup
    \box0
    \ifnum\dimen0>0 \vrule width1sp height\dimen1 depth\dimen2
    \else \vrule width1sp height1sp depth0sp\relax
    \fi\egroup
  \ht0=0pt \dp0=0pt \box0 \egroup}
\mpxshipout% line 10 ./test.mp
\textbf{J}%
\stopmpxshipout
\end{document}

i.e. there is an  initial space before %&latex that should be not there
(and indeed the next code  is ok, if there are no spaces after verbatimtex:
outputtemplate := "%j-%2c.mps";

verbatimtex
%&latex
   \documentclass{article}
   \begin{document}
etex

beginfig(1)
   label.lft(btex \textbf{J} etex,origin);
endfig;

end;
end
)

I need to check.

--
luigi

--000000000000350aa0060d46c1eb
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div dir=3D"ltr"><br></div><br><div class=3D"gmail_quote">=
<div dir=3D"ltr" class=3D"gmail_attr">On Sun, 24 Dec 2023 at 19:42, Ben Fra=
nk &lt;<a href=3D"mailto:[email protected]">[email protected]</a>&gt; wrote=
:<br></div><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.=
8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi,<br>
<br>
On 24.12.23 19:33, luigi scarso wrote:<br>
&gt; Here I have<br>
&gt; <br>
&gt; $&gt; mpost <a href=3D"http://test.mp" rel=3D"noreferrer" target=3D"_b=
lank">test.mp</a> &lt;<a href=3D"http://test.mp" rel=3D"noreferrer" target=
=3D"_blank">http://test.mp</a>&gt;<br>
&gt; This is MetaPost, version 2.02 (TeX Live 2023) (kpathsea version 6.3.5=
)<br>
&gt; (/&lt;...&gt;/tex-2023/texmf-dist/metapost/base/<a href=3D"http://mpos=
t.mp" rel=3D"noreferrer" target=3D"_blank">mpost.mp</a> &lt;<a href=3D"http=
://mpost.mp" rel=3D"noreferrer" target=3D"_blank">http://mpost.mp</a>&gt;<b=
r>
&gt; (/&lt;...&gt;/tex-2023/texmf-dist/metapost/base/<a href=3D"http://plai=
n.mp" rel=3D"noreferrer" target=3D"_blank">plain.mp</a> &lt;<a href=3D"http=
://plain.mp" rel=3D"noreferrer" target=3D"_blank">http://plain.mp</a>&gt;<b=
r>
&gt; Preloading the plain mem file, version 1.005) ) (./test.mpfatal: Comma=
nd <br>
&gt; failed: etex --parse-first-line --interaction=3Dnonstopmode mpK6cPmm.t=
ex; <br>
&gt; see mpxerr.log<br>
&gt;=C2=A0 &gt;&gt; <a href=3D"http://test.mp" rel=3D"noreferrer" target=3D=
"_blank">test.mp</a> &lt;<a href=3D"http://test.mp" rel=3D"noreferrer" targ=
et=3D"_blank">http://test.mp</a>&gt;<br>
&gt;=C2=A0 &gt;&gt; test.mpx<br>
&gt; ! ! Unable to read mpx file.<br>
&gt; l.10 =C2=A0 =C2=A0label.lft(btex<br>
&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0\textbf{J} etex,origin);<br>
&gt; Transcript written on test.log.<br>
<br>
That&#39;s the error I mentioned you would get because the wrong format is =
<br>
chosen due to the wrongly output format comment.<br></blockquote><div><br><=
/div><div>ok</div><div>$&gt; mpost -record -debug <a href=3D"http://test.mp=
">test.mp</a></div><div>shows what happens:=C2=A0</div><div><br></div><div>=
=C2=A0%&amp;latex<br>=C2=A0 =C2=A0\documentclass{article}<br>=C2=A0 =C2=A0\=
begin{document}<br><br>\gdef\mpxshipout{\shipout\hbox\bgroup%<br>=C2=A0 \se=
tbox0=3D\hbox\bgroup}%<br>\gdef\stopmpxshipout{\egroup =C2=A0\dimen0=3D\ht0=
 \advance\dimen0\dp0<br>=C2=A0 \dimen1=3D\ht0 \dimen2=3D\dp0<br>=C2=A0 \set=
box0=3D\hbox\bgroup<br>=C2=A0 =C2=A0 \box0<br>=C2=A0 =C2=A0 \ifnum\dimen0&g=
t;0 \vrule width1sp height\dimen1 depth\dimen2 <br>=C2=A0 =C2=A0 \else \vru=
le width1sp height1sp depth0sp\relax<br>=C2=A0 =C2=A0 \fi\egroup<br>=C2=A0 =
\ht0=3D0pt \dp0=3D0pt \box0 \egroup}<br>\mpxshipout% line 10 ./<a href=3D"h=
ttp://test.mp">test.mp</a><br>\textbf{J}%<br>\stopmpxshipout<br>\end{docume=
nt}<br></div><div><br></div><div>i.e. there is an=C2=A0 initial space befor=
e %&amp;latex=C2=A0that should be not there=C2=A0</div><div>(and indeed the=
 next code=C2=A0 is ok, if there are no spaces after verbatimtex:</div><div=
>outputtemplate :=3D &quot;%j-%2c.mps&quot;;<br><br>verbatimtex<br>%&amp;la=
tex<br>=C2=A0 =C2=A0\documentclass{article}<br>=C2=A0 =C2=A0\begin{document=
}<br>etex<br><br>beginfig(1)<br>=C2=A0 =C2=A0label.lft(btex \textbf{J} etex=
,origin);<br>endfig;<br><br>end;<br>end<br></div><div>)=C2=A0</div><div><br=
></div><div>I need to check.</div><div><br></div><div>--</div><div>luigi</d=
iv><div><br></div><div><br></div><div><br></div></div></div>

--000000000000350aa0060d46c1eb--

--===============3966186034998545579==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

--
http://tug.org/metapost/

--===============3966186034998545579==--