From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/94364 Path: news.gmane.org!not-for-mail From: Wolfgang Schuster Newsgroups: gmane.comp.tex.context Subject: Re: \startuseMPgraphic Date: Mon, 11 Apr 2016 14:42:59 +0200 Message-ID: <570B9BD3.10707@gmail.com> References: <87835776-211F-4B8A-9730-A49978E25D66@uva.nl> Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============8833588478191557533==" X-Trace: ger.gmane.org 1460378619 25432 80.91.229.3 (11 Apr 2016 12:43:39 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 11 Apr 2016 12:43:39 +0000 (UTC) To: mailing list for ConTeXt users Original-X-From: ntg-context-bounces@ntg.nl Mon Apr 11 14:43:38 2016 Return-path: Envelope-to: gctc-ntg-context-518@m.gmane.org Original-Received: from zapf.boekplan.nl ([5.39.185.232] helo=zapf.ntg.nl) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1apbBq-00033m-54 for gctc-ntg-context-518@m.gmane.org; Mon, 11 Apr 2016 14:43:38 +0200 Original-Received: from localhost (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id 3DE1A6619; Mon, 11 Apr 2016 14:43:14 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at zapf.boekplan.nl Original-Received: from zapf.ntg.nl ([127.0.0.1]) by localhost (zapf.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id a7110PFJu53p; Mon, 11 Apr 2016 14:43:11 +0200 (CEST) Original-Received: from zapf.ntg.nl (localhost [IPv6:::1]) by zapf.ntg.nl (Postfix) with ESMTP id E4B5A9F54; Mon, 11 Apr 2016 14:43:11 +0200 (CEST) Original-Received: from localhost (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id CFAC86619 for ; Mon, 11 Apr 2016 14:43:10 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at zapf.boekplan.nl Original-Received: from zapf.ntg.nl ([127.0.0.1]) by localhost (zapf.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id ljZQWtGzFcjR for ; Mon, 11 Apr 2016 14:43:10 +0200 (CEST) Original-Received: from mail-wm0-f41.google.com (mail-wm0-f41.google.com [74.125.82.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by zapf.ntg.nl (Postfix) with ESMTPS id 47B364EE7 for ; Mon, 11 Apr 2016 14:43:00 +0200 (CEST) Original-Received: by mail-wm0-f41.google.com with SMTP id u206so102565433wme.1 for ; Mon, 11 Apr 2016 05:43:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to; bh=sQdkBlTBwi6aCSWMj+BbRu0hru1p2cOwk9GEZqYOyXQ=; b=qZQXFHYytUFNzbIL+9hMfd5zEYI4aSlhnapk/cK35l/n/DTZHjQrcOg9Wx5nMb+9/k v/w9Ym5Un3N+ByUoFZS+Nw35xah0YALeJNBLx1PU0zK9Sjmz4asXv5N2eHM/9lnVAeXS Z0gqD6U2vkkJCPWwGM9TUiNKsrX5oNBbJqv1GOOfv0Xty2Q0BJOXAmhxkscrYVFmUHro iD1e01yLMLGPUcVVl0LQz090hkvBxYQK4FB6oZwpu0iGXrIzSCAUli9PbIGMogGzaDpu lhbgD/HgO4GqA7jYpMhx5l+aq2ooZzmTiqO+Ua9R4cU4DT2TDrsDi4L9IQ4cRtNf+b7V IXeg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:message-id:date:from:user-agent:mime-version:to :subject:references:in-reply-to; bh=sQdkBlTBwi6aCSWMj+BbRu0hru1p2cOwk9GEZqYOyXQ=; b=B2Qrauqjceq/ntKQpnwA/OyZ7y82iaDdxpvOwxfhDVd2T0092IGO/ZlxqqutPSFhuI 5uUqtmTg1e0eLJ4BMTy+vUy4HCWu9/mK2iy8CqAG9sa7/1sUELBxnUgzeSSQoNzRv52n BPbrB3wbl0Mf07xrI6XzuC1ChOHAAwUjTY52OYyyMrInXRJl1xqmAj8IOl6N4P64DWXH gBOcNHosXI/QJsbsPShnHFptldGC7g7xN+ETGnvoEEUWy4igHCBKGGGByd5dRxJcgWCT KPRjX1qXwGytkuabXg/BBP7nWCNwe33niN/NEh0W2Lh69m6xmU2AdWn2f+itDbKBHMXs 2qsQ== X-Gm-Message-State: AD7BkJK8UNFGTTSbUy9Uv5649oQyJsXJNcnsnqmHbhA4UM298OptZNM1umJMTGC2fQqRBA== X-Received: by 10.28.32.5 with SMTP id g5mr17428719wmg.79.1460378580021; Mon, 11 Apr 2016 05:43:00 -0700 (PDT) Original-Received: from keima.localdomain (x2f21c8e.dyn.telefonica.de. [2.242.28.142]) by smtp.gmail.com with ESMTPSA id kj9sm27800941wjb.14.2016.04.11.05.42.58 for (version=TLSv1/SSLv3 cipher=OTHER); Mon, 11 Apr 2016 05:42:59 -0700 (PDT) User-Agent: Postbox 4.0.8 (Macintosh/20151105) In-Reply-To: <87835776-211F-4B8A-9730-A49978E25D66@uva.nl> X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.16 Precedence: list List-Id: mailing list for ConTeXt users List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ntg-context-bounces@ntg.nl Original-Sender: "ntg-context" Xref: news.gmane.org gmane.comp.tex.context:94364 Archived-At: This is a multi-part message in MIME format. --===============8833588478191557533== Content-Type: multipart/alternative; boundary="------------070407020904030609000505" This is a multi-part message in MIME format. --------------070407020904030609000505 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit > Meer, Hans van der > 11. April 2016 um 10:35 > I seem to remember the following variations in \startuseMPgraphic. > > (1) \startuseMPgraphic{name}{comma separated list of variables} > (2) \startuseMPgraphic{name}{comma separated list of key=value pairs} > In the second case one is able to set a default value to that > variable, possibly to be overridden with \useMPgraphic{name}{key=value}. > I very much would like to specify default values on the > \startuseMPgraphic definition of the graphic. > > However, I cannot get option (2) working. Do I have a bad memory > (possible of course ;-), Has it to be done otherwise? > In the example below the graphic myname1 is ok, but myname2 gives the > following error: > metapost > error: > >> orange > ! Improper type. > > ; > <*> ...raw unitsquare scaled 1cm withcolor orange; > > minimal example: > > \starttext > \startuseMPgraphic{myname1}{color} > pickup pencircle scaled 1mm; > draw unitsquare scaled 1cm withcolor \MPvar{color}; > \stopuseMPgraphic > > \startuseMPgraphic{myname2}{color=red} > pickup pencircle scaled 1mm; > draw unitsquare scaled 1cm withcolor \MPvar{color}; > \stopuseMPgraphic > > \useMPgraphic{myname1}{color=blue} > \useMPgraphic{myname2}{color=orange} > > \stoptext \startuseMPgraphic{hans}{color} pickup pencircle scaled 1mm; draw unitsquare scaled 1cm withcolor \MPvar{color}; \stopuseMPgraphic \setupMPvariables[hans][color=red] \starttext \useMPgraphic{hans} \useMPgraphic{hans}{color=blue} \stoptext Wolfgang --------------070407020904030609000505 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit
11. April 2016 um 10:35
I seem to remember the following variations in \startuseMPgraphic.

(1) \startuseMPgraphic{name}{comma separated list of variables}
(2) \startuseMPgraphic{name}{comma separated list of key=value pairs}
In the second case one is able to set a default value to that variable, possibly to be overridden with \useMPgraphic{name}{key=value}.
I very much would like to specify default values on the \startuseMPgraphic definition of the graphic.

However, I cannot get option (2) working. Do I have a bad memory (possible of course ;-), Has it to be done otherwise?
In the example below the graphic myname1 is ok, but myname2 gives the following error:
metapost        > error: 
>> orange
! Improper type.
<to be read again> 
                   ;
<*> ...raw unitsquare scaled 1cm withcolor orange;

minimal example:

\starttext
\startuseMPgraphic{myname1}{color}
  pickup pencircle scaled 1mm;
  draw unitsquare scaled 1cm withcolor \MPvar{color};
\stopuseMPgraphic

\startuseMPgraphic{myname2}{color=red}
  pickup pencircle scaled 1mm;
  draw unitsquare scaled 1cm withcolor \MPvar{color};
\stopuseMPgraphic

\useMPgraphic{myname1}{color=blue}
\useMPgraphic{myname2}{color=orange}

\stoptext
\startuseMPgraphic{hans}{color}
  pickup pencircle scaled 1mm;
  draw unitsquare scaled 1cm withcolor \MPvar{color};
\stopuseMPgraphic

\setupMPvariables[hans][color=red]

\starttext

\useMPgraphic{hans}

\useMPgraphic{hans}{color=blue}

\stoptext

Wolfgang
--------------070407020904030609000505-- --===============8833588478191557533== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19f X19fX19fX19fX19fX19fX19fX19fX19fX18KSWYgeW91ciBxdWVzdGlvbiBpcyBvZiBpbnRlcmVz dCB0byBvdGhlcnMgYXMgd2VsbCwgcGxlYXNlIGFkZCBhbiBlbnRyeSB0byB0aGUgV2lraSEKCm1h aWxsaXN0IDogbnRnLWNvbnRleHRAbnRnLm5sIC8gaHR0cDovL3d3dy5udGcubmwvbWFpbG1hbi9s aXN0aW5mby9udGctY29udGV4dAp3ZWJwYWdlICA6IGh0dHA6Ly93d3cucHJhZ21hLWFkZS5ubCAv IGh0dHA6Ly90ZXguYWFuaGV0Lm5ldAphcmNoaXZlICA6IGh0dHA6Ly9mb3VuZHJ5LnN1cGVsZWMu ZnIvcHJvamVjdHMvY29udGV4dHJldi8Kd2lraSAgICAgOiBodHRwOi8vY29udGV4dGdhcmRlbi5u ZXQKX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19f X19fX19fX19fX19fX19fX19fX19fX19fX19fX18= --===============8833588478191557533==--