[metapost] Use metaflow.mp in lualatex using mplib?
William Adams
will.adams at frycomm.com
Mon Dec 1 17:20:20 CET 2014
On Nov 21, 2014, at 3:42 PM, Daniel H. Luecking wrote:
> Oops, I didn't notice the reference to mplib. Forget what I
> said about having no trouble. Still, an MWE would be useful.
Okay. I'm trying to do the first example.
It works as two separate files:
===========chart.mp============
input metaflow
prologues := 2;
filenametemplate "%j-%c.mps";
beginfig(1)
z1c = (0,0);
draw rect1(btex experiment etex);
putitem2 20right of 1;
draw oval2(btex results etex);
drawarrow connector(1,2,right,right);
putitems(2,3) like (1,2);
z3s = (55,30);
draw diamond3(btex evaluate etex);
drawarrow connector(2,3,right,right);
drawarrow connector1(3,1,down,up);
z4um = point 1.5 of cp1;
drawopen rect4(btex revise etex);
putitems(3,5) like (1,2);
drawopen rect5(btex success etex);
drawarrow connector(3,5,right,right);
endfig;
end
========end=chart.mp============
===========test.tex=============
\documentclass{article}
\usepackage{graphicx}
\begin{document}
Here is a nice diagram:
\begin{center}
\includegraphics
[width=.7\hsize]
{chart-1.mps}
\end{center}
\end{document}
========end=test.tex============
Trying to put them together and process them using lualatex and mplib:
\documentclass{article}
\usepackage{luamplib}
\begin{document}
Here is a nice diagram:
\begin{center}
\begin{mplibcode}
input metaflow
prologues := 2;
filenametemplate "%j-%c.mps";
beginfig(1)
z1c = (0,0);
draw rect1(btex experiment etex);
putitem2 20right of 1;
draw oval2(btex results etex);
drawarrow connector(1,2,right,right);
putitems(2,3) like (1,2);
z3s = (55,30);
draw diamond3(btex evaluate etex);
drawarrow connector(2,3,right,right);
drawarrow connector1(3,1,down,up);
z4um = point 1.5 of cp1;
drawopen rect4(btex revise etex);
putitems(3,5) like (1,2);
drawopen rect5(btex success etex);
drawarrow connector(3,5,right,right);
endfig;
\end{mplibcode}
\end{center}
\end{document}
fails w/ the error messages:
./testmpl.tex:27: LuaTeX error ...texlive/2013/texmf-dist/tex/luatex/luamplib/lu
amplib.lua:177: Module luamplib error:
(luamplib)
(luamplib)
(luamplib)
(luamplib)
(luamplib)
(luamplib)
(luamplib)
(luamplib) (./metaflow.mp)
(luamplib) ! Incomplete string token has been flushed.
(luamplib) <*> ...warrow connector(3,5,right,right); endfig;
(luamplib)
(luamplib)
(luamplib)
(luamplib) no-error
stack traceback:
[C]: in function 'error'
...xlive/2013/texmf-dist/tex/luatex/luatexbase/modutils.lua:26: in function 'mo
dule_error_int'
...xlive/2013/texmf-dist/tex/luatex/luatexbase/modutils.lua:49: in function 'er
r'
...texlive/2013/texmf-dist/tex/luatex/luamplib/luamplib.lua:177: in function <.
..texlive/2013/texmf-dist/tex/luatex/luamplib/luamplib.lua:169>
(...tail calls...)
[string "\directlua "]:1: in main chunk.
\ltxdomplibcodefinally ...luamplib.process(data) }
\end {mplibcode}\else \tok...
l.27 \end{mplibcode}
William
--
William Adams
senior graphic designer
Fry Communications
Sphinx of black quartz, judge my vow.
More information about the metapost
mailing list