[luatex] METAPOST labels in Lualatex: illegal unit of measure

Jean J2N-FORGET at orange.fr
Thu May 2 21:28:00 CEST 2013


When I typeset the following file:
--- beginning of copy-paste
\documentclass[a4paper]{article}
\usepackage{luamplib}

\begin{document}

\begin{mplibcode}
beginfig(1);

z0 = ( 0, 40); dotlabel.top("Solar noon", z0);
z1 = ( 0, 20); dotlabel.top("Mean noon",  z1);
z2 = (80, 40); dotlabel.top("Midi solaire",  z2);
z3 = (80, 20); dotlabel.top("Midi moyen",  z3);
z4 = (80,  0); dotlabel.top("J 90",  z4);
z5 = ( 0,  0); dotlabel.top("J+90",  z5);

endfig;
\end{mplibcode}

\end{document}
--- end of copy-paste
I obtain a curious result with the "Midi moyen" and
"J+90" string: first they trigger two error messages each,
then they appear in the PDF file with "e-05 bp" unwanted
prefix. And because of this prefix, the label is not centered
as it should be.

The two error messages are:
! Illegal unit of measure (pt inserted).
! A <box> was supposed to be here.

The same error happens with "label" instead of "dotlabel" and
with any other position ("bot", "rt", "llft", etc) instead
of "top".

A wild guess: all labels are preceded with a length string such
as "0pt", "1bp", "2cm" and the like. For some reason, the computation
for "Midi moyen" and "J+90" does not yield exactly 0, but 
1/100000 bp. So this generates a prefix "1e-05 bp" instead of
"0 bp". Then, the interpreter scans the string "1e-05 bpJ+90",
extracts the number 1 and then gags on the "e", which it cannot
interpret as a length unit. So, as explained in the log file,
the interpreter insert its preferred unit "pt" and rescans
the updated string "1pte-05 bpJ+90", extract the length
prefix "1pt" and typeset the remainder of the string "e-05 bpJ+90".

This error happens with a recent version of luatex:

--- beginning of copy-paste
This is LuaTeX, Version beta-0.76.0-2013042400  (TeX Live 2013) (rev
4627)

Execute  'luatex --credits'  for credits and version details.

There is NO warranty. Redistribution of this software is covered by
the terms of the GNU General Public License, version 2 or (at your
option)
any later version. For more information about these matters, see the
file
named COPYING and the LuaTeX source.

Copyright 2013 Taco Hoekwater, the LuaTeX Team.
--- end of copy-paste

With an older version of luatex (from the Ubuntu 12.04 repository),
there
is a Lua error about an invalid argument sent to the "format" function
within the "module_log" function in modutils.lua, but since I have
installed the version above, I am more concerned with the
"e-05 bp" bug.

I have searched the Metapost mailing-list archive at
http://tug.org/pipermail/metapost/
and the Luatex mailing-list archive at
http://tug.org/mailman/mmsearch/luatex
with "illegal unit measure", and I have found nothing.

I include the source file and the log file if you want
to experiment.

So what is the problem? Does anyone know how to fix it?

Thank you in advance,

Jean Forget
-------------- next part --------------
A non-text attachment was scrubbed...
Name: bug-mp.tex
Type: text/x-tex
Size: 449 bytes
Desc: not available
URL: <http://tug.org/pipermail/luatex/attachments/20130502/e66bf1e8/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: bug-mp.log
Type: text/x-log
Size: 4431 bytes
Desc: not available
URL: <http://tug.org/pipermail/luatex/attachments/20130502/e66bf1e8/attachment-0001.bin>


More information about the luatex mailing list