[Dev-luatex] MPlib and btex...etex

Graham Douglas graham.douglas at readytext.co.uk
Sat May 1 21:39:30 CEST 2010

Hi All

I have a quick question about the behaviour of btex...etex.
The code below works perfectly until I include any mp code which
make use of btex...etex. I keep getting errors like this:

 >> mapmax.mp
 >> mapmax.mpx
! Unable to make mpx file.
l.383 l
                      $\reals$ etex, q+(0,-b));

I am running a slightly older version of LuaTeX
on Windows Vista

Version beta-0.53.0-2010032719

I am NOT using ConTeXt but simply using a
version of Plain. Just for the record I do all
MetaPost PS --> PDF with a call to GhostScript
via a Lua binding.

I think that in the "old days" all the btex/etex
stuff was handled by a set of calls to an external
program which processed the DVI -- makempx or something
like that??

Can anyone tell me how MPlib now handles
btex...etex so that I can try to figure
out why it might be failing. I'm not sure but it may
be that some calls to making temporary files
are failing, but that's just a guess.

Any insights into the low level btex...etex
machinery would be great.

Many thanks to all and best wishes


Test MP code

local function finder(name, mode, ftype)
local found
if mode=="w" then found = name else
found = kpse.find_file(name,ftype) end
if found then
print("MPlib finder: " .. name .. " -> " .. found)
return found

mp = mplib.new ( {
      hash_size = 100000,
      main_memory = 2000000,
      param_size = 100000,
      find_file = finder,
} )

if mp then
texio.write_nl("mp is  OK")
draw (2u,2u)--(0,0)--(0,3u)--(3u,0)--(0,0);
pickup pencircle scaled 4pt;
for i=0 upto 2:
for j=0 upto 2: drawdot (i*u,j*u); endfor

numeric scf, #, t[];
3.2scf = 2.4in;
path fun;
# = .1; % Keep the function single-valued
fun = ((0,-1#)..(1,.5#){right}..(1.9,.2#){right}..{curl .1}(3.2,2#))
yscaled(1/#) scaled scf;
x1 = 2.5scf;
for i=1 upto 2:
(t[i],whatever) =
fun intersectiontimes ((x[i],-infinity)--(x[i],infinity));
z[i] = point t[i] of fun;
z[i]-(x[i+1],0) = whatever*direction t[i] of fun;
draw (x[i],0)--z[i]--(x[i+1],0);
fill fullcircle scaled 3bp shifted z[i];
draw (0,0)--(3.2scf,0);
pickup pencircle scaled 1pt;
draw fun;

draw fullcircle
scaled 2cm
withpen pencircle xscaled 1mm yscaled .5mm
rotated 30 withcolor .75red ;


More information about the dev-luatex mailing list