ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* \startuseMPgraphic
       [not found] <mailman.1.1460368801.12686.ntg-context@ntg.nl>
@ 2016-04-11 13:10 ` Jeong Dal
  2016-04-11 14:17   ` \startuseMPgraphic Alan BRASLAU
  0 siblings, 1 reply; 14+ messages in thread
From: Jeong Dal @ 2016-04-11 13:10 UTC (permalink / raw)
  To: ntg-context

Dear Hans van der Meer,

Thank you for your sample code.
I learned how to pass the value of the variables.
BTW, if I change “orange” to “red” or “green”, it is working fine. I think that  “orange” is not the predefined color. There is no color “orange” in the  MetaFun manual either.

Thank you.

Best regards, 
Dalyoung


> \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
> 
> Hans van der Meer
> 

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: \startuseMPgraphic
  2016-04-11 13:10 ` \startuseMPgraphic Jeong Dal
@ 2016-04-11 14:17   ` Alan BRASLAU
  2016-04-11 14:38     ` \startuseMPgraphic Meer, Hans van der
  0 siblings, 1 reply; 14+ messages in thread
From: Alan BRASLAU @ 2016-04-11 14:17 UTC (permalink / raw)
  To: Jeong Dal; +Cc: ntg-context

On Mon, 11 Apr 2016 22:10:02 +0900
Jeong Dal <haksan@me.com> wrote:

> BTW, if I change “orange” to “red” or “green”, it is working fine. I
> think that  “orange” is not the predefined color. There is no color
> “orange” in the  MetaFun manual either.

Defined MP colors are:

color black, white, red, green, blue, cyan, magenta, yellow

As a "bonus", orange is defined by default for ConTeXt in
colo-imp-rgb.mkiv
(it is also defined in colo-imp-x11.mkiv, etc.)

Remember that ConTeXt colors can be accessed in MP as
\MPcolor{orange}

Alan
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: \startuseMPgraphic
  2016-04-11 14:17   ` \startuseMPgraphic Alan BRASLAU
@ 2016-04-11 14:38     ` Meer, Hans van der
  2016-04-11 17:16       ` \startuseMPgraphic Aditya Mahajan
  0 siblings, 1 reply; 14+ messages in thread
From: Meer, Hans van der @ 2016-04-11 14:38 UTC (permalink / raw)
  To: NTG ConTeXt


[-- Attachment #1.1: Type: text/plain, Size: 741 bytes --]


On 11 Apr 2016, at 16:17, Alan BRASLAU <alan.braslau@cea.fr<mailto:alan.braslau@cea.fr>> wrote:

Remember that ConTeXt colors can be accessed in MP as
\MPcolor{orange}

Alan

However with the snippet below I see the default black with MPcolor and the wanted red with \MPvar. Thus?

Hans van der Meer

\starttext
  \startuseMPgraphic{example1}{color}
    pickup pencircle scaled 1mm;
    draw unitsquare scaled 1cm
         withcolor \MPcolor{color};
  \stopuseMPgraphic
  \startuseMPgraphic{example2}{color}
    pickup pencircle scaled 1mm;
    draw unitsquare scaled 1cm
         withcolor \MPvar{color};
  \stopuseMPgraphic
  \useMPgraphic{example1}{color=red}
  \useMPgraphic{example2}{color=red}
\stoptext



[-- Attachment #1.2: Type: text/html, Size: 2285 bytes --]

[-- Attachment #2: mpcolor.pdf --]
[-- Type: application/pdf, Size: 4509 bytes --]

[-- Attachment #3: Type: text/plain, Size: 485 bytes --]

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: \startuseMPgraphic
  2016-04-11 14:38     ` \startuseMPgraphic Meer, Hans van der
@ 2016-04-11 17:16       ` Aditya Mahajan
  2016-04-11 19:50         ` \startuseMPgraphic Meer, Hans van der
  0 siblings, 1 reply; 14+ messages in thread
From: Aditya Mahajan @ 2016-04-11 17:16 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On Mon, 11 Apr 2016, Meer, Hans van der wrote:

>
> On 11 Apr 2016, at 16:17, Alan BRASLAU <alan.braslau@cea.fr<mailto:alan.braslau@cea.fr>> wrote:
>
> Remember that ConTeXt colors can be accessed in MP as
> \MPcolor{orange}
>
> Alan
>
> However with the snippet below I see the default black with MPcolor and the wanted red with \MPvar. Thus?
>
> Hans van der Meer
>
> \starttext
>  \startuseMPgraphic{example1}{color}
>    pickup pencircle scaled 1mm;
>    draw unitsquare scaled 1cm
>         withcolor \MPcolor{color};

This is looking for a color named 'color'. You need 
\MPcolor{\MPvar{color}}.


>  \stopuseMPgraphic
>  \startuseMPgraphic{example2}{color}
>    pickup pencircle scaled 1mm;
>    draw unitsquare scaled 1cm
>         withcolor \MPvar{color};
>  \stopuseMPgraphic
>  \useMPgraphic{example1}{color=red}
>  \useMPgraphic{example2}{color=red}
> \stoptext

Aditya
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: \startuseMPgraphic
  2016-04-11 17:16       ` \startuseMPgraphic Aditya Mahajan
@ 2016-04-11 19:50         ` Meer, Hans van der
  2016-04-11 20:27           ` \startuseMPgraphic Wolfgang Schuster
  0 siblings, 1 reply; 14+ messages in thread
From: Meer, Hans van der @ 2016-04-11 19:50 UTC (permalink / raw)
  To: NTG ConTeXt

But why should typing \MPcolor{\MPvar{color}}be necessary or useful when \MPvar(color) obviously is sufficient?
Or is there a special reason for the nested macros?

> On 11 Apr 2016, at 19:16, Aditya Mahajan <adityam@umich.edu> wrote:
> 
> On Mon, 11 Apr 2016, Meer, Hans van der wrote:
> 
>> 
>> On 11 Apr 2016, at 16:17, Alan BRASLAU <alan.braslau@cea.fr<mailto:alan.braslau@cea.fr>> wrote:
>> 
>> Remember that ConTeXt colors can be accessed in MP as
>> \MPcolor{orange}
>> 
>> Alan
>> 
>> However with the snippet below I see the default black with MPcolor and the wanted red with \MPvar. Thus?
>> 
>> Hans van der Meer
>> 
>> \starttext
>> \startuseMPgraphic{example1}{color}
>>   pickup pencircle scaled 1mm;
>>   draw unitsquare scaled 1cm
>>        withcolor \MPcolor{color};
> 
> This is looking for a color named 'color'. You need \MPcolor{\MPvar{color}}.
> 
> 
>> \stopuseMPgraphic
>> \startuseMPgraphic{example2}{color}
>>   pickup pencircle scaled 1mm;
>>   draw unitsquare scaled 1cm
>>        withcolor \MPvar{color};
>> \stopuseMPgraphic
>> \useMPgraphic{example1}{color=red}
>> \useMPgraphic{example2}{color=red}
>> \stoptext
> 
> Aditya

Hans van der Meer




___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: \startuseMPgraphic
  2016-04-11 19:50         ` \startuseMPgraphic Meer, Hans van der
@ 2016-04-11 20:27           ` Wolfgang Schuster
  2016-04-11 22:30             ` \startuseMPgraphic Alan BRASLAU
  0 siblings, 1 reply; 14+ messages in thread
From: Wolfgang Schuster @ 2016-04-11 20:27 UTC (permalink / raw)
  To: mailing list for ConTeXt users


[-- Attachment #1.1: Type: text/plain, Size: 1826 bytes --]

> Meer, Hans van der <mailto:H.vanderMeer@uva.nl>
> 11. April 2016 um 21:50
> But why should typing \MPcolor{\MPvar{color}}be necessary or useful 
> when \MPvar(color) obviously is sufficient?
> Or is there a special reason for the nested macros?
Let's separate your question in two separate things, the first is colors.

There are two way to define colors for a metapost graphics, the first is 
to define it with metapost itself.

%% begin example
\startMPpage
color myred ; myred := (1,0,0) ;
fill fullcircle scaled 3cm withcolor myred ;
\stopMPpage
%% end example

The disadvantage is that you can use this color only in your graphics 
but not in your tex code.

Now comes the second method where I define the color in tex with the 
\definecolor command and access it in metapost with the color \MPcolor 
command.

%% begin example
\definecolor[myred][r=1]

\startMPpage
fill fullcircle scaled 3cm withcolor \MPcolor{myred} ;
\stopMPpage
%% end example


The second part of the questions concerns metapost variables.

%% begin example
\startuseMPgraphic{mycircle}{diameter,color}
fill fullcircle scaled \MPvariable{diameter} withcolor \MPvariable{color} ;
\stopuseMPgraphic

\startTEXpage
\useMPgraphic{mycircle}{diameter=3cm,color=red}
\stopTEXpage
%% end example

The second argument of the \startuseMPgraphic command initializes
the variables of your command and the \MPvariable accesses the value
of the variable. In this case "color" is only the name of the variable
and doesn't tell if we want a tex defined color or a metapost defined color.

In my example the color has to be defined in metapost because after
expansion we end with "withcolor red" in the example. We you want
a color which has been defined in tex you have put \MPcolor around
the \MPvariable command, i.e. "\MPcolor{\MPvariable{color}}".

Wolfgang

[-- Attachment #1.2: Type: text/html, Size: 2997 bytes --]

[-- Attachment #2: Type: text/plain, Size: 485 bytes --]

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: \startuseMPgraphic
  2016-04-11 20:27           ` \startuseMPgraphic Wolfgang Schuster
@ 2016-04-11 22:30             ` Alan BRASLAU
  2016-04-11 22:52               ` Warnings while compiling pdf after update L.S.-Soc&Gam
  2016-04-11 23:00               ` \startuseMPgraphic Aditya Mahajan
  0 siblings, 2 replies; 14+ messages in thread
From: Alan BRASLAU @ 2016-04-11 22:30 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Thank you Wolfgang, this is a very good explanation.


One can simplify one's code, perhaps, by defining MP colors from
ConTeXt colors, as in:
	color orange ; orange := \MPcolor{orange} ;
Then,  one can use orange. There is not much point in redefining the
other colors (red, green, blue, cyan, magenta, yellow, black, white) as
they are defined using the same rgb values.

In fact, \MPcolor{} simply injects "(r,g,b)" or "(c,m,y,k)" with
explicit values into the MP code.

Defining new MP colors is less general than explicitly using
\MPcolor{...}, for it is limiting, and it would be somewhat silly to
add definitions for all of the wonderful colors found in colo-imp-x11,
for example.

By the way, we added colo-imp-crayola having some funky, hallucinogenic
names (according to Hans) as well as colo-imp-ral.
(The first might be of interest to Americans and the second to
Europeans ;-)

Other collections, such as colo-imp-pantone and colo-imp-rosco are not
distributed due to copyright restrictions (but I have made private
copies, shhh!)

Alan




On Mon, 11 Apr 2016 22:27:06 +0200
Wolfgang Schuster <schuster.wolfgang@gmail.com> wrote:

> There are two way to define colors for a metapost graphics, the first
> is to define it with metapost itself.
> 
> %% begin example
> \startMPpage
> color myred ; myred := (1,0,0) ;
> fill fullcircle scaled 3cm withcolor myred ;
> \stopMPpage
> %% end example
> 
> The disadvantage is that you can use this color only in your graphics
> but not in your tex code.
> 
> Now comes the second method where I define the color in tex with the
> \definecolor command and access it in metapost with the color
> \MPcolor command.
> 
> %% begin example
> \definecolor[myred][r=1]
> 
> \startMPpage
> fill fullcircle scaled 3cm withcolor \MPcolor{myred} ;
> \stopMPpage
> %% end example
> 
> 
> The second part of the questions concerns metapost variables.
> 
> %% begin example
> \startuseMPgraphic{mycircle}{diameter,color}
> fill fullcircle scaled \MPvariable{diameter} withcolor
> \MPvariable{color} ; \stopuseMPgraphic
> 
> \startTEXpage
> \useMPgraphic{mycircle}{diameter=3cm,color=red}
> \stopTEXpage
> %% end example
> 
> The second argument of the \startuseMPgraphic command initializes
> the variables of your command and the \MPvariable accesses the value
> of the variable. In this case "color" is only the name of the variable
> and doesn’t tell if we want a tex defined color or a metapost defined
> color.
> 
> In my example the color has to be defined in metapost because after
> expansion we end with "withcolor red" in the example. We you want
> a color which has been defined in tex you have put \MPcolor around
> the \MPvariable command, i.e. "\MPcolor{\MPvariable{color}}".

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Warnings while compiling pdf after update
  2016-04-11 22:30             ` \startuseMPgraphic Alan BRASLAU
@ 2016-04-11 22:52               ` L.S.-Soc&Gam
  2016-04-11 23:07                 ` Hans Hagen
  2016-04-11 23:00               ` \startuseMPgraphic Aditya Mahajan
  1 sibling, 1 reply; 14+ messages in thread
From: L.S.-Soc&Gam @ 2016-04-11 22:52 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Hi guys,

I updated CTX today and now on every pdf compilation i get two warnings:

interfaces      > implementor > warning: 'scanners.setmapfile' is redefined
interfaces      > implementor > warning: 'commands.setmapfile' is redefined

so three CTX runs give me six warnings. is there a way to disable them?


Greets, Sebastian

My system:
Win10x64
ConTeXt Version: beta-2016.04.10 23:52
LuaTeX Version: beta-0.95.0
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: \startuseMPgraphic
  2016-04-11 22:30             ` \startuseMPgraphic Alan BRASLAU
  2016-04-11 22:52               ` Warnings while compiling pdf after update L.S.-Soc&Gam
@ 2016-04-11 23:00               ` Aditya Mahajan
  1 sibling, 0 replies; 14+ messages in thread
From: Aditya Mahajan @ 2016-04-11 23:00 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On Mon, 11 Apr 2016, Alan BRASLAU wrote:

> By the way, we added colo-imp-crayola having some funky, hallucinogenic
> names (according to Hans) as well as colo-imp-ral.
> (The first might be of interest to Americans and the second to
> Europeans ;-)

These are nice colors. For anyone interested, you can view these using:

\showcolor[crayola]
\showcolor[ral]

I'll update the wiki page on colors.

[BTW, all the links generated using {src:...} on the wiki are wrong. 
First, they point to a really old copy (2014.02.14). I can change the link 
to the bitbucket mirror (by changing the src template), but because of the 
recent reorganization of the source code, all the links will be wrong. So 
all the links to source files will need to be updated manually (or using a 
script).

Aditya
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Warnings while compiling pdf after update
  2016-04-11 22:52               ` Warnings while compiling pdf after update L.S.-Soc&Gam
@ 2016-04-11 23:07                 ` Hans Hagen
  0 siblings, 0 replies; 14+ messages in thread
From: Hans Hagen @ 2016-04-11 23:07 UTC (permalink / raw)
  To: ntg-context

On 4/12/2016 12:52 AM, L.S.-Soc&Gam wrote:
> Hi guys,
>
> I updated CTX today and now on every pdf compilation i get two warnings:
>
> interfaces      > implementor > warning: 'scanners.setmapfile' is redefined
> interfaces      > implementor > warning: 'commands.setmapfile' is redefined
>
> so three CTX runs give me six warnings. is there a way to disable them?

you have to wait till the update (tomorrow)

Hans

-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
       tel: 038 477 53 69 | www.pragma-ade.com | www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: \startuseMPgraphic
  2016-04-11 13:30   ` \startuseMPgraphic Meer, Hans van der
@ 2016-04-11 14:12     ` Wolfgang Schuster
  0 siblings, 0 replies; 14+ messages in thread
From: Wolfgang Schuster @ 2016-04-11 14:12 UTC (permalink / raw)
  To: mailing list for ConTeXt users


[-- Attachment #1.1: Type: text/plain, Size: 382 bytes --]

> Meer, Hans van der <mailto:H.vanderMeer@uva.nl>
> 11. April 2016 um 15:30
> Thanks Wolfgang.
> It appears my memory did some "wishful thinking" in wanting 
> \startuseMPgraphic{name}{key=value}. Although that would have been nice.
You get a document with the syntax of metapost related commands when you 
type

     context --extra=setups metapost

on the command line.

Wolfgang

[-- Attachment #1.2: Type: text/html, Size: 1479 bytes --]

[-- Attachment #2: Type: text/plain, Size: 485 bytes --]

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: \startuseMPgraphic
  2016-04-11 12:42 ` \startuseMPgraphic Wolfgang Schuster
@ 2016-04-11 13:30   ` Meer, Hans van der
  2016-04-11 14:12     ` \startuseMPgraphic Wolfgang Schuster
  0 siblings, 1 reply; 14+ messages in thread
From: Meer, Hans van der @ 2016-04-11 13:30 UTC (permalink / raw)
  To: NTG ConTeXt


[-- Attachment #1.1: Type: text/plain, Size: 1211 bytes --]

Thanks Wolfgang.
It appears my memory did some "wishful thinking" in wanting \startuseMPgraphic{name}{key=value}. Although that would have been nice.
Hans van der Meer

On 11 Apr 2016, at 14:42, Wolfgang Schuster <schuster.wolfgang@gmail.com<mailto:schuster.wolfgang@gmail.com>> wrote:

Meer, Hans van der<mailto:H.vanderMeer@uva.nl>
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?

\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


[-- Attachment #1.2: Type: text/html, Size: 3498 bytes --]

[-- Attachment #2: Type: text/plain, Size: 485 bytes --]

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: \startuseMPgraphic
  2016-04-11  8:35 \startuseMPgraphic Meer, Hans van der
@ 2016-04-11 12:42 ` Wolfgang Schuster
  2016-04-11 13:30   ` \startuseMPgraphic Meer, Hans van der
  0 siblings, 1 reply; 14+ messages in thread
From: Wolfgang Schuster @ 2016-04-11 12:42 UTC (permalink / raw)
  To: mailing list for ConTeXt users


[-- Attachment #1.1: Type: text/plain, Size: 1584 bytes --]

> Meer, Hans van der <mailto:H.vanderMeer@uva.nl>
> 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

[-- Attachment #1.2: Type: text/html, Size: 4616 bytes --]

[-- Attachment #2: Type: text/plain, Size: 485 bytes --]

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 14+ messages in thread

* \startuseMPgraphic
@ 2016-04-11  8:35 Meer, Hans van der
  2016-04-11 12:42 ` \startuseMPgraphic Wolfgang Schuster
  0 siblings, 1 reply; 14+ messages in thread
From: Meer, Hans van der @ 2016-04-11  8:35 UTC (permalink / raw)
  To: NTG ConTeXt


[-- Attachment #1.1: Type: text/plain, Size: 1240 bytes --]

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

Hans van der Meer


[-- Attachment #1.2: Type: text/html, Size: 3547 bytes --]

[-- Attachment #2: Type: text/plain, Size: 485 bytes --]

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2016-04-11 23:07 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <mailman.1.1460368801.12686.ntg-context@ntg.nl>
2016-04-11 13:10 ` \startuseMPgraphic Jeong Dal
2016-04-11 14:17   ` \startuseMPgraphic Alan BRASLAU
2016-04-11 14:38     ` \startuseMPgraphic Meer, Hans van der
2016-04-11 17:16       ` \startuseMPgraphic Aditya Mahajan
2016-04-11 19:50         ` \startuseMPgraphic Meer, Hans van der
2016-04-11 20:27           ` \startuseMPgraphic Wolfgang Schuster
2016-04-11 22:30             ` \startuseMPgraphic Alan BRASLAU
2016-04-11 22:52               ` Warnings while compiling pdf after update L.S.-Soc&Gam
2016-04-11 23:07                 ` Hans Hagen
2016-04-11 23:00               ` \startuseMPgraphic Aditya Mahajan
2016-04-11  8:35 \startuseMPgraphic Meer, Hans van der
2016-04-11 12:42 ` \startuseMPgraphic Wolfgang Schuster
2016-04-11 13:30   ` \startuseMPgraphic Meer, Hans van der
2016-04-11 14:12     ` \startuseMPgraphic Wolfgang Schuster

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).