From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/11614 Path: main.gmane.org!not-for-mail From: Guy Worthington Newsgroups: gmane.comp.tex.context Subject: Re: Re[2]: Using MetaPost graphics in ConTeXt Date: 24 Mar 2003 21:06:41 +0800 Sender: ntg-context-admin@ntg.nl Message-ID: References: <19914960201.20030323223837@iol.it> <20030324060913.GA1081@ruhrau.de> <1684883432.20030324112703@iol.it> Reply-To: ntg-context@ntg.nl NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: main.gmane.org 1048510929 28876 80.91.224.249 (24 Mar 2003 13:02:09 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Mon, 24 Mar 2003 13:02:09 +0000 (UTC) Original-X-From: ntg-context-admin@ntg.nl Mon Mar 24 14:02:06 2003 Return-path: Original-Received: from ref.vet.uu.nl ([131.211.172.13] helo=ref.ntg.nl) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 18xRaY-0007VR-00 for ; Mon, 24 Mar 2003 14:02:06 +0100 Original-Received: from ref.ntg.nl (localhost.localdomain [127.0.0.1]) by ref.ntg.nl (Postfix) with ESMTP id F0F2210B47; Mon, 24 Mar 2003 14:02:04 +0100 (MET) Original-Received: from main.gmane.org (main.gmane.org [80.91.224.249]) by ref.ntg.nl (Postfix) with ESMTP id 049B410B31 for ; Mon, 24 Mar 2003 13:59:36 +0100 (MET) Original-Received: from list by main.gmane.org with local (Exim 3.35 #1 (Debian)) id 18xRY8-0007JB-00 for ; Mon, 24 Mar 2003 13:59:36 +0100 X-Injected-Via-Gmane: http://gmane.org/ Original-To: ntg-context@ref.ntg.nl Original-Received: from news by main.gmane.org with local (Exim 3.35 #1 (Debian)) id 18xRY7-0007J2-00 for ; Mon, 24 Mar 2003 13:59:35 +0100 Original-Lines: 120 Original-X-Complaints-To: usenet@main.gmane.org User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2 Errors-To: ntg-context-admin@ntg.nl X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.0.13 Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: mailing list for ConTeXt users List-Unsubscribe: , List-Archive: Xref: main.gmane.org gmane.comp.tex.context:11614 X-Report-Spam: http://spam.gmane.org/gmane.comp.tex.context:11614 > I'm trying to use some MetaPost-generated graphics with ConTeXt, > but I seem to be unable to do so. > A possible reason for the error is that the name of the tex file > is the same as the name of the figure file (test), because ConTeXt > *does* check for this, and this is where it chooses not to handle > the picture. I can't you whether you supposition is right because if Hans Hagen goes out of his way to avoid name collisions with graphics then it's good enough for me. Here's an example from the metafun manual, that works with \externalfigure (it also avoids name collisions). ----- %output=pdf \setupcolors [state=start] \startMPcode boolean show_labels ; show_labels := true; def draw_problem (expr n, p, q, r, s) = % number & 4 postitions beginfig(n) ; save x,y ; z[1][1] = p ; z[2][1] = q ; z[3][1] = r ; z[4][1] = s ; for i = 1 upto 4 : z[i][1] = (x[i][1],y[i][1]) = z[if i=1: 4 else: i-1 fi][2] ; z[i][2] = (x[i][2],y[i][2]) ; z[i][3] = (x[i][2]-y[i][2]+y[i][1], y[i][2]+x[i][2]-x[i][1]) ; z[i][4] = (x[i][1]-y[i][2]+y[i][1], y[i][1]+x[i][2]-x[i][1]) ; z[i] = 0.5[z[i][1], z[i][3]] ; endfor ; z[0] = whatever[z[1], z[3]] = whatever[z[2], z[4]] ; pickup pencircle scaled .5pt ; for i = 1 upto 4 : draw z[i][1]--z[i][2]--z[i][3]--z[i][4]--cycle ; draw z[i][1]--z[i][3] ; draw z[i][2]--z[i][4] ; if i < 3 : draw z[i]--z[i+2] dashed evenly fi ; endfor ; draw ((1,0)--(1,1)--(0,1)) zscaled (unitvector(z[1]-z[0])*10pt) shifted z[0] ; mark_rt_angle (z[1], z[0], z[2]) ; % z2 is not used at all if show_labels: pickup pencircle scaled 5pt ; dotlabel.llft(btex $Z_{11}$ etex, z[1][1]) ; dotlabel.ulft(btex $Z_{12}$ etex, z[1][2]) ; dotlabel.ulft(btex $Z_{13}$ etex, z[1][3]) ; dotlabel.llft(btex $Z_{14}$ etex, z[1][4]) ; dotlabel.lft (btex $Z_{21}$ etex, z[2][1]) ; dotlabel.llft(btex $Z_{22}$ etex, z[2][2]) ; dotlabel.urt (btex $Z_{23}$ etex, z[2][3]) ; dotlabel.llft(btex $Z_{24}$ etex, z[2][4]) ; dotlabel.urt (btex $Z_{31}$ etex, z[3][1]) ; dotlabel.ulft(btex $Z_{32}$ etex, z[3][2]) ; dotlabel.urt (btex $Z_{33}$ etex, z[3][3]) ; dotlabel.urt (btex $Z_{34}$ etex, z[3][4]) ; dotlabel.lft (btex $Z_{41}$ etex, z[4][1]) ; dotlabel.urt (btex $Z_{42}$ etex, z[4][2]) ; dotlabel.llft(btex $Z_{43}$ etex, z[4][3]) ; dotlabel.lrt (btex $Z_{44}$ etex, z[4][4]) ; dotlabel.urt (btex $Z_{0}$ etex, z[0]) ; dotlabel.lft (btex $Z_{1}$ etex, z[1]) ; dotlabel.top (btex $Z_{2}$ etex, z[2]) ; dotlabel.rt (btex $Z_{3}$ etex, z[3]) ; dotlabel.bot (btex $Z_{4}$ etex, z[4]) ; fi ; endfig ; enddef ; angle_radius = 10pt ; def mark_rt_angle (expr a, b, c) = draw ((1,0)--(1,1)--(0,1)) zscaled (angle_radius*unitvector(a-b)) shifted b enddef ; def do_draw_problem (expr n, i, j) = draw_problem (n, (400pt, 400pt), (400pt, 600pt), i[(400pt,600pt),(550pt,600pt)], j[(400pt,400pt),(550pt,400pt)] ) ; enddef ; do_draw_problem (50, 0.6, 1.0) ; \stopMPcode \starttext \externalfigure[example22-mpgraph.50] \stoptext %%% Local Variables: %%% mode:context %%% End: -----