2 -- There are two interfaces:
5 -- new * execute^1 * finish
8 mpx = mp.new({ini_version = true, command_line = "plain \\dump"})
13 function finder (a,b,c)
15 if a == "mpost.map" then
16 return "/opt/tex/texmf-local/fonts/map/pdftex/pdftex.map"
18 if a =="cmr10.tfm" then
19 return "/opt/tex/texmf/fonts/tfm/public/cm/cmr10.tfm"
24 -- if you don't do this, it only finds local files
25 mp.find_file_function (finder)
28 local v = m:execute(s)
29 -- print ('<<term:'..v.term..'>>')
30 print ('<<log:'..v.log..'>>')
32 print(v.fig:postscript())
36 -- chunks have to have 'complete file' nesting state
40 "p = (0,0){right}..(20,100)..(50,60)..(75,50)...(25,25)..cycle;",
41 "pickup pencircle scaled 2;",
42 "beginfig(1); fill p withcolor (1,0,0); draw p dashed evenly; endfig;",
43 "beginfig(2); fill p withcolor (0,1,0); draw p dashed evenly; endfig;",
44 "beginfig(3); fill p withcolor (0,0,1); draw p dashed evenly; endfig;",
45 "beginfig(4); fill p withcolor (1,1,0); draw p dashed evenly; endfig;",
46 "beginfig(5); fill p withcolor (1,0,1); draw p dashed evenly; endfig;",
47 "beginfig(6); fill p withcolor (0,1,1); draw p dashed evenly; endfig;",
48 "beginfig(7); label(\"stuff\", (0,0)); endfig;",
51 mpx = mp.new({mem_name = "plain.mem", command_line = "\\relax "})
53 for _,l in ipairs(lines) do