Dear Readers,

I have been playing about with METAFUN over the last few days trying to get a feel for it. I was wondering if it is possible to save the graphics produced in a context document for use outside. On looking at the Metapost manual I see you can using the following commands save a graphic as an svg file.

outputformat := "svg";

outputtemplate := "test.svg";

I have tried adding this to some MPcode in a ConteXt document but these lines seem to be ignored since no svg file is produced apart from the usual ConTeXt files. Is this expected behaviour? I have been able to get svg files using mpost on the command line.

Here is a minimum working example (which I'm sure could be coded more elegantly):

\starttext

\startMPcode

outputformat := "svg";

outputtemplate := "test.svg";

beginfig(1)

randomseed:= uniformdeviate infinity;

path pat;

x:=uniformdeviate(5);

y:=uniformdeviate(5);

pat:=(x,y);

for i = 1 upto 5:

a:=uniformdeviate(5);

b:=uniformdeviate(5);

pat := pat...(a,b);

endfor;

pat:=pat..(0,5);

draw pat scaled 10pt;

picture pic;

pic:=currentpicture;

endfig;

\stopMPcode

\stoptext

Best Wishes

Keith