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 abel.bot(btex $\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 Graham ===== ========================================== 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) end return found end mp = mplib.new ( { hash_size = 100000, main_memory = 2000000, param_size = 100000, ini_version=false, mem_name=plain, find_file = finder, } ) if mp then texio.write_nl("mp is OK") res=mp:execute("beginfig(1); u=1cm; 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 endfor endfig; beginfig(2); 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]; endfor draw (0,0)--(3.2scf,0); pickup pencircle scaled 1pt; draw fun; endfig; beginfig(3); draw fullcircle scaled 2cm withpen pencircle xscaled 1mm yscaled .5mm rotated 30 withcolor .75red ; endfig; bye;" )
Graham Douglas wrote:
Hi All
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.
The current MPlib is not able to run btex...etex at all. Best wishes, Taco
taco wrote:
Graham Douglas wrote:
Hi All
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.
The current MPlib is not able to run btex...etex at all.
Best wishes, Taco
__________ Information from ESET Smart Security, version of virus signature database 5077 (20100501) __________
The message was checked by ESET Smart Security.
Hi Taco Many thanks. What would I need to implement in order to include TeX material in mp code? I guess Hans has written some wizardry for getting this to work in ConTeXt? Any pointers would be appreciated. Best wishes Graham
Graham Douglas wrote:
Many thanks. What would I need to implement in order to include TeX material in mp code? I guess Hans has written some wizardry for getting this to work in ConTeXt?
Any pointers would be appreciated.
Have a look at the mlib-pps.* files from the context distribution. The basic approach is to typeset the label using normal TeX-style boxes and to insert a placeholder in the metapost input instead of the actual label. That placeholder is then later replaced by the typeset label during the mp-to-pdf conversion step. Best wishes, Taco
taco wrote:
Graham Douglas wrote:
Many thanks. What would I need to implement in order to include TeX material in mp code? I guess Hans has written some wizardry for getting this to work in ConTeXt?
Any pointers would be appreciated.
Have a look at the mlib-pps.* files from the context distribution.
The basic approach is to typeset the label using normal TeX-style boxes and to insert a placeholder in the metapost input instead of the actual label. That placeholder is then later replaced by the typeset label during the mp-to-pdf conversion step.
Best wishes, Taco
__________ Information from ESET Smart Security, version of virus signature database 5078 (20100501) __________
The message was checked by ESET Smart Security.
Hi Taco Great, many thanks for the pointers. On another MPlib/MetaPost-related issue + apologies if this is off-topic, but I'm getting out of memory errors with the example below -- some Hilbert curve code I found on the web. The memory settings below are quite large so I'm a bit surprised that this is failing. Are you able to run this example? The line to control this is at the end of the code draw hilbertPath(3.72, 6); Thank you, as ever, for sharing your time and expertise. Best wishes Graham ================== out of memory warning ===================== [This is MetaPost, Version 1.209 ! MetaPost capacity exceeded, sorry [main mem ory size=10000000]. hilbertPath->...f.p101;hilb:=p100&P100--P101&p101; P102:=P101shifted((vs+0.5v... <*> ... 0, hoehe)--cycle; draw hilbertPath(3.72, 6) ; endfig; bye =================== code example ======================== 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) end return found end mp = mplib.new ( { hash_size = 10000000, main_memory = 10000000, param_size = 10000000, ini_version=false, mem_name=plain, find_file = finder, } ) if mp then res=mp:execute("u:=25; % 25 = 25bp = 25 PostP102cript points = 25/72 in wi:=10; % width in units u he:=10; % height in units u hoehe:=he*u; % height breite:=wi*u; % width path p[]; pair P[], versch, vs; P0:=(6.875, hoehe-6.875); % starting point top left vardef hilbertPath(expr s, n) = % % recursively calculates and returns path ``hilb'' % of segment length s and depth n % pair versch; path hilb, hilbOLD; versch:=(s, 0); % --- Calculation of path ``hilb'' --- if n=0: hilb:=P0; else: hilbOLD:=hilbertPath(s, n-1); p100:=hilbOLD reflectedabout(P0, P0 shifted (1, -1)); P100:=point length(p100) of p100; vs:=P100-P0; p101:=hilbOLD shifted (vs+versch); P101:=point 0 of p101; hilb:=p100&P100--P101&p101; P102:=P101 shifted ((vs+.5versch) rotated -90); p102:=reverse hilb reflectedabout(P102, P102 shifted (1,0)); hilb:=hilb&point length(hilb) of hilb--point 0 of p102&p102; fi % --- End: Calculation of path ``hilb'' --- hilb % return path ``hilb'' enddef; beginfig(1) draw (0, 0)--(breite, 0)--(breite, hoehe)--(0, hoehe)--cycle; draw hilbertPath(3.72, 6); % Draw Hilbert curve of segment length % 3.72 PostScript points and depth 6 % draw hilbertPath(2, 7); % maximum possible depth % with main memory size=1000001 endfig; bye")
Hi Graham,
! MetaPost capacity exceeded, sorry [main mem ory size=10000000].
I might be wrong, but I think that this message is incorrect. It states the current main memory size, but not the one that is in effect.
mp = mplib.new ( { hash_size = 10000000, main_memory = 10000000, param_size = 10000000,
You need to set these memory settings and then dump the metapost format. These settings are used in the next run (with the new format). Patrick (this is to the best of my knowledge)
[ message of memory settings in metapost ]
I might be wrong, but I think that this message is incorrect. It states the current main memory size, but not
necessarily
the one that is in effect.
See also tracker item #251 (http://tracker.luatex.org/view.php?id=251)
Hi Patrick You were quite right. In the end I puzzled out a solution that (seemed) to work. I got a new mem file that lets me build bigger mp files, many thanks. mp = mplib.new ( { hash_size = 10000000, main_memory = 10000000, param_size = 10000000, ini_version=true, mem_name=plain, find_file = finder, } ) if mp then res=mp:execute("input mpost.mp") end ================================ Not sure if this is right/correct but it seemed to work. Thanks Patrick! Graham
Hi Graham, Patrick wrote:
! MetaPost capacity exceeded, sorry [main mem ory size=10000000].
I might be wrong, but I think that this message is incorrect. It states the current main memory size, but not the one that is in effect.
mp = mplib.new ( { hash_size = 10000000, main_memory = 10000000, param_size = 10000000,
You need to set these memory settings and then dump the metapost format. These settings are used in the next run (with the new format). Patrick (this is to the best of my knowledge) ========================================= Thanks Patrick, I'll try to increase those settings and dump a new .mem file. All the best Graham
participants (3)
-
Graham Douglas
-
Patrick Gundlach
-
taco