[Dev-luatex] Minimal example of using mplib in luatex
Nicola
nvitacolonna at gmail.com
Sun Jun 28 21:05:38 CEST 2009
Hi,
can someone show me a minimal example of how to embed a MetaPost figure
into a (La)TeX document using LuaTeX (along the lines of embedded
MetaPost code in ConTeXt)? Provided that that's the goal of mplib, of
course... I'm using the latest LuaTeX as of today (0.40.6 beta). This is
where I've got so far:
\documentclass{article}
\usepackage[english,italian]{babel}
\begin{document}
\directlua{
local mplib = require('mplib')
local mp = mplib.new ({ ini_version = false, mem_name = 'plain' })
if mp then
local l = mp:execute([[
beginfig(1);
fill fullcircle scaled 20;
endfig;
]])
if l and l.fig then
print (l.fig[1]:postscript())
end
mp:finish();
end
}
\end{document}
This compiles successfully (with pdflualatex), but it does not generate
any output figure. How do I generate an output figure and/or how do I
include it into the document?
Besides, is it possible to use mplib with Lua (not LuaTeX)? If so, how?
Thanks,
Nicola
More information about the dev-luatex
mailing list