Re: Outputtemplate influences %& format comment parsing in verbatimtex
luigi scarso <[email protected]> Wed, 27 Dec 2023 10:56:05 +0100
| Newsgroups | gmane.comp.tex.metapost |
|---|---|
| Message-ID | <CAG5iGsCsGBohurdDTXBwfC7ZGj7HVe8jkx4geFJNY0dWn50oZQ@mail.gmail.com> |
--===============7673328863257372792== Content-Type: multipart/alternative; boundary="0000000000005a807e060d7acf1e" --0000000000005a807e060d7acf1e Content-Type: text/plain; charset="UTF-8" On Sun, 24 Dec 2023 at 20:49, luigi scarso <[email protected]> wrote: > > > 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. > > Indeed, it seems an oversight : in mpxout.w verbatim_written = 1; at line 664 should be moved at line 659 655 if (!verbatim_written) 656 mpx_copy_mpto(mpx, outfile, FIRST_VERBATIM_TEX); 657 else 658 mpx_copy_mpto(mpx, outfile, VERBATIM_TEX); 659 verbatim_written = 1; 660 fprintf(outfile,"%s", mpx_postverb[mode]); 661 } else { 662 mpx_error(mpx,"unmatched etex"); 663 } 664 /*verbatim_written = 1;*/ -- luigi --0000000000005a807e060d7acf1e 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 20:49, luigi s= carso <<a href=3D"mailto:[email protected]">[email protected]<= /a>> wrote:<br></div><blockquote class=3D"gmail_quote" style=3D"margin:0= px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><= 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 Fran= k <<a href=3D"mailto:[email protected]" target=3D"_blank">ben.frank@mail= .de</a>> wrote:<br></div><blockquote class=3D"gmail_quote" style=3D"marg= in:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1e= x">Hi,<br> <br> On 24.12.23 19:33, luigi scarso wrote:<br> > Here I have<br> > <br> > $> mpost <a href=3D"http://test.mp" rel=3D"noreferrer" target=3D"_b= lank">test.mp</a> <<a href=3D"http://test.mp" rel=3D"noreferrer" target= =3D"_blank">http://test.mp</a>><br> > This is MetaPost, version 2.02 (TeX Live 2023) (kpathsea version 6.3.5= )<br> > (/<...>/tex-2023/texmf-dist/metapost/base/<a href=3D"http://mpos= t.mp" rel=3D"noreferrer" target=3D"_blank">mpost.mp</a> <<a href=3D"http= ://mpost.mp" rel=3D"noreferrer" target=3D"_blank">http://mpost.mp</a>><b= r> > (/<...>/tex-2023/texmf-dist/metapost/base/<a href=3D"http://plai= n.mp" rel=3D"noreferrer" target=3D"_blank">plain.mp</a> <<a href=3D"http= ://plain.mp" rel=3D"noreferrer" target=3D"_blank">http://plain.mp</a>><b= r> > Preloading the plain mem file, version 1.005) ) (./test.mpfatal: Comma= nd <br> > failed: etex --parse-first-line --interaction=3Dnonstopmode mpK6cPmm.t= ex; <br> > see mpxerr.log<br> >=C2=A0 >> <a href=3D"http://test.mp" rel=3D"noreferrer" target=3D= "_blank">test.mp</a> <<a href=3D"http://test.mp" rel=3D"noreferrer" targ= et=3D"_blank">http://test.mp</a>><br> >=C2=A0 >> test.mpx<br> > ! ! Unable to read mpx file.<br> > l.10 =C2=A0 =C2=A0label.lft(btex<br> >=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> > Transcript written on test.log.<br> <br> That'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>$> mpost -record -debug <a href=3D"http://test.mp= " target=3D"_blank">test.mp</a></div><div>shows what happens:=C2=A0</div><d= iv><br></div><div>=C2=A0%&latex<br>=C2=A0 =C2=A0\documentclass{article}= <br>=C2=A0 =C2=A0\begin{document}<br><br>\gdef\mpxshipout{\shipout\hbox\bgr= oup%<br>=C2=A0 \setbox0=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 \setbox0=3D\hbox\bgroup<br>=C2=A0 =C2=A0 \box0<br>=C2=A0 = =C2=A0 \ifnum\dimen0>0 \vrule width1sp height\dimen1 depth\dimen2 <br>= =C2=A0 =C2=A0 \else \vrule width1sp height1sp depth0sp\relax<br>=C2=A0 =C2= =A0 \fi\egroup<br>=C2=A0 \ht0=3D0pt \dp0=3D0pt \box0 \egroup}<br>\mpxshipou= t% line 10 ./<a href=3D"http://test.mp" target=3D"_blank">test.mp</a><br>\t= extbf{J}%<br>\stopmpxshipout<br>\end{document}<br></div><div><br></div><div= >i.e. there is an=C2=A0 initial space before %&latex=C2=A0that should b= e 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 "%j-%2= c.mps";<br><br>verbatimtex<br>%&latex<br>=C2=A0 =C2=A0\documentcla= ss{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.</di= v><div><br></div></div></div></blockquote><div><br></div><div>Indeed, it se= ems an oversight :</div><div>in mpxout.w=C2=A0</div><div>verbatim_written = =3D 1; at line 664 should=C2=A0be moved at line 659</div><div><br></div><di= v>=C2=A0 =C2=A0 655 =C2=A0 =C2=A0 =C2=A0 if (!verbatim_written)<br>=C2=A0 = =C2=A0 656 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0mpx_copy_mpto(mpx, outfile, FI= RST_VERBATIM_TEX);<br>=C2=A0 =C2=A0 657 =C2=A0 =C2=A0 =C2=A0 else<br>=C2=A0= =C2=A0 658 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0mpx_copy_mpto(mpx, outfile, V= ERBATIM_TEX);<br>=C2=A0 =C2=A0 659 =C2=A0 =C2=A0 =C2=A0 verbatim_written = =3D 1;<br>=C2=A0 =C2=A0 660 =C2=A0 =C2=A0 =C2=A0 fprintf(outfile,"%s&q= uot;, mpx_postverb[mode]);<br>=C2=A0 =C2=A0 661 =C2=A0 =C2=A0 } else {<br>= =C2=A0 =C2=A0 662 =C2=A0 =C2=A0 =C2=A0 mpx_error(mpx,"unmatched etex&q= uot;);<br>=C2=A0 =C2=A0 663 =C2=A0 =C2=A0 }<br>=C2=A0 =C2=A0 664 =C2=A0 =C2= =A0 /*verbatim_written =3D 1;*/<br></div><div><br></div><div>=C2=A0--</div>= <div>luigi</div></div></div> --0000000000005a807e060d7acf1e-- --===============7673328863257372792== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline -- http://tug.org/metapost/ --===============7673328863257372792==--