[metapost] "TEX(char 13)" in luamplib / plain MP

Dohyun Kim nomosnomos at gmail.com
Fri Nov 22 03:02:57 CET 2024


Thanks for the report.

char 13 is an end-of-line character.
TeX will remove the remaining part after that character to the end of the line.
So, the closing brace of an hbox has also been removed, raising a TeX error.

I will suppress the TeX error and return a picture made by null hbox.

2024년 11월 21일 (목) 오후 8:34, Toby Thurston <thurston at eml.cc>님이 작성:
>
> Recently I was trying to solve a puzzling error message that someone asked about on TeX.SE, and I came across another minor difference between plain MP and luamplib.
>
> If you run this trivial program through plain MP
>
> > input TEX
> > show TEX(char 13);
> > end.
>
> you get this in the log file
>
> > >> Edge structure at line 2:
> > setbounds path:
> > (0,0)..controls (0,0) and (0,0)
> >  ..(0,0)..controls (0,0) and (0,0)
> >  ..(0,0)..controls (0,0) and (0,0)
> >  ..(0,0)..controls (0,0) and (0,0)
> >  ..cycle
> > end of setbounds
> > End edges
>
>
> which shows that TEX() has returned a <picture> expression as expected (even though the picture is blank).
>
> But if I run the equivalent programme through `lualatex`
>
> > \documentclass{standalone}
> > \usepackage{luamplib}
> > \begin{document}
> > \begin{mplibcode}
> > show TEX(char 13);
> > \end{mplibcode}
> > \end{document}
>
>
> I get an error like this:
>
> > mplib warning: error in script: ...texlive/2024/texmf-dist/tex/luatex/luamplib/luamplib.lua:390: attempt to index a nil value (local 'box')
>
> and in the log I get
>
> > >> vacuous
> > (luamplib)      on input line 6
> > ! Missing } inserted.
> > <inserted text>
> > }
> > l.6 \end{mplibcode}
> >
> > ?
>
>
> which suggests that TEX() has returned a <vacuous> expression instead of a <picture>.
>
> The original context was that the person who asked the TeX.SE question was getting an error from an MP example of mine that
> included the line
>
>         label(char 13 infont "eurm10", z0);
>
> which is ok in plain mpost because "eurm10" does have a valid char at position 13 (a gamma), but the questioner was
> trying to run the example through luamplib with `\mplibtextextlabel{enable}` so the `infont` trick meant that the line
> was interpreted as
>
>         label(TEX(char 13), z0);
>
> which generated the errors above.
>
> I think it would be nice if the luamplib version of the TEX() macro always returned a <picture> even if it is empty.
>
> T.
>
>
>
>
> --
> http://tug.org/metapost/



-- 
Dohyun Kim
Seoul, Republic of Korea



More information about the metapost mailing list.