From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/4615 Path: main.gmane.org!not-for-mail From: Hans Hagen Newsgroups: gmane.comp.tex.context Subject: Re: Metapost example and code Date: Fri, 04 May 2001 17:29:01 +0200 Sender: owner-ntg-context@let.uu.nl Message-ID: <3.0.6.32.20010504172901.019dd5f0@server-1> References: <20010429125328.A1242@ruhrau.de> NNTP-Posting-Host: coloc-standby.netfonds.no Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" X-Trace: main.gmane.org 1035395266 27181 80.91.224.250 (23 Oct 2002 17:47:46 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Wed, 23 Oct 2002 17:47:46 +0000 (UTC) Cc: ntg-context@ntg.nl Original-To: johannes.huesing@ruhrau.de In-Reply-To: <20010429125328.A1242@ruhrau.de> Xref: main.gmane.org gmane.comp.tex.context:4615 X-Report-Spam: http://spam.gmane.org/gmane.comp.tex.context:4615 At 12:53 PM 4/29/01 +0200, Johannes Huesing wrote: >Hi all, > >I am trying to define a start-stop-environment which allows me to >prettyprint MetaPost code and display its results. This is what I >tried: > > >%%%% code begins here %%%% >\runMPgraphicstrue > >\def\PreMPExample{\startbuffer[mpe]} > >\def\PostMPExmaple{\stopbuffer% > \startMPgraphic > input mpe.tmp; > \stopMPgraphic > \placeMPgraphic[right]{none} > \expandafter\startMP > \input mpe.tmp > \stopMP > } >\starttext >\stoptext > >\startMPExample > draw > for i=0 upto 4: > (50, 0) rotated (i*144) -- > endfor > cycle; >\stopMPExample > >\stoptext >%%%% code ends here %%%% > >and this is what I got: > >%%%% messages begin here %%%% > >! Undefined control sequence. Buffers cannot be used in macros (although a workaround is to use \definebuffer); but, why not use: \def\startMPExample#1\stopMPExample% {\startuseMPgraphic{MPExample}#1\stopuseMPgraphic \placefigure[right]{none}{\useMPgraphic{MPExample}}} \startMPExample draw for i=0 upto 4: (50, 0) rotated (i*144) -- endfor cycle; \stopMPExample Or simply: \startuseMPgraphic{MPExample} draw for i=0 upto 4: (50, 0) rotated (i*144) -- endfor cycle; \stopuseMPgraphic \placefigure[right]{none}{\useMPgraphic{MPExample}} Hans ------------------------------------------------------------------------- Hans Hagen | PRAGMA ADE | pragma@wxs.nl Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: +31 (0)38 477 53 69 | fax: +31 (0)38 477 53 74 | www.pragma-ade.com -------------------------------------------------------------------------