Re: [NTG-context] METAPOST vardef returning multiple and non-numeric types as a single answer?

2020-03-16 Thread Hans Hagen

On 3/16/2020 10:23 AM, Taco Hoekwater wrote:




On 16 Mar 2020, at 10:10, Taco Hoekwater  wrote:




On 16 Mar 2020, at 09:53, Gerben Wierda  wrote:

Hola! So, the arguments passed to macros are by reference and not by value? I 
could have known of course, they are simple expansions, but I’d like to be 
sure. IfI assign to a variable inside a vardef macro and that variable is not 
’save’d I’m changing the original?


Yes. (A simple test would have confirmed that)


Oops, sorry, no! I was wrong on that… it must be too early for me.

   vardef Foo(text y) =
 scantokens(y&":=5”);
   enddef;
   Foo("x");

This would work, but that is weird. This also works, and that is why
I had the erroneous memory that it would work always:

   vardef Foo(expr a)(text y) =
 y[a] := 5;
   enddef;
   numeric foo[];
   foo[1] = 6;
   Foo(1,foo);

or you could use global variables, of course.

Main point: Metapost is not an easy language to grasp. If you want to
really understand how it works, you should study the Metafont book by DEK. > As you can clearly see, even experienced users are likely to make 

mistakes.
it's the mixture of delayed parsing and expansion and ... no other 
language like that i guess (which at the same time is its charm)


passing "text y" is (i think) not that that far from the scantokens 
(running over already tokenized vs running over a string while 
tokenizing it ... but these input models (are we in scanning file input, 
string input, tokenlist) can be kind of confusing


that said, after muy share of mp programming i would not have thought 
about the text y as pass by reference, also because it's only true for 
these pseudo arrays (maybe suffixes also work)


Hans

-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
   tel: 038 477 53 69 | www.pragma-ade.nl | 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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] METAPOST vardef returning multiple and non-numeric types as a single answer?

2020-03-16 Thread Taco Hoekwater


> On 16 Mar 2020, at 10:10, Taco Hoekwater  wrote:
> 
> 
> 
>> On 16 Mar 2020, at 09:53, Gerben Wierda  wrote:
>> 
>> Hola! So, the arguments passed to macros are by reference and not by value? 
>> I could have known of course, they are simple expansions, but I’d like to be 
>> sure. IfI assign to a variable inside a vardef macro and that variable is 
>> not ’save’d I’m changing the original?
> 
> Yes. (A simple test would have confirmed that)

Oops, sorry, no! I was wrong on that… it must be too early for me.

  vardef Foo(text y) = 
scantokens(y&":=5”);
  enddef;
  Foo("x");

This would work, but that is weird. This also works, and that is why
I had the erroneous memory that it would work always:

  vardef Foo(expr a)(text y) = 
y[a] := 5;
  enddef;
  numeric foo[]; 
  foo[1] = 6;
  Foo(1,foo);

or you could use global variables, of course.

Main point: Metapost is not an easy language to grasp. If you want to
really understand how it works, you should study the Metafont book by DEK.
As you can clearly see, even experienced users are likely to make mistakes.


Best wishes,
Taco




___
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] METAPOST vardef returning multiple and non-numeric types as a single answer?

2020-03-16 Thread Taco Hoekwater


> On 16 Mar 2020, at 09:53, Gerben Wierda  wrote:
> 
> Hola! So, the arguments passed to macros are by reference and not by value? I 
> could have known of course, they are simple expansions, but I’d like to be 
> sure. IfI assign to a variable inside a vardef macro and that variable is not 
> ’save’d I’m changing the original?

Yes. (A simple test would have confirmed that)

Taco


___
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] METAPOST vardef returning multiple and non-numeric types as a single answer?

2020-03-16 Thread Gerben Wierda
Hola! So, the arguments passed to macros are by reference and not by value? I 
could have known of course, they are simple expansions, but I’d like to be 
sure. IfI assign to a variable inside a vardef macro and that variable is not 
’save’d I’m changing the original?

G

> On 16 Mar 2020, at 09:31, Taco Hoekwater  wrote:
> 
> 
> 
>> On 15 Mar 2020, at 11:22, Gerben Wierda  wrote:
>> 
>> I would like a vardef macro to return the pair of a picture and a bounding 
>> box. I don't want to use the setbound operator, because as soon as I do 
>> that, I cannot access the components of the picture anymore with pathpart.
>> 
>> I found metapost vardef returning multiple values on StackExchange but that 
>> is about returning multiple values of the same numeric type. Is it possible 
>> to have vardef return a set of (picture, path) or (picture, picture) in some 
>> way? If not, I need to make two vardef macros for each result type.
> 
> Sure, using that same endgroup,begingroup trick. But since there is no 
> multi-assignment in metapost that doesn’t you help much.
> Either two separate vardefs or passing the to-be-assigned variable(s) as an 
> extra argument(s) are generally more practical.
> 
> Best wishes,
> Taco
> 
> 
> 
> ___
> 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://context.aanhet.net
> archive  : https://bitbucket.org/phg/context-mirror/commits/
> wiki : http://contextgarden.net
> ___

___
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] Why do I see the outline of the green box in this METAPOST code?

2020-03-16 Thread Taco Hoekwater
Move the fills to within the image(), and build it up in
stacking order. 


> On 14 Mar 2020, at 16:29, Gerben Wierda  wrote:
> 
> Code:
> 
> vardef Foo(expr w, h, lh) =
>save pth; path pth;
>save pthtwo; path pthtwo;
>save pththree; path pththree;
>save pic; picture pic;
>pth = fullsquare xysized (w, h);
>pthtwo = fullsquare xysized (2*lh, lh) shifted (-w/2, 2.5*lh);
>pththree = fullsquare xysized (2*lh, lh) shifted (-w/2, lh);
>fill pth withcolor green;
>fill pthtwo withcolor yellow;
>fill pththree withcolor yellow;
>pic := image (
>draw pth;
>draw pthtwo;
>draw pththree;
>);
>% setbounds pic to pth;
>pic
> enddef ;
> 
> 
> Call:
> 
> \startMPpage
> 
> picture s ; s := Foo(8cm, 2cm, 0.25cm);
> 
> draw s;
> 
> drawdot center leftboundary  s withpen pencircle scaled 2 withcolor green;
> drawdot center rightboundary s withpen pencircle scaled 2 withcolor blue;
> drawdot point .25 along topboundary s withpen pencircle scaled 2 withcolor 
> yellow;
> drawdot .25[llcorner s, lrcorner s] withpen pencircle scaled 2 withcolor 
> magenta;
> drawdot origin  withpen pencircle scaled 4 withcolor red;
> 
> \stopMPpage
> 
> 
> Output:
> 
> 
> 
> Why is the outline of the green box visible in the yellow boxes? And how can 
> I prevent this from happening?
> ___
> 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://context.aanhet.net
> archive  : https://bitbucket.org/phg/context-mirror/commits/
> wiki : http://contextgarden.net
> ___

Taco Hoekwater
Elvenkind BV




___
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] METAPOST vardef returning multiple and non-numeric types as a single answer?

2020-03-16 Thread Taco Hoekwater


> On 15 Mar 2020, at 11:22, Gerben Wierda  wrote:
> 
> I would like a vardef macro to return the pair of a picture and a bounding 
> box. I don't want to use the setbound operator, because as soon as I do that, 
> I cannot access the components of the picture anymore with pathpart.
> 
> I found metapost vardef returning multiple values on StackExchange but that 
> is about returning multiple values of the same numeric type. Is it possible 
> to have vardef return a set of (picture, path) or (picture, picture) in some 
> way? If not, I need to make two vardef macros for each result type.

Sure, using that same endgroup,begingroup trick. But since there is no 
multi-assignment in metapost that doesn’t you help much.
Either two separate vardefs or passing the to-be-assigned variable(s) as an 
extra argument(s) are generally more practical.

Best wishes,
Taco



___
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] Is it possible to use the macOS Optima font in ConTeXt/METAPOST?

2020-03-15 Thread Pablo Rodriguez
On 3/15/20 4:54 PM, Gerben Wierda wrote:
> Subject line says it all…

Hi Gerben,

this should work:

\definefontfamily[mainface][rm][Optima]
%~ \definefontfamily[mainface][rm][URW Classico]
\setupbodyfont[mainface]
\starttext
This is Optima.
\stoptext

I need the commented line to get an Optima clone on my laptop.

I hope it helps,

Pablo
--
http://www.ousia.tk
___
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


[NTG-context] Is it possible to use the macOS Optima font in ConTeXt/METAPOST?

2020-03-15 Thread Gerben Wierda
Subject line says it all…

Thanks in advance,

G
___
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


[NTG-context] METAPOST vardef returning multiple and non-numeric types as a single answer?

2020-03-15 Thread Gerben Wierda
I would like a vardef macro to return the pair of a picture and a bounding box. 
I don't want to use the setbound operator, because as soon as I do that, I 
cannot access the components of the picture anymore with pathpart.

I found metapost vardef returning multiple values 
<https://tex.stackexchange.com/questions/448740/metapost-vardef-returning-multiple-values>
 on StackExchange but that is about returning multiple values of the same 
numeric type. Is it possible to have vardef return a set of (picture, path) or 
(picture, picture) in some way? If not, I need to make two vardef macros for 
each result type.

I tried many things, amongst which:

vardef Foo( expr w, h)
% define pic
pic
end group,begingroup
% define pic
pic
endif

picture foo[]; foo = Foo( 2, 4);

___
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


[NTG-context] Why do I see the outline of the green box in this METAPOST code?

2020-03-14 Thread Gerben Wierda
Code:vardef Foo(expr w, h, lh) =   save pth; path pth;   save pthtwo; path pthtwo;   save pththree; path pththree;   save pic; picture pic;   pth = fullsquare xysized (w, h);   pthtwo = fullsquare xysized (2*lh, lh) shifted (-w/2, 2.5*lh);   pththree = fullsquare xysized (2*lh, lh) shifted (-w/2, lh);   fill pth withcolor green;   fill pthtwo withcolor yellow;   fill pththree withcolor yellow;   pic := image (       draw pth;       draw pthtwo;       draw pththree;   );   % setbounds pic to pth;   picenddef ;Call:\startMPpagepicture s ; s := Foo(8cm, 2cm, 0.25cm);draw s;drawdot center leftboundary  s withpen pencircle scaled 2 withcolor green;drawdot center rightboundary s withpen pencircle scaled 2 withcolor blue;drawdot point .25 along topboundary s withpen pencircle scaled 2 withcolor yellow;drawdot .25[llcorner s, lrcorner s] withpen pencircle scaled 2 withcolor magenta;drawdot origin  withpen pencircle scaled 4 withcolor red;\stopMPpageOutput:

PastedGraphic-1.pdf
Description: Adobe PDF document
Why is the outline of the green box visible in the yellow boxes? And how can I prevent this from happening?___
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] Why does this METAPOST vardef 'save' statement fail?

2020-03-14 Thread Gerben Wierda
Answering myself: pth2 is not a valid variable name. Digits are not allowed.

> On 14 Mar 2020, at 15:45, Gerben Wierda  wrote:
> 
> I have this vardef:
> 
> vardef Foo(expr w, h) =
>save pth; path pth;
>%save pth2; path pth2;
>save pic; picture pic;
>pth = fullsquare xysized (w, h);
>%pth2 = fullsquare xysized (h/4, h/8)
>pic := image (
>draw pth;
>%draw pth2 shifted (-w/2, -h/4);
>% all kind of stuff here
>);
>setbounds pic to pth;
>pic
> enddef ;
> 
> As soon as I uncomment the bold line (first comment) a mtxrun fails. Whatever 
> I try, a single save statement, etc., I fail in getting a second local 
> variable. The METAPOST manual is no help.
> 
> The error shown is:
> 
> metapost log> ! Extra tokens will be flushed.
> metapost log>  
> metapost log>2
> metapost log> Foo->...h;path.pth;save.pth2
> metapost log>   
> ;path.pth2;save.pic;pictur...
> metapost log> <*> ... ; s := Foo(8cm, 2cm)
> metapost log>   ; draw s; 
> drawdot center l...
> metapost log> 
> 
> Why?
> 
> G
> ___
> 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://context.aanhet.net
> archive  : https://bitbucket.org/phg/context-mirror/commits/
> wiki : http://contextgarden.net
> ___

___
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


[NTG-context] Why does this METAPOST vardef 'save' statement fail?

2020-03-14 Thread Gerben Wierda
I have this vardef:

vardef Foo(expr w, h) =
   save pth; path pth;
   %save pth2; path pth2;
   save pic; picture pic;
   pth = fullsquare xysized (w, h);
   %pth2 = fullsquare xysized (h/4, h/8)
   pic := image (
   draw pth;
   %draw pth2 shifted (-w/2, -h/4);
   % all kind of stuff here
   );
   setbounds pic to pth;
   pic
enddef ;

As soon as I uncomment the bold line (first comment) a mtxrun fails. Whatever I 
try, a single save statement, etc., I fail in getting a second local variable. 
The METAPOST manual is no help.

The error shown is:

metapost log> ! Extra tokens will be flushed.
metapost log>  
metapost log>    2
metapost log> Foo->...h;path.pth;save.pth2
metapost log>   
;path.pth2;save.pic;pictur...
metapost log> <*> ... ; s := Foo(8cm, 2cm)
metapost log>   ; draw s; 
drawdot center l...
metapost log> 

Why?

G___
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] Can I share METAPOST vardefs over multiple pages?

2020-03-14 Thread Gerben Wierda


> On 13 Mar 2020, at 14:59, Hans Hagen  wrote:
> 
> On 3/13/2020 2:33 PM, Aditya Mahajan wrote:
>> On Fri, 13 Mar 2020, Taco Hoekwater wrote:
>>> Hi,
>>> 
>>> 
>>> 
 On 13 Mar 2020, at 12:53, Gerben Wierda  wrote:
 
 Suppose I have this code:
 
 
 Can I reuse that varied across follow-up MPPages?
>>> 
>>> Sure, put the vardef inside \startMPinclusions:
>> or \startMPdefinitions ... \stopMPdefinitions (don't remember what is the 
>> difference between inclusions and definitions, now).
> definitions: once
> inclusions : every time

That is not quite clear to me (ambiguous because of a lack of experience).

Does ‘once’ mean, valid in just one page or valid in all following pages?

G

___
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] Can I share METAPOST vardefs over multiple pages?

2020-03-13 Thread Hans Hagen

On 3/13/2020 2:33 PM, Aditya Mahajan wrote:

On Fri, 13 Mar 2020, Taco Hoekwater wrote:


Hi,




On 13 Mar 2020, at 12:53, Gerben Wierda  wrote:

Suppose I have this code:


Can I reuse that varied across follow-up MPPages?


Sure, put the vardef inside \startMPinclusions:


or \startMPdefinitions ... \stopMPdefinitions (don't remember what is 
the difference between inclusions and definitions, now).

definitions: once
inclusions : every time

-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
   tel: 038 477 53 69 | www.pragma-ade.nl | 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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] Can I share METAPOST vardefs over multiple pages?

2020-03-13 Thread Gerben Wierda
Thank you. And if I want these in a separate file, what is the correct way to 
include them?

> On 13 Mar 2020, at 13:24, Taco Hoekwater  wrote:
> 
> Hi,
> 
> 
> 
>> On 13 Mar 2020, at 12:53, Gerben Wierda  wrote:
>> 
>> Suppose I have this code:
>> 
>> 
>> Can I reuse that varied across follow-up MPPages?
> 
> Sure, put the vardef inside \startMPinclusions:
> 
> \startMPinclusions
> vardef MyShape(expr w, h) =
>   ...
> enddef ;
> \stopMPinclusions
> \startMPpage
> picture s ; s := MyShape(4cm, 2cm);
> 
> draw s;
> . . .
> \stopMPpage
> 
> \startMPpage
> picture s ; s := MyShape(8cm, 4cm);
> 
> draw s;
> . . .
> \stopMPpage
> 
> 
> Taco
> 
> ___
> 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://context.aanhet.net
> archive  : https://bitbucket.org/phg/context-mirror/commits/
> wiki : http://contextgarden.net
> ___

___
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] Can I share METAPOST vardefs over multiple pages?

2020-03-13 Thread Aditya Mahajan

On Fri, 13 Mar 2020, Taco Hoekwater wrote:


Hi,




On 13 Mar 2020, at 12:53, Gerben Wierda  wrote:

Suppose I have this code:


Can I reuse that varied across follow-up MPPages?


Sure, put the vardef inside \startMPinclusions:


or \startMPdefinitions ... \stopMPdefinitions (don't remember what is the 
difference between inclusions and definitions, now).


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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] Can I share METAPOST vardefs over multiple pages?

2020-03-13 Thread Taco Hoekwater
Hi,



> On 13 Mar 2020, at 12:53, Gerben Wierda  wrote:
> 
> Suppose I have this code:
> 
> 
> Can I reuse that varied across follow-up MPPages?

Sure, put the vardef inside \startMPinclusions:

\startMPinclusions
vardef MyShape(expr w, h) =
   ...
enddef ;
\stopMPinclusions
\startMPpage
picture s ; s := MyShape(4cm, 2cm);

draw s;
 . . .
\stopMPpage

\startMPpage
picture s ; s := MyShape(8cm, 4cm);

draw s;
 . . .
\stopMPpage


Taco

___
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


[NTG-context] Can I share METAPOST vardefs over multiple pages?

2020-03-13 Thread Gerben Wierda
Suppose I have this code:

\startMPpage

vardef MyShape(expr w, h) =
   save pth; path pth ;
   save pic; picture pic;
   pth = fullsquare xysized (w, h);
   pic := image (
   draw pth;
   % all kind of stuff here
   );
   setbounds pic to pth;
   pic
enddef ;

picture s ; s := MyShape(4cm, 2cm);

draw s;

drawdot center leftboundary  s withpen pencircle scaled 2 withcolor green;
drawdot center rightboundary s withpen pencircle scaled 2 withcolor blue;
drawdot point .25 along topboundary s withpen pencircle scaled 2 withcolor 
yellow;
drawdot .25[llcorner s, lrcorner s] withpen pencircle scaled 2 withcolor 
magenta;
drawdot origin  withpen pencircle scaled 2 withcolor red;

\stopMPpage

Can I reuse that varied across follow-up MPPages?

G

___
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] Problem with shading when using rotation (Metapost)

2020-03-03 Thread Fabrice Couvreur
Hi,
No idea ?
Thanks
Fabrice

Le sam. 29 févr. 2020 à 11:01, Fabrice Couvreur 
a écrit :

> Hi,
> Sorry to come back with my match problem. In fact, I do not understand
> why a rotation of 90 influences the degraded color of the ends of the
> matches.
> Thank you.
> Fabrice
>
> \starttext
> \startMPcode
>
>   def match (expr alpha, pos) =
> numeric l;
> l = 4.6cm;
> picture pic;
> pic = image (
> fill unitsquare xscaled 4cm  yscaled 0.2cm  withcolor yellow ;
> fill origin -- (4cm,0) -- (4.1cm,-0.05cm) --  (0.1cm,-0.05cm) --
> cycle withcolor(.6yellow + black);
> draw origin -- (0,0.2cm) -- (4cm,0.2cm) -- (4cm,0) -- (4.1cm,-0.05cm)
> -- (0.1cm,-0.05cm) -- cycle ;
> fill fullcircle xyscaled (0.5cm,0.44cm) shifted (4.125cm,0.1cm) shaded
> withshademethod "circular"
> withshadefactor 0.75
> withshadecolors (white,red););
> draw (fullcircle xyscaled (0.5cm,0.44cm) shifted (4.125cm,0.1cm));
> draw pic rotated alpha shifted pos;
> enddef;
>
> picture house ;
> house = image (
> match(90,(0,0));
> match(0,(0,0));
> match(90,(l,0));
> match(120,(l,l));
> match(60,(0,l)););
>
> draw house;
>
> \stopMPcode
>
___
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


[NTG-context] Problem with shading when using rotation (Metapost)

2020-02-29 Thread Fabrice Couvreur
Hi,
Sorry to come back with my match problem. In fact, I do not understand why
a rotation of 90 influences the degraded color of the ends of the matches.
Thank you.
Fabrice

\starttext
\startMPcode

  def match (expr alpha, pos) =
numeric l;
l = 4.6cm;
picture pic;
pic = image (
fill unitsquare xscaled 4cm  yscaled 0.2cm  withcolor yellow ;
fill origin -- (4cm,0) -- (4.1cm,-0.05cm) --  (0.1cm,-0.05cm) --
cycle withcolor(.6yellow + black);
draw origin -- (0,0.2cm) -- (4cm,0.2cm) -- (4cm,0) -- (4.1cm,-0.05cm)
-- (0.1cm,-0.05cm) -- cycle ;
fill fullcircle xyscaled (0.5cm,0.44cm) shifted (4.125cm,0.1cm) shaded
withshademethod "circular"
withshadefactor 0.75
withshadecolors (white,red););
draw (fullcircle xyscaled (0.5cm,0.44cm) shifted (4.125cm,0.1cm));
draw pic rotated alpha shifted pos;
enddef;

picture house ;
house = image (
match(90,(0,0));
match(0,(0,0));
match(90,(l,0));
match(120,(l,l));
match(60,(0,l)););

draw house;

\stopMPcode
___
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] metapost: remapping colors of an SVG picture

2020-02-20 Thread Hans Hagen

On 2/20/2020 10:29 AM, Jan U. Hasecke wrote:

Am 18.02.20 um 19:24 schrieb Jan U. Hasecke:

Am 18.02.20 um 19:17 schrieb mf:

Il 18/02/20 19:07, Jan U. Hasecke ha scritto:

Am 18.02.20 um 14:53 schrieb Hans Hagen:


\setupcolors[rgb=no]
\startMPcode
  draw lmt_svg [ filename = "sample.svg" ] ;
\stopMPcode

I get this error.

! Not implemented: (unknown numeric)=(string).

]
<*> ... ; p := lmt_svg [ filename = "sample.svg" ]


That's because it's LMTX only (the "lmt" prefix of "lmt_svg" should
stand for "luametatex").


Yes, with lmtx it works but there is no image in the resulting file.


Sorry for digging deeper.

I am very thrilled by the idea that I could simply adjust a RGB SVG to
well defined CMYK colors with this trick.

Can anybody confirm if this works?
mf and i are playing with an overload mechanism (actually pretty 
trivial) ... more later but in principle the answer is yes, but


- first we have to play around a bit
- then it needs to end up in the core
- then there need to be a new context upload
- and mf has to wikify it

so, some patience is needed

Hans

-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
   tel: 038 477 53 69 | www.pragma-ade.nl | 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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] Howto metapost textext set or change basepoint (origin) baseline of text

2020-02-20 Thread Christoph Hintermüller
Hi Hans
On Thu, 2020-02-20 at 10:28 +0100, Hans Hagen wrote:
> On 2/20/2020 10:15 AM, Christoph Hintermüller wrote:
> 
> You can append a palcement suffix, like:
> 
>textext.dflt
> 
> you can try:
> 
>lft rt bot top ulft urt llft lrt d dflt drt origin raw
> 


Thanks again.

textext.origin

was the solution i was not able to properly figure


Best
Xristoph


___
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] Howto metapost textext set or change basepoint (origin) baseline of text

2020-02-20 Thread Christoph Hintermüller
Hi Hans
On Thu, 2020-02-20 at 10:28 +0100, Hans Hagen wrote:
> On 2/20/2020 10:15 AM, Christoph Hintermüller wrote:
> > 
> You can append a palcement suffix, like:
> 
>textext.dflt
> 
> you can try:
> 
>lft rt bot top ulft urt llft lrt d dflt drt origin raw
> 


Thank you very much, that was what i missed to properly get when
reading manuals.

> (if instead of an eps export you can use svg that can be an
> alternative 
> route)
> 


Yes i know but i want text inside figure to be typeset by context to be
able to use all the cool stuff including math fonts and others offered
by context and its packages. And again i was not able to deduce any
hint that this magically would happen for SVG directly. What i
understood is it will be converted to pdf via cli interface of inkscape
and simply included as pdf image. 

Best 
Xristoph


___
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] metapost: remapping colors of an SVG picture

2020-02-20 Thread Jan U. Hasecke
Am 18.02.20 um 19:24 schrieb Jan U. Hasecke:
> Am 18.02.20 um 19:17 schrieb mf:
>> Il 18/02/20 19:07, Jan U. Hasecke ha scritto:
>>> Am 18.02.20 um 14:53 schrieb Hans Hagen:
>>>
 \setupcolors[rgb=no]
 \startMPcode
  draw lmt_svg [ filename = "sample.svg" ] ;
 \stopMPcode
>>> I get this error.
>>>
>>> ! Not implemented: (unknown numeric)=(string).
>>> 
>>> ]
>>> <*> ... ; p := lmt_svg [ filename = "sample.svg" ]
>>>
>> That's because it's LMTX only (the "lmt" prefix of "lmt_svg" should
>> stand for "luametatex").
> 
> Yes, with lmtx it works but there is no image in the resulting file.

Sorry for digging deeper.

I am very thrilled by the idea that I could simply adjust a RGB SVG to
well defined CMYK colors with this trick.

Can anybody confirm if this works?

juh
___
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] Howto metapost textext set or change basepoint (origin) baseline of text

2020-02-20 Thread Hans Hagen

On 2/20/2020 10:15 AM, Christoph Hintermüller wrote:

Hi
I have the following problem. I convert a eps file using pstoedit into
meta post file. When running this file through mptopdf the resulting
pdf image is as expected. When i include, using the input command,  the
file within a startMPcode endMPcode or startMPpage stopMPpage   after
replacing simple draw ... by draw textext(
You can append a palcement suffix, like:

  textext.dflt

you can try:

  lft rt bot top ulft urt llft lrt d dflt drt origin raw

(if instead of an eps export you can use svg that can be an alternative 
route)


Hans

-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
   tel: 038 477 53 69 | www.pragma-ade.nl | 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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


[NTG-context] Howto metapost textext set or change basepoint (origin) baseline of text

2020-02-20 Thread Christoph Hintermüller
Hi 
I have the following problem. I convert a eps file using pstoedit into
meta post file. When running this file through mptopdf the resulting
pdf image is as expected. When i include, using the input command,  the
file within a startMPcode endMPcode or startMPpage stopMPpage   after
replacing simple draw ... by draw textext(http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] metapost: remapping colors of an SVG picture

2020-02-18 Thread Jan U. Hasecke
Am 18.02.20 um 19:17 schrieb mf:
> Il 18/02/20 19:07, Jan U. Hasecke ha scritto:
>> Am 18.02.20 um 14:53 schrieb Hans Hagen:
>>
>>> \setupcolors[rgb=no]
>>> \startMPcode
>>>  draw lmt_svg [ filename = "sample.svg" ] ;
>>> \stopMPcode
>> I get this error.
>>
>> ! Not implemented: (unknown numeric)=(string).
>> 
>> ]
>> <*> ... ; p := lmt_svg [ filename = "sample.svg" ]
>>
> That's because it's LMTX only (the "lmt" prefix of "lmt_svg" should
> stand for "luametatex").

Yes, with lmtx it works but there is no image in the resulting file.

juh
___
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] metapost: remapping colors of an SVG picture

2020-02-18 Thread mf

Il 18/02/20 19:07, Jan U. Hasecke ha scritto:

Am 18.02.20 um 14:53 schrieb Hans Hagen:


\setupcolors[rgb=no]
\startMPcode
     draw lmt_svg [ filename = "sample.svg" ] ;
\stopMPcode

I get this error.

! Not implemented: (unknown numeric)=(string).

]
<*> ... ; p := lmt_svg [ filename = "sample.svg" ]

That's because it's LMTX only (the "lmt" prefix of "lmt_svg" should 
stand for "luametatex").


You find documentation about that in LMTX docs, luametafun.pdf, chapter 
"SVG".


Best wishes,

Massi

___
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] metapost: remapping colors of an SVG picture

2020-02-18 Thread Jan U. Hasecke
Am 18.02.20 um 14:53 schrieb Hans Hagen:

> 
> \setupcolors[rgb=no]
> \startMPcode
>     draw lmt_svg [ filename = "sample.svg" ] ;
> \stopMPcode

I get this error.

! Not implemented: (unknown numeric)=(string).

]
<*> ... ; p := lmt_svg [ filename = "sample.svg" ]


juh
___
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] metapost: remapping colors of an SVG picture

2020-02-18 Thread Hans Hagen

On 2/18/2020 12:18 PM, mf wrote:

Hello list,
I tried this:

\starttext
\startMPcode
picture p ; p := lmt_svg [ filename = "sample.svg" ] ;
draw p ;
color black_rgb ; black_rgb := ( 0, 0, 0 ) ;
color red_rgb   ; red_rgb   := ( 1, 0, 0 ) ;
remapcolor( black_rgb, red_rgb ) ;
recolor p ;
draw p shifted ( bbwidth(p) + 5mm, 0) ;
\stopMPcode
\stoptext


\setupcolors[rgb=no]
\startMPcode
draw lmt_svg [ filename = "sample.svg" ] ;
\stopMPcode



but recolor gives an error:
metapost log    > >> picture
metapost log    > ! Wrong picture color model: redpart of grey object.
metapost log    >  _f_:=(redpart(EXPR0),
metapost log    > greenpart(EXPR0),bluepart(EXPR0));if.bou...
metapost log    >
metapost log    > repathed->...fi;fi;else:addto._p_.also.i;fi;endfor
metapost log    > ;setbounds._p_.to._b_;_p_
metapost log    > 
metapost log    >    ;
metapost log    > <*> ...apcolor( black_rgb, red_rgb ) ; recolor p ;
metapost log    > draw grayed p shifted ( b...
metapost log    >

My goal is to remap colors of an SVG image, like this:

\starttext
\startMPcode
picture p ; p := lmt_svg [ filename = "sample.svg" ] ;
draw p ;
color black_rgb  ; black_rgb  := ( 0, 0, 0 ) ;
cmykcolor black_cmyk ; black_cmyk := ( 0, 0, 0, 1 ) ;
remapcolor( black_rgb, black_cmyk ) ;
recolor p ;
draw p shifted ( bbwidth(p) + 5mm, 0) ;
\stopMPcode
\stoptext

It relates to a recent thread in the mailing list about color management.
It's an attempt to use inkscape-made SVG graphics inside a CMYK 
workflow, without using color management.


Naturally it would work under some constraints, but there's a lot of 
graphics you can do with Inkscape that falls inside these:
- the number of colors in the input SVG should be limited, so that every 
color gets converted

- no embedded bitmaps, only vector graphics
- perhaps some other constraints on gradients, transparency, etc.

A good alternative would be a remapper based on a custom lua function 
like this:


function rgb2cmyk( r, g, b )
   ...
   return c, m, y, k
end

Massi

___
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___




--

-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
   tel: 038 477 53 69 | www.pragma-ade.nl | 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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


[NTG-context] metapost: remapping colors of an SVG picture

2020-02-18 Thread mf

Hello list,
I tried this:

\starttext
\startMPcode
picture p ; p := lmt_svg [ filename = "sample.svg" ] ;
draw p ;
color black_rgb ; black_rgb := ( 0, 0, 0 ) ;
color red_rgb   ; red_rgb   := ( 1, 0, 0 ) ;
remapcolor( black_rgb, red_rgb ) ;
recolor p ;
draw p shifted ( bbwidth(p) + 5mm, 0) ;
\stopMPcode
\stoptext

but recolor gives an error:
metapost log> >> picture
metapost log> ! Wrong picture color model: redpart of grey object.
metapost log>  _f_:=(redpart(EXPR0),
metapost log> 
greenpart(EXPR0),bluepart(EXPR0));if.bou...

metapost log>
metapost log> repathed->...fi;fi;else:addto._p_.also.i;fi;endfor
metapost log    > 
;setbounds._p_.to._b_;_p_

metapost log> 
metapost log>;
metapost log> <*> ...apcolor( black_rgb, red_rgb ) ; recolor p ;
metapost log> 
draw grayed p shifted ( b...

metapost log>

My goal is to remap colors of an SVG image, like this:

\starttext
\startMPcode
picture p ; p := lmt_svg [ filename = "sample.svg" ] ;
draw p ;
color black_rgb  ; black_rgb  := ( 0, 0, 0 ) ;
cmykcolor black_cmyk ; black_cmyk := ( 0, 0, 0, 1 ) ;
remapcolor( black_rgb, black_cmyk ) ;
recolor p ;
draw p shifted ( bbwidth(p) + 5mm, 0) ;
\stopMPcode
\stoptext

It relates to a recent thread in the mailing list about color management.
It's an attempt to use inkscape-made SVG graphics inside a CMYK 
workflow, without using color management.


Naturally it would work under some constraints, but there's a lot of 
graphics you can do with Inkscape that falls inside these:
- the number of colors in the input SVG should be limited, so that every 
color gets converted

- no embedded bitmaps, only vector graphics
- perhaps some other constraints on gradients, transparency, etc.

A good alternative would be a remapper based on a custom lua function 
like this:


function rgb2cmyk( r, g, b )
  ...
  return c, m, y, k
end

Massi
___
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] Metapost and TikZ color code equivalent

2020-02-15 Thread Hans Hagen

On 2/15/2020 12:25 PM, Fabrice Couvreur wrote:

Hi Henri,
Why does the blue path not rotate 90 with the draw command but rotate 
with the fill command?


compare

draw  origin -- (0,0.2cm) -- (4cm,0.2cm) -- (4cm,0) -- 
(4.1cm,-0.05cm) -- (0.1cm,-0.05cm) -- cycle  rotated alpha withcolor red;
draw (origin -- (0,0.2cm) -- (4cm,0.2cm) -- (4cm,0) -- 
(4.1cm,-0.05cm) -- (0.1cm,-0.05cm) -- cycle) rotated alpha withcolor blue;





\startMPcode

   def match (expr alpha, pos) =
     fill unitsquare xscaled 4cm  yscaled 0.2cm rotated alpha shifted pos
     withcolor yellow ;
     fill origin -- (4cm,0) -- (4.1cm,-0.05cm) --  (0.1cm,-0.05cm) --
     cycle rotated alpha withcolor(.6yellow + black);
     draw origin -- (0,0.2cm) -- (4cm,0.2cm) -- (4cm,0) -- (4.1cm,-0.05cm)
     -- (0.1cm,-0.05cm) -- cycle rotated alpha withcolor blue;
      draw origin -- (0,0.2cm) -- (4cm,0.2cm) -- (4cm,0) -- (4.1cm,-0.05cm)
     -- (0.1cm,-0.05cm) -- cycle rotated alpha withcolor blue;
     draw fullcircle xscaled 0.50cm yscaled 0.44cm shifted (4.125cm,0.1cm)
     rotated alpha;
     draw fullcircle xscaled 0.50cm yscaled 0.44cm shifted (4.125cm,0.1cm)
     rotated alpha
     withshademethod "circular 1"
     withshadevector (0,1)
     withshadecolors (red,white);
     enddef;
   match(0,(0,0));
   match(90,(4.2cm,0));
   match(90,(0,0));
   match(0,(0,4.2cm));

\stopMPcode-

  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
   tel: 038 477 53 69 | www.pragma-ade.nl | 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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] Metapost and TikZ color code equivalent

2020-02-15 Thread Floris van Manen


On 15-02-2020 12:25, Fabrice Couvreur wrote:
> Hi Henri,
> Why does the blue path not rotate 90 with the draw command but rotate
> with the fill command?
> 

Why not draw the match as a picture first, then rotate and shift that
picture?
Also, if you use a local scale unit, it will be easier to stach the
matches together by merely applying a factor in match units.

.F


pEpkey.asc
Description: application/pgp-keys
___
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] Metapost and TikZ color code equivalent

2020-02-15 Thread Fabrice Couvreur
Hi Henri,
Why does the blue path not rotate 90 with the draw command but rotate with
the fill command ?

\startMPcode

  def match (expr alpha, pos) =
fill unitsquare xscaled 4cm  yscaled 0.2cm rotated alpha shifted pos
withcolor yellow ;
fill origin -- (4cm,0) -- (4.1cm,-0.05cm) --  (0.1cm,-0.05cm) --
cycle rotated alpha withcolor(.6yellow + black);
draw origin -- (0,0.2cm) -- (4cm,0.2cm) -- (4cm,0) -- (4.1cm,-0.05cm)
-- (0.1cm,-0.05cm) -- cycle rotated alpha withcolor blue;
 draw origin -- (0,0.2cm) -- (4cm,0.2cm) -- (4cm,0) -- (4.1cm,-0.05cm)
-- (0.1cm,-0.05cm) -- cycle rotated alpha withcolor blue;
draw fullcircle xscaled 0.50cm yscaled 0.44cm shifted (4.125cm,0.1cm)
rotated alpha;
draw fullcircle xscaled 0.50cm yscaled 0.44cm shifted (4.125cm,0.1cm)
rotated alpha
withshademethod "circular 1"
withshadevector (0,1)
withshadecolors (red,white);
enddef;
  match(0,(0,0));
  match(90,(4.2cm,0));
  match(90,(0,0));
  match(0,(0,4.2cm));

\stopMPcode


Le sam. 15 févr. 2020 à 00:01, Fabrice Couvreur 
a écrit :

> Hi,
> Hi,
> I have corrected for the dimensions of the ellipse but I cannot achieve
> the same effect for the red color.
> Thank you.
> Fabrice
> \startMPcode
>   def match (expr pos) =
> fill unitsquare xscaled 4cm  yscaled 0.2cm shifted pos withcolor
> yellow;
> fill origin -- (4cm,0) -- (4.1cm,-0.05cm) --  (0.1cm,-0.05cm) -- cycle
>  withcolor(.6yellow + black);
> draw origin -- (0,0.2cm) -- (4cm,0.2cm) -- (4cm,0) -- (4.1cm,-0.05cm)
> -- (0.1cm,-0.05cm) -- cycle;
> fill fullcircle xscaled 0.50cm yscaled 0.44cm shifted (4.125cm,0.1cm)
> withcolor red;
> draw fullcircle xscaled 0.50cm yscaled 0.44cm shifted (4.125cm,0.1cm);
> draw fullcircle xscaled 0.50cm yscaled 0.44cm shifted (4.125cm,0.1cm)
>  withshademethod "circular"
>  withshadevector (0,1)
>  withshadecolors (red,white)
>   enddef;
>   match((0,0));
>
> \stopMPcode
>
>
>
> Le ven. 14 févr. 2020 à 16:43, Fabrice L  a
> écrit :
>
>> Hi,
>>
>> Le 13 févr. 2020 à 16:45, Fabrice Couvreur 
>> a écrit :
>>
>>
>> How to have the color defined by {yellow!60!black} with Metapost ?
>>
>>
>> color MyColor ; MyColor := .6[yellow,black] ;
>>
>> See metafun manual, section 1.13.
>>
>> Thank you.
>> Fabrice
>>
>>
>> Fabrice (another one !).
>>
>>
>> ___
>> 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://context.aanhet.net
>> archive  : https://bitbucket.org/phg/context-mirror/commits/
>> wiki : http://contextgarden.net
>>
>> ___
>>
>>
>>
>> ___
>> 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://context.aanhet.net
>> archive  : https://bitbucket.org/phg/context-mirror/commits/
>> wiki : http://contextgarden.net
>>
>> ___
>>
>
___
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] Metapost and TikZ color code equivalent

2020-02-14 Thread Fabrice Couvreur
Hi,
Hi,
I have corrected for the dimensions of the ellipse but I cannot achieve the
same effect for the red color.
Thank you.
Fabrice
\startMPcode
  def match (expr pos) =
fill unitsquare xscaled 4cm  yscaled 0.2cm shifted pos withcolor yellow;
fill origin -- (4cm,0) -- (4.1cm,-0.05cm) --  (0.1cm,-0.05cm) -- cycle
 withcolor(.6yellow + black);
draw origin -- (0,0.2cm) -- (4cm,0.2cm) -- (4cm,0) -- (4.1cm,-0.05cm)
-- (0.1cm,-0.05cm) -- cycle;
fill fullcircle xscaled 0.50cm yscaled 0.44cm shifted (4.125cm,0.1cm)
withcolor red;
draw fullcircle xscaled 0.50cm yscaled 0.44cm shifted (4.125cm,0.1cm);
draw fullcircle xscaled 0.50cm yscaled 0.44cm shifted (4.125cm,0.1cm)
 withshademethod "circular"
 withshadevector (0,1)
 withshadecolors (red,white)
  enddef;
  match((0,0));

\stopMPcode



Le ven. 14 févr. 2020 à 16:43, Fabrice L  a écrit :

> Hi,
>
> Le 13 févr. 2020 à 16:45, Fabrice Couvreur 
> a écrit :
>
>
> How to have the color defined by {yellow!60!black} with Metapost ?
>
>
> color MyColor ; MyColor := .6[yellow,black] ;
>
> See metafun manual, section 1.13.
>
> Thank you.
> Fabrice
>
>
> Fabrice (another one !).
>
>
> ___
> 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://context.aanhet.net
> archive  : https://bitbucket.org/phg/context-mirror/commits/
> wiki : http://contextgarden.net
>
> ___
>
>
>
> ___
> 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://context.aanhet.net
> archive  : https://bitbucket.org/phg/context-mirror/commits/
> wiki : http://contextgarden.net
>
> ___
>
___
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] Metapost and TikZ color code equivalent

2020-02-14 Thread Fabrice L
Hi,

> Le 13 févr. 2020 à 16:45, Fabrice Couvreur  a 
> écrit :

> How to have the color defined by {yellow!60!black} with Metapost ?

color MyColor ; MyColor := .6[yellow,black] ;

See metafun manual, section 1.13.

> Thank you.
> Fabrice

Fabrice (another one !).
> ___
> 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://context.aanhet.net
> archive  : https://bitbucket.org/phg/context-mirror/commits/
> wiki : http://contextgarden.net
> ___

___
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] Metapost and TikZ color code equivalent

2020-02-14 Thread Fabrice Couvreur
i Henri,
Thank you for your answer. The idea is to make the graph as an attachment. I
converted to Metapost but the road is still long!
The code is from percusse on StackExchange. As you can see, there is a
problem with the ellipse. How do I fix this ?
Thank you
Fabrice

\usemodule[tikz]
\starttext
\startMPcode
  def match (expr pos) =
fill unitsquare xscaled 4cm  yscaled 0.2cm shifted pos withcolor yellow;
fill origin -- (4cm,0) -- (4.1cm,-0.05cm) --  (0.1cm,-0.05cm) -- cycle
 withcolor(.6yellow + black);
draw origin -- (0,0.2cm) -- (4cm,0.2cm) -- (4cm,0) -- (4.1cm,-0.05cm)
-- (0.1cm,-0.05cm) -- cycle;
fill fullcircle xscaled 0.25cm yscaled 0.22cm shifted (4.125cm,0.1cm)
withcolor red;
draw fullcircle xscaled 0.25cm yscaled 0.22cm shifted (4.125cm,0.1cm)
 withshademethod "circular"
 withshadevector (0,1)
 withshadecolors (red,white)
  enddef;
  match((0,0));

\stopMPcode

\starttikzpicture
\define[2]\allumette{
\fill [yellow] (#1,#2) rectangle (#1+4,#2+0.2);
\fill [yellow!60!black] (#1,#2) -- ++(4,0)-- ++(0.1,-0.05) -- ++(-4,0)
-- ++(-0.1,0.05);
\draw (#1,#2) -- ++(0,0.2) -- ++(4,0) -- ++(0,-0.2) -- ++(0.1,-0.05) --
++(-4,0) -- ++(-0.1,0.05);
\shade[ball color=red] (#1+4,#2+0.1) ellipse (0.25cm and 0.22cm);
\draw (#1+4,#2+0.1) ellipse (0.25cm and 0.22cm);
}
\allumette{0.1}{0.2}
\filldraw[orange,scale=0.5,shift={(8.2,1.2)}]  (0,0) .. controls
(-1.5,1.25) and (.5,2) .. (-.2,4) .. controls (1,2.5) and (1,.5) .. (0,0);
\stoptikzpicture
\stoptext

Le ven. 14 févr. 2020 à 02:49, Henri Menke  a écrit :

> On 2/14/20 10:45 AM, Fabrice Couvreur wrote:
> > Hi,
> > How to have the color defined by {yellow!60!black} with Metapost ?
>
> \usemodule[tikz]
> \starttext
> \startMPcode
> fill fullsquare scaled 1cm withcolor (.6yellow + black) ;
> \stopMPcode
>
> \starttikzpicture
> \fill[yellow!60!black] (0,0) rectangle (1,1);
> \stoptikzpicture
> \stoptext
>
>
> > Thank you.
> > Fabrice
> >
> >
> >
> ___
> > 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://context.aanhet.net
> > archive  : https://bitbucket.org/phg/context-mirror/commits/
> > wiki : http://contextgarden.net
> >
> ___
> >
>
> ___
> 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://context.aanhet.net
> archive  : https://bitbucket.org/phg/context-mirror/commits/
> wiki : http://contextgarden.net
>
> ___
>
___
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] Metapost and TikZ color code equivalent

2020-02-13 Thread Henri Menke
On 2/14/20 10:45 AM, Fabrice Couvreur wrote:
> Hi,
> How to have the color defined by {yellow!60!black} with Metapost ?

\usemodule[tikz]
\starttext
\startMPcode
fill fullsquare scaled 1cm withcolor (.6yellow + black) ;
\stopMPcode

\starttikzpicture
\fill[yellow!60!black] (0,0) rectangle (1,1);
\stoptikzpicture
\stoptext


> Thank you.
> Fabrice
> 
> 
> ___
> 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://context.aanhet.net
> archive  : https://bitbucket.org/phg/context-mirror/commits/
> wiki : http://contextgarden.net
> ___
> 
___
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


[NTG-context] Metapost and TikZ color code equivalent

2020-02-13 Thread Fabrice Couvreur
Hi,
How to have the color defined by {yellow!60!black} with Metapost ?
Thank you.
Fabrice
___
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] macro that does not work (Metapost)

2020-02-11 Thread Fabrice Couvreur
Hi Mikael,
Thanks.
Fabrice

Le mar. 11 févr. 2020 à 14:01, Mikael P. Sundqvist  a
écrit :

> On Tue, Feb 11, 2020 at 1:22 PM Fabrice Couvreur <
> fabrice1.couvr...@gmail.com> wrote:
>
>> Hi Hans,
>> I tried this but without success :
>>
>>  \startMPcode
>>  suite{1,0};
>>  suite{2,1};
>>  \stopMPcode
>>
>> Fabrice
>>
>> Le mar. 11 févr. 2020 à 13:08, Hans Hagen  a écrit :
>>
>>> On 2/11/2020 11:50 AM, Fabrice Couvreur wrote:
>>> > Hi,
>>> > I have some problems with the following macro :
>>> >
>>> > tex error   > mp error on line 23 in file /home/viserion/macro.tex:
>>> >
>>> > ! Missing argument to suite.
>>> > 
>>> > {
>>> > <*> suite{
>>> > 1,0}; suite(2,1); ;
>>> > That macro has more parameters than you thought.
>>> > I'll continue by pretending that each missing argument
>>> > is either zero or null.
>>> >
>>> > ! Missing argument to suite.
>>> > 
>>> > {
>>> > <*> suite{
>>> > 1,0}; suite(2,1); ;
>>> > That macro has more parameters than you thought.
>>> > I'll continue by pretending that each missing argument
>>> > is either zero or null.
>>>
>>>
>>> {} instead of ()
>>>
>>> > ! Extra tokens will be flushed.
>>> > 
>>> > {
>>> > <*> suite{
>>> > 1,0}; suite(2,1); ;
>>> > I've just read as much of that statement as I could fathom,
>>> > so a semicolon should have been next. It's very puzzling...
>>> > but I'll try to get myself back together, by ignoring
>>> > everything up to the next `;'. Please insert a semicolon
>>> > now in front of anything that you don't want me to delete.
>>> > (See Chapter 27 of The METAFONTbook for an example.)
>>> >
>>> > [1]
>>> >
>>> > 13   enddef;
>>> > 14 \stopMPcode
>>> > 15 \starttext
>>> > 16  On présente ci-dessous deux suites de dessins.
>>> > 17   \startlinecorrection[blank]
>>> > 18 \startmidaligned
>>> > 19   \startcombination[2*1]
>>> > 20 {\startMPcode
>>> > 21   suite{1,0};
>>> > 22   suite(2,1);
>>> > 23 >>   \stopMPcode}{\tfxx \bf Suite 2}
>>> > 24   \stopcombination
>>> > 25 \stopmidaligned
>>> > 26   \stoplinecorrection
>>> > 27 \stoptext
>>> >
>>> > mtx-context | fatal error: return code: 256
>>> >
>>> > TeX Output exited abnormally with code 1 at Tue Feb 11 11:45:53
>>> >
>>> > ##
>>> > macro.tex
>>> > ##
>>> >
>>> > \startMPcode
>>> >def suite (expr n, t) =
>>> >begingroup
>>> > numeric u;
>>> > u := 5mm;
>>> > pickup pencircle scaled 4pt;
>>> > for i=0 upto n:
>>> >   for j=0 upto n:
>>> >   drawdot (i*u,j*u) shifted(t*u,0) withcolor darkred;
>>> >   endfor
>>> > endfor
>>> >endgroup
>>> >enddef;
>>> > \stopMPcode
>>> > \starttext
>>> >   On présente ci-dessous deux suites de dessins.
>>> >\startlinecorrection[blank]
>>> >  \startmidaligned
>>> >\startcombination[2*1]
>>> >  {\startMPcode
>>> >suite{1,0};
>>> >suite(2,1);
>>> >   \stopMPcode}{\tfxx \bf Suite 2}
>>> >\stopcombination
>>> >  \stopmidaligned
>>> >\stoplinecorrection
>>> > \stoptext
>>> >
>>> >
>>> > Thank you.
>>> > Fabrice
>>> >
>>> >
>>> ___
>>> > 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://context.aanhet.net
>>> > archive  : https://bitbucket.org/phg/context-mirror/commits/
>>> > wiki : http://contextgarden.net
>>> >
>>> ___
>>> >
>>>
>>>
>>> --
>>>
>>> -
>>>Hans Hagen | PRAGMA ADE
>>>Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
>>> tel: 038 477 53 69 | www.pragma-ade.nl | 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://context.aanhet.net
>>> archive  : https://bitbucket.org/phg/context-mirror/commits/
>>> wiki : http://contextgarden.net
>>>
>>> ___
>>>
>>
>> ___
>> If your question is of interest to others as well, please add an entry to
>> the Wiki!
>>
>> maillist : 

Re: [NTG-context] macro that does not work (Metapost)

2020-02-11 Thread Mikael P. Sundqvist
On Tue, Feb 11, 2020 at 1:22 PM Fabrice Couvreur <
fabrice1.couvr...@gmail.com> wrote:

> Hi Hans,
> I tried this but without success :
>
>  \startMPcode
>  suite{1,0};
>  suite{2,1};
>  \stopMPcode
>
> Fabrice
>
> Le mar. 11 févr. 2020 à 13:08, Hans Hagen  a écrit :
>
>> On 2/11/2020 11:50 AM, Fabrice Couvreur wrote:
>> > Hi,
>> > I have some problems with the following macro :
>> >
>> > tex error   > mp error on line 23 in file /home/viserion/macro.tex:
>> >
>> > ! Missing argument to suite.
>> > 
>> > {
>> > <*> suite{
>> > 1,0}; suite(2,1); ;
>> > That macro has more parameters than you thought.
>> > I'll continue by pretending that each missing argument
>> > is either zero or null.
>> >
>> > ! Missing argument to suite.
>> > 
>> > {
>> > <*> suite{
>> > 1,0}; suite(2,1); ;
>> > That macro has more parameters than you thought.
>> > I'll continue by pretending that each missing argument
>> > is either zero or null.
>>
>>
>> {} instead of ()
>>
>> > ! Extra tokens will be flushed.
>> > 
>> > {
>> > <*> suite{
>> > 1,0}; suite(2,1); ;
>> > I've just read as much of that statement as I could fathom,
>> > so a semicolon should have been next. It's very puzzling...
>> > but I'll try to get myself back together, by ignoring
>> > everything up to the next `;'. Please insert a semicolon
>> > now in front of anything that you don't want me to delete.
>> > (See Chapter 27 of The METAFONTbook for an example.)
>> >
>> > [1]
>> >
>> > 13   enddef;
>> > 14 \stopMPcode
>> > 15 \starttext
>> > 16  On présente ci-dessous deux suites de dessins.
>> > 17   \startlinecorrection[blank]
>> > 18 \startmidaligned
>> > 19   \startcombination[2*1]
>> > 20 {\startMPcode
>> > 21   suite{1,0};
>> > 22   suite(2,1);
>> > 23 >>   \stopMPcode}{\tfxx \bf Suite 2}
>> > 24   \stopcombination
>> > 25 \stopmidaligned
>> > 26   \stoplinecorrection
>> > 27 \stoptext
>> >
>> > mtx-context | fatal error: return code: 256
>> >
>> > TeX Output exited abnormally with code 1 at Tue Feb 11 11:45:53
>> >
>> > ##
>> > macro.tex
>> > ##
>> >
>> > \startMPcode
>> >def suite (expr n, t) =
>> >begingroup
>> > numeric u;
>> > u := 5mm;
>> > pickup pencircle scaled 4pt;
>> > for i=0 upto n:
>> >   for j=0 upto n:
>> >   drawdot (i*u,j*u) shifted(t*u,0) withcolor darkred;
>> >   endfor
>> > endfor
>> >endgroup
>> >enddef;
>> > \stopMPcode
>> > \starttext
>> >   On présente ci-dessous deux suites de dessins.
>> >\startlinecorrection[blank]
>> >  \startmidaligned
>> >\startcombination[2*1]
>> >  {\startMPcode
>> >suite{1,0};
>> >suite(2,1);
>> >   \stopMPcode}{\tfxx \bf Suite 2}
>> >\stopcombination
>> >  \stopmidaligned
>> >\stoplinecorrection
>> > \stoptext
>> >
>> >
>> > Thank you.
>> > Fabrice
>> >
>> >
>> ___
>> > 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://context.aanhet.net
>> > archive  : https://bitbucket.org/phg/context-mirror/commits/
>> > wiki : http://contextgarden.net
>> >
>> ___
>> >
>>
>>
>> --
>>
>> -
>>Hans Hagen | PRAGMA ADE
>>Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
>> tel: 038 477 53 69 | www.pragma-ade.nl | 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://context.aanhet.net
>> archive  : https://bitbucket.org/phg/context-mirror/commits/
>> wiki : http://contextgarden.net
>>
>> ___
>>
>
> ___
> 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://context.aanhet.net
> archive  : https://bitbucket.org/phg/context-mirror/commits/
> wiki : http://contextgarden.net
>
> 

Re: [NTG-context] macro that does not work (Metapost)

2020-02-11 Thread Fabrice Couvreur
Hi Hans,
I tried this but without success :

 \startMPcode
 suite{1,0};
 suite{2,1};
 \stopMPcode

Fabrice

Le mar. 11 févr. 2020 à 13:08, Hans Hagen  a écrit :

> On 2/11/2020 11:50 AM, Fabrice Couvreur wrote:
> > Hi,
> > I have some problems with the following macro :
> >
> > tex error   > mp error on line 23 in file /home/viserion/macro.tex:
> >
> > ! Missing argument to suite.
> > 
> > {
> > <*> suite{
> > 1,0}; suite(2,1); ;
> > That macro has more parameters than you thought.
> > I'll continue by pretending that each missing argument
> > is either zero or null.
> >
> > ! Missing argument to suite.
> > 
> > {
> > <*> suite{
> > 1,0}; suite(2,1); ;
> > That macro has more parameters than you thought.
> > I'll continue by pretending that each missing argument
> > is either zero or null.
>
>
> {} instead of ()
>
> > ! Extra tokens will be flushed.
> > 
> > {
> > <*> suite{
> > 1,0}; suite(2,1); ;
> > I've just read as much of that statement as I could fathom,
> > so a semicolon should have been next. It's very puzzling...
> > but I'll try to get myself back together, by ignoring
> > everything up to the next `;'. Please insert a semicolon
> > now in front of anything that you don't want me to delete.
> > (See Chapter 27 of The METAFONTbook for an example.)
> >
> > [1]
> >
> > 13   enddef;
> > 14 \stopMPcode
> > 15 \starttext
> > 16  On présente ci-dessous deux suites de dessins.
> > 17   \startlinecorrection[blank]
> > 18 \startmidaligned
> > 19   \startcombination[2*1]
> > 20 {\startMPcode
> > 21   suite{1,0};
> > 22   suite(2,1);
> > 23 >>   \stopMPcode}{\tfxx \bf Suite 2}
> > 24   \stopcombination
> > 25 \stopmidaligned
> > 26   \stoplinecorrection
> > 27 \stoptext
> >
> > mtx-context | fatal error: return code: 256
> >
> > TeX Output exited abnormally with code 1 at Tue Feb 11 11:45:53
> >
> > ##
> > macro.tex
> > ##
> >
> > \startMPcode
> >def suite (expr n, t) =
> >begingroup
> > numeric u;
> > u := 5mm;
> > pickup pencircle scaled 4pt;
> > for i=0 upto n:
> >   for j=0 upto n:
> >   drawdot (i*u,j*u) shifted(t*u,0) withcolor darkred;
> >   endfor
> > endfor
> >endgroup
> >enddef;
> > \stopMPcode
> > \starttext
> >   On présente ci-dessous deux suites de dessins.
> >\startlinecorrection[blank]
> >  \startmidaligned
> >\startcombination[2*1]
> >  {\startMPcode
> >suite{1,0};
> >suite(2,1);
> >   \stopMPcode}{\tfxx \bf Suite 2}
> >\stopcombination
> >  \stopmidaligned
> >\stoplinecorrection
> > \stoptext
> >
> >
> > Thank you.
> > Fabrice
> >
> >
> ___
> > 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://context.aanhet.net
> > archive  : https://bitbucket.org/phg/context-mirror/commits/
> > wiki : http://contextgarden.net
> >
> ___
> >
>
>
> --
>
> -
>Hans Hagen | PRAGMA ADE
>Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
> tel: 038 477 53 69 | www.pragma-ade.nl | 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://context.aanhet.net
> archive  : https://bitbucket.org/phg/context-mirror/commits/
> wiki : http://contextgarden.net
>
> ___
>
___
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] macro that does not work (Metapost)

2020-02-11 Thread Hans Hagen

On 2/11/2020 11:50 AM, Fabrice Couvreur wrote:

Hi,
I have some problems with the following macro :

tex error       > mp error on line 23 in file /home/viserion/macro.tex:

! Missing argument to suite.

{
<*> suite{
1,0}; suite(2,1); ;
That macro has more parameters than you thought.
I'll continue by pretending that each missing argument
is either zero or null.

! Missing argument to suite.

{
<*> suite{
1,0}; suite(2,1); ;
That macro has more parameters than you thought.
I'll continue by pretending that each missing argument
is either zero or null.



{} instead of ()


! Extra tokens will be flushed.

{
<*> suite{
1,0}; suite(2,1); ;
I've just read as much of that statement as I could fathom,
so a semicolon should have been next. It's very puzzling...
but I'll try to get myself back together, by ignoring
everything up to the next `;'. Please insert a semicolon
now in front of anything that you don't want me to delete.
(See Chapter 27 of The METAFONTbook for an example.)

[1]

13       enddef;
14     \stopMPcode
15     \starttext
16      On présente ci-dessous deux suites de dessins.
17           \startlinecorrection[blank]
18             \startmidaligned
19               \startcombination[2*1]
20                 {\startMPcode
21                   suite{1,0};
22                   suite(2,1);
23 >>               \stopMPcode}{\tfxx \bf Suite 2}
24           \stopcombination
25             \stopmidaligned
26           \stoplinecorrection
27     \stoptext

mtx-context     | fatal error: return code: 256

TeX Output exited abnormally with code 1 at Tue Feb 11 11:45:53

##
macro.tex
##

\startMPcode
   def suite (expr n, t) =
   begingroup
    numeric u;
    u := 5mm;
    pickup pencircle scaled 4pt;
    for i=0 upto n:
      for j=0 upto n:
          drawdot (i*u,j*u) shifted(t*u,0) withcolor darkred;
      endfor
    endfor
   endgroup
   enddef;
\stopMPcode
\starttext
  On présente ci-dessous deux suites de dessins.
       \startlinecorrection[blank]
         \startmidaligned
           \startcombination[2*1]
             {\startMPcode
               suite{1,0};
               suite(2,1);
              \stopMPcode}{\tfxx \bf Suite 2}
       \stopcombination
         \stopmidaligned
       \stoplinecorrection
\stoptext


Thank you.
Fabrice

___
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___




--

-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
   tel: 038 477 53 69 | www.pragma-ade.nl | 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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


[NTG-context] macro that does not work (Metapost)

2020-02-11 Thread Fabrice Couvreur
Hi,
I have some problems with the following macro :

tex error   > mp error on line 23 in file /home/viserion/macro.tex:

! Missing argument to suite.

{
<*> suite{
1,0}; suite(2,1); ;
That macro has more parameters than you thought.
I'll continue by pretending that each missing argument
is either zero or null.

! Missing argument to suite.

{
<*> suite{
1,0}; suite(2,1); ;
That macro has more parameters than you thought.
I'll continue by pretending that each missing argument
is either zero or null.

! Extra tokens will be flushed.

{
<*> suite{
1,0}; suite(2,1); ;
I've just read as much of that statement as I could fathom,
so a semicolon should have been next. It's very puzzling...
but I'll try to get myself back together, by ignoring
everything up to the next `;'. Please insert a semicolon
now in front of anything that you don't want me to delete.
(See Chapter 27 of The METAFONTbook for an example.)

[1]

13   enddef;
14 \stopMPcode
15 \starttext
16  On présente ci-dessous deux suites de dessins.
17   \startlinecorrection[blank]
18 \startmidaligned
19   \startcombination[2*1]
20 {\startMPcode
21   suite{1,0};
22   suite(2,1);
23 >>   \stopMPcode}{\tfxx \bf Suite 2}
24   \stopcombination
25 \stopmidaligned
26   \stoplinecorrection
27 \stoptext

mtx-context | fatal error: return code: 256

TeX Output exited abnormally with code 1 at Tue Feb 11 11:45:53

##
macro.tex
##

\startMPcode
  def suite (expr n, t) =
  begingroup
   numeric u;
   u := 5mm;
   pickup pencircle scaled 4pt;
   for i=0 upto n:
 for j=0 upto n:
 drawdot (i*u,j*u) shifted(t*u,0) withcolor darkred;
 endfor
   endfor
  endgroup
  enddef;
\stopMPcode
\starttext
 On présente ci-dessous deux suites de dessins.
  \startlinecorrection[blank]
\startmidaligned
  \startcombination[2*1]
{\startMPcode
  suite{1,0};
  suite(2,1);
 \stopMPcode}{\tfxx \bf Suite 2}
  \stopcombination
\stopmidaligned
  \stoplinecorrection
\stoptext


Thank you.
Fabrice
___
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


[NTG-context] New to metapost, could use some help with first steps

2020-02-02 Thread Gerben Wierda
Hans was so kind to help me with a setup for some generated output. I am trying 
to understand every line of his example so I can expand on his exmaple to make 
it fully functional. In his example there is:

context('draw 
textext("\\framed[frame=off,offset=5bp,align={middle,lohi,verytolerant,broad},width=%sbp]{%s}")
 shifted center AllNodes[%i] ;',w,name,i)

as command to draw a node and the node type is defined like this:
context("save ApplicationComponent ; path ApplicationComponent ; 
ApplicationComponent := unitsquare ; ") 

For a quick example this works, but ‘unitsquare’ is a simple thing. How do I 
create a more complex shape that is reusable? What if I would like the path to 
be like this:



With this as the complex behaviour of the shape
The font size scaled so the label fits inside the image (choice yes/no)
The small boxes sized according to the font size or sized according to the box 
size (choice text/box)
The bounding box following the actual complex outline
The upper of the two small boxes in line with the upper text line (in case the 
size is coupled to the text size)
The colour of the background a default colour or given as parameter

This is one of the more complex shapes, if I can do this one it might give me 
enough information to define all the other ones. Sorry to bother all of you but 
the learning curve is steep and I always have not enough time.

Gerben Wierda
Chess and the Art of Enterprise Architecture 
Mastering ArchiMate 
Architecture for Real Enterprises 
 at InfoWorld
On Slippery Ice  at EAPJ

___
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] A question about whatever (Metapost)

2020-01-26 Thread Alan Braslau
What error are you getting?
(perhaps you need "save carre,p,a,b,c,d,N,P,M ;")

A perpendicular line is also the line "rotated 90" (about the intersection 
point).

Alan 

On Sun, 26 Jan 2020 00:09:38 +0100
Fabrice Couvreur  wrote:

> Hi,
> The point M is such that the line (CM) is perpendicular to the line (NP).
> I do not understand the error of this code.
> Thank you
> Fabrice
> 
> \usecolors[xwi]
> \starttext
> \startMPcode
>   path carre, p;
>   carre = unitsquare scaled 138;
> 
>   pair a, b, c, d, N, P, M;
>   a = point 0 of carre;
>   b = point 1 of carre;
>   c = point 2 of carre;
>   d = point 3 of carre;
> 
>   p = b -- d;
>   N = whatever[a,d];
>   P = whatever[a,b];
>   M = whatever[b,d];
>  (M - c) dotprod (P - N) = 0;
> 
>   draw M -- c;
> 
>   draw p  withcolor \MPcolor{navy};
>   draw carre withcolor \MPcolor{firebrick};
> 
>   label.lft("$A$", point 0 of carre);
>   label.lrt("$B$", point 1 of carre);
>   label.urt("$C$", point 2 of carre);
>   label.ulft("$D$", point 3 of carre);
> \stopMPcode
> \stoptext

___
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


[NTG-context] A question about whatever (Metapost)

2020-01-25 Thread Fabrice Couvreur
Hi,
The point M is such that the line (CM) is perpendicular to the line (NP).
I do not understand the error of this code.
Thank you
Fabrice

\usecolors[xwi]
\starttext
\startMPcode
  path carre, p;
  carre = unitsquare scaled 138;

  pair a, b, c, d, N, P, M;
  a = point 0 of carre;
  b = point 1 of carre;
  c = point 2 of carre;
  d = point 3 of carre;

  p = b -- d;
  N = whatever[a,d];
  P = whatever[a,b];
  M = whatever[b,d];
 (M - c) dotprod (P - N) = 0;

  draw M -- c;

  draw p  withcolor \MPcolor{navy};
  draw carre withcolor \MPcolor{firebrick};

  label.lft("$A$", point 0 of carre);
  label.lrt("$B$", point 1 of carre);
  label.urt("$C$", point 2 of carre);
  label.ulft("$D$", point 3 of carre);
\stopMPcode
\stoptext
___
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] Transparency (Metapost)

2019-12-01 Thread Wolfgang Schuster

Fabrice Couvreur schrieb am 01.12.2019 um 21:56:

Hi Hans,
I updated lmtx, but your code does not compile except that the output 
is a pdf file where it is written ERROR.


Can you clear the cache.

Wolfgang

___
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] Transparency (Metapost)

2019-12-01 Thread Hans Hagen

On 12/1/2019 11:32 AM, Fabrice Couvreur wrote:

Hello
Thank you for your suggestion. However, it works with context and not 
with lmtx.

Fabrice

\starttext
\startMPcode
    defaultfont := "texgyrepagella-regular*default" ;
    defaultscale :=0.8;

    color brown;
    brown = (0.128,0.00,0.00);

    path twos, threes, sixes;
    twos = fullcircle xscaled 4cm yscaled 2cm rotated 180
           shifted 42 left;
    threes = fullcircle xscaled 4cm yscaled 2cm shifted 42 right;
    sixes = buildcycle(twos, threes);

    fill twos   withcolor brown withtransparency(1,0.75);
    fill threes withcolor yellow withtransparency(1,0.75);
    fill sixes withcolor yellow + brown withtransparency(1,0.75);

    draw twos;
    draw threes;

    label("...",(1.5cm,0));
    label("...",(0,0));
    label("...",(-1.5cm,0));
    label.top("yeux marron",(-1.5cm,1.25cm));
    label.top("cheveux blonds",(1.5cm,1.25cm));
\stopMPcode
\stoptext

tex error       > tex error on line 1 in file ./blond.tex: ?
Looks ok here ... but isn't the transparacy used instead of the sizes? 
Anyway, you can use named colors


\starttext

\startMPcode
   defaultfont  := "texgyrepagella-regular*default" ;
   defaultscale := 0.8 ;

   definecolor [ name = "mp:red",   b = 1 ] ;
   definecolor [ name = "mp:green", y = 1 ] ;

   path twos, threes ;
   twos   := fullcircle xscaled 4cm yscaled 2cm rotated 180 shifted 42 
left ;
   threes := fullcircle xscaled 4cm yscaled 2cm shifted 42 
right ;


   fill twos   withcolor "mp:red"   withtransparency(1,0.5) ;
   fill threes withcolor "mp:green" withtransparency(1,0.5) ;

   draw twos ;
   draw threes ;

   label("...",( 1.5cm,0));
   label("...",( 0,0));
   label("...",(-1.5cm,0));
   label.top("\strut yeux marron",   (-1.5cm,1.25cm));
   label.top("\strut cheveux blonds",( 1.5cm,1.25cm));
\stopMPcode

\stoptext

(you cannot overload colors at the tex level in mp but use them in order 
to be consistent)


Hans

-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
   tel: 038 477 53 69 | www.pragma-ade.nl | 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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] Transparency (Metapost)

2019-12-01 Thread Fabrice Couvreur
Hello
Thank you for your suggestion. However, it works with context and not with
lmtx.
Fabrice

\starttext
\startMPcode
   defaultfont := "texgyrepagella-regular*default" ;
   defaultscale :=0.8;

   color brown;
   brown = (0.128,0.00,0.00);

   path twos, threes, sixes;
   twos = fullcircle xscaled 4cm yscaled 2cm rotated 180
  shifted 42 left;
   threes = fullcircle xscaled 4cm yscaled 2cm shifted 42 right;
   sixes = buildcycle(twos, threes);

   fill twos   withcolor brown withtransparency(1,0.75);
   fill threes withcolor yellow withtransparency(1,0.75);
   fill sixes withcolor yellow + brown withtransparency(1,0.75);

   draw twos;
   draw threes;

   label("...",(1.5cm,0));
   label("...",(0,0));
   label("...",(-1.5cm,0));
   label.top("yeux marron",(-1.5cm,1.25cm));
   label.top("cheveux blonds",(1.5cm,1.25cm));
\stopMPcode
\stoptext

tex error   > tex error on line 1 in file ./blond.tex: ?


\font_helpers_low_level_define ...\scaledfontmode
  \relax \ifcase
\scaledfont...
\font_helpers_trigger_define ..._identifier_class
  \csname
\v_font_identifier...
\applyfontclassstrategies ...to_size \lastnamedcs
  \else \expandafter
\font_h...
\font_helpers_synchronize_font ...classstrategies
  \fi \setfalse
\c_font_auto...
\rm ->\ifmmode \mathrm \else \normalrm
   \fi
\font_basics_switch_style ...dcsname \lastnamedcs
  \edef \fontstyle
{#1}\ifmm...
...
l.1 \starttext


 1 >>  \starttext
 2 \startMPcode
 3defaultfont := "texgyrepagella-regular*default" ;
 4defaultscale :=0.8;
 5
 6color brown;
 7brown = (0.128,0.00,0.00);
 8
 9path twos, threes, sixes;
10twos = fullcircle xscaled 4cm yscaled 2cm rotated 180
11   shifted 42 left;

mtx-context | fatal error: return code: 256


Le dim. 1 déc. 2019 à 00:34, Jeong Dal  a écrit :

> \
>
>
> Dear Fabrice,
>
> I got color and transparency using the following command in LMTX(metafun).
>
> fill p withcolor yellow withtransparency(1, .75);
>
> I hope that it helps.
>
> Best regards,
>
> Dalyoung
>
> ___
> 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://context.aanhet.net
> archive  : https://bitbucket.org/phg/context-mirror/commits/
> wiki : http://contextgarden.net
>
> ___
>
___
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] Transparency (Metapost)

2019-11-30 Thread Jeong Dal
> \

Dear Fabrice,

I got color and transparency using the following command in LMTX(metafun).

fill p withcolor yellow withtransparency(1, .75);

I hope that it helps.

Best regards,

Dalyoung___
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


[NTG-context] Transparency (Metapost)

2019-11-30 Thread Fabrice Couvreur
Hello,
I have a little trouble with the management of transparency : the colors
are not respected.
Thank you.
Fabrice

\starttext
\startMPcode
   defaultfont := "texgyrepagella-regular*default" ;
   defaultscale :=0.8;

   color brown;
   brown = (0.165,0.42,0.42);

   path twos, threes;
   twos = fullcircle xscaled 4cm yscaled 2cm rotated 180
  shifted 42 left;
   threes = fullcircle xscaled 4cm yscaled 2cm shifted 42 right;

   fill twos   withcolor transparent(1,0.4,brown);
   fill threes withcolor transparent(1,0.4,yellow);

   draw twos;
   draw threes;

   label("...",(1.5cm,0));
   label("...",(0,0));
   label("...",(-1.5cm,0));
   label.top("yeux marron",(-1.5cm,1.25cm));
   label.top("cheveux blonds",(1.5cm,1.25cm));
\stopMPcode
\stoptext

[image: blond.jpg]
___
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] Size of the font (Metapost + xtable)

2019-09-23 Thread Wolfgang Schuster

Fabrice Couvreur schrieb am 23.09.2019 um 23:31:

Hi Wolfgang,
As I understand it, the following instructions have no effect on the 
figures


defaultfont := "texgyrepagella-regular*default" ;
defaultscale :=0.8 ;


You change the font because you typeset your labels in math mode.

label.llft(btex \m{O} etex,origin) ;

Wolfgang

___
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] Size of the font (Metapost + xtable)

2019-09-23 Thread Wolfgang Schuster

Fabrice Couvreur schrieb am 23.09.2019 um 16:12:

Hello,
I can not change the font size of my figures in the table.


\startxcell[foregroundstyle={\switchtobodyfont[...]}]

or

\setupxtable[smallbodyfont][foregroundstyle={\switchtobodyfont[...]}]

\startxcell[smallbodyfont]

Wolfgang

___
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] Size of the font (Metapost + xtable)

2019-09-23 Thread Thomas A. Schmitz



On 9/23/19 4:12 PM, Fabrice Couvreur wrote:

Hello,
I can not change the font size of my figures in the table.
Thank you
Fabrice



Does changing

\usecolors [xwi]

to

\usecolors [ema]

help?

All best

Thomas
___
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


[NTG-context] Size of the font (Metapost + xtable)

2019-09-23 Thread Fabrice Couvreur
Hello,
I can not change the font size of my figures in the table.
Thank you
Fabrice


 \usecolors[xwi]
\startbuffer[myfigure]
  \dontleavehmode
  \startMPcode
defaultfont := "texgyrepagella-regular*default" ;
defaultscale :=0.8 ;
numeric alpha ; alpha = 60 ;
path circle ;
circle = fullcircle scaled 1.4cm ;
draw circle withcolor blue ;
drawarrow  0.9cm * dir 25 {dir 90}
   .. 0.9cm * dir 45 {dir (90+alpha)}
withcolor \MPcolor{darkred} ;
drawdot origin withpen pencircle scaled 2pt ;
drawdot  0.7cm*dir 0 withpen pencircle scaled 2pt ;
label.llft(btex \m{O} etex,origin) ;
label.rt(btex \m{A} etex,0.7cm*dir 0) ;
  \stopMPcode
\stopbuffer
\starttext
 \startlinecorrection[blank]
  \startmidaligned
\startxtable[align={middle,lohi},width=2.25cm]
  \startxrow
\startxcell
  [background=color,backgroundcolor=paleturquoise]
  Angle en degré
\stopxcell
\startxcell
  180
\stopxcell
\startxcell
  360
\stopxcell
\startxcell
  90
\stopxcell
\startxcell
  45
\stopxcell
\startxcell
  60
\stopxcell
\startxcell
  210
\stopxcell
  \stopxrow
  \startxrow
\startxcell
  [background=color,backgroundcolor=paleturquoise]
  Position de \m{M}
\stopxcell
\startxcell
  \dontleavehmode
  \startMPcode
defaultfont := "texgyrepagella-regular*default" ;
defaultscale :=0.8 ;
numeric alpha ; alpha = 60 ;
path circle ;
circle = fullcircle scaled 1.4cm ;
draw circle withcolor blue ;
drawarrow  0.9cm * dir 25 {dir 90}
   .. 0.9cm * dir 45 {dir (90+alpha)}
withcolor \MPcolor{darkred} ;
drawdot origin withpen pencircle scaled 2pt ;
drawdot  0.7cm*dir 0 withpen pencircle scaled 2pt ;
drawdot  0.7cm*dir 180 withpen pencircle scaled 2pt ;
label.llft(btex \m{O} etex,origin) ;
label.rt(btex \m{A} etex,0.7cm*dir 0) ;
label.lft(btex \m{M} etex,0.7cm*dir 180) ;
  \stopMPcode
\stopxcell
\startxcell
  \getbuffer[myfigure]
\stopxcell
\startxcell
  \getbuffer[myfigure]
\stopxcell
\startxcell
  \getbuffer[myfigure]
\stopxcell
\startxcell
  \getbuffer[myfigure]
\stopxcell
\startxcell
  \getbuffer[myfigure]
\stopxcell
  \stopxrow
  \startxrow
\startxcell
  [background=color,backgroundcolor=paleturquoise]
  Longueur \m{L} en hm
\stopxcell
\startxcell
  \m{\pi \times 1}
\stopxcell
\startxcell
  \unknown
\stopxcell
\startxcell
  \unknown
\stopxcell
\startxcell
  \unknown
\stopxcell
\startxcell
  \unknown
\stopxcell
\startxcell
  \unknown
\stopxcell
  \stopxrow
\stopxtable
  \stopmidaligned
\stoplinecorrection
\stoptext
___
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] MetaPost with Multiple Variable Sections

2019-09-18 Thread Jeong Dal
Dear Jeroen,

If you change “pair a;” to “numeric a;” in the second MPcode, it draws a circle 
without error.

Best regards,

Dalyoung

> 
> \placefloatright{}{
> \startMPcode
> pair a;

numeric a;

> a := 2cm;
> draw fullcircle scaled (2*a);
> \stopMPcode}
> 
> \stoptext
> 

___
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] MetaPost with Multiple Variable Sections

2019-09-18 Thread Aditya Mahajan

On Wed, 18 Sep 2019, Jeroen wrote:


\startMPcode
pair a;
a := 2cm;


You define a to be a pair and then assign it to a number. Metapost is 
telling you that you cannot do that:



(xpart a,ypart a)
56.6929

! Equation cannot be performed (pair=numeric).

;
<*> pair a; a := 2cm;
draw fullcircle scaled (2*a); ;
I'm sorry, but I don't know how to make such things equal.
(See the two expressions just above the error message.)

You can fix that by saying

numeric a;
a := 2cm;

One needs to keep in mind that all the code in multiple MPcode 
environments are run in the same scope. I occasonally use


\startMPcode
begingroup;
...
endgroup;
\stopMPcode

to avoid interference.

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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


[NTG-context] MetaPost with Multiple Variable Sections

2019-09-18 Thread Jeroen
I have been working with MetaPost as following, which worked fine with one
startMPcode section with variables, but with 2 startMPcode Metapost
sections, it keeps telling me the numbers dont add up:


\definefloat  [floatright][figure]
\setupfloat   [floatright][default={right,none}]
\setuplayout  [backspace=20mm,width=170mm,topspace=20mm,height=250mm]

\starttext

\placefloatright{}{
\startMPcode
pair a, b;
a := (0,0);
b := (50,50);
draw a -- b;
\stopMPcode}

\placefloatright{}{
\startMPcode
pair a;
a := 2cm;
draw fullcircle scaled (2*a);
\stopMPcode}

\stoptext


I also have tried with the startbuffer combination as below, but this gave
the same error codes. Is there any other way of working with multiple
MetaPost sections with variables in a single document?


\definefloat  [floatright][figure]
\setupfloat   [floatright][default={right,none}]
\setuplayout  [backspace=20mm,width=170mm,topspace=20mm,height=250mm]

\starttext

\startbuffer
\startMPcode
pair a, b;
a := (0,0);
b := (50,50);
draw a -- b;
\stopMPcode
\stopbuffer

\floatright{}{\getbuffer}

\startbuffer
\startMPcode
pair a;
a := 2cm;
draw fullcircle scaled (2*a);
\stopMPcode
\stopbuffer

\floatright{}{\getbuffer}

\stoptext
___
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] colors in MetaPost

2019-09-11 Thread Hans Hagen

On 9/11/2019 2:18 PM, Henning Hraban Ramm wrote:

Am 2019-09-11 um 13:46 schrieb Henning Hraban Ramm :

\definecolor[VerlaufVon][c=75,m=5,y=95,k=60]
\definecolor[VerlaufNach][c=88,m=95,y=5,k=60]


Of course I need values between 0 and 1.
Sorry for the noise.
I think I’m too tired...

there is an alternative interface on top of the existing one (coming) ...

% maybe handy:

definecolor [ name = "MyColor3", r = 0.22, g = 0.44, b = 0.66 ] ;
definecolor [ name = "MyColor4", r = 0.66, g = 0.44, b = 0.22 ] ;

% parameter driven:

draw lmt_shade [
path  = fullcircle scaled 4cm,
direction = "right",
domain= { 0, 2 },
colors= { "MyColor3", "MyColor4" },
] ;

but tweaking shades will never be easy

Hans

(working in the metafun xl manual, more soon)

-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
   tel: 038 477 53 69 | www.pragma-ade.nl | 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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] colors in MetaPost

2019-09-11 Thread Henning Hraban Ramm
Am 2019-09-11 um 13:46 schrieb Henning Hraban Ramm :
> \definecolor[VerlaufVon][c=75,m=5,y=95,k=60]
> \definecolor[VerlaufNach][c=88,m=95,y=5,k=60]

Of course I need values between 0 and 1.
Sorry for the noise.
I think I’m too tired...


Greetlings, Hraban
---
https://www.fiee.net
http://wiki.contextgarden.net
https://www.dreiviertelhaus.de
GPG Key ID 1C9B22FD

___
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


[NTG-context] colors in MetaPost

2019-09-11 Thread Henning Hraban Ramm
Hi,
I’m trying to get a linear shade in the background of my presentation.
But it seems like MetaPost can’t handle my self-defined colors:


\definecolor[VerlaufVon][c=75,m=5,y=95,k=60]
\definecolor[VerlaufNach][c=88,m=95,y=5,k=60]

\startuniqueMPgraphic{Verlauf}
% old method, also doesn’t work
%  path p ;
%  p := unitsquare xscaled \overlaywidth yscaled \overlayheight ;
%  linear_shade(p,6,\MPcolor{VerlaufVon},\MPcolor{VerlaufNach}) ;

fill fullsquare xyscaled (\overlaywidth,\overlayheight)
  withshademethod "linear"
  withshadevector (0.5,2.5)
  %withshadedirection shadedup
  withshadecolors ("VerlaufVon", "VerlaufNach")
;
\stopuniqueMPgraphic

\defineoverlay[verlaufen][\useMPgraphic{Verlauf}]

\setupbackgrounds[paper][background={verlaufen}]

\starttext
\strut
\stoptext


The background consists of a blue and a green area instead of a shade. While 
testing I sometimes got a few more stripes in the top and bottom area, can’t 
reproduce any more.

I also tried RGB and hex (HTML) definitions. Predefined colors work.
According to the MetaFun manual, either \MPcolor{name} or just "name" should 
work.
What’s wrong?


Greetlings, Hraban
---
https://www.fiee.net
http://wiki.contextgarden.net
https://www.dreiviertelhaus.de
GPG Key ID 1C9B22FD

___
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] Convert SVG to MetaPost

2019-08-13 Thread Hans Hagen

On 8/12/2019 1:33 PM, Jon Wong wrote:

Hi Taco!

Very enlightening!

I’ll just use both MetaPost and SVG for their intended purposes. (SVG 
will come from workflow involving GIMP/Inkscape; MetaPost for logical, 
rather than graphical, figures.)

if you have inkscape installed you can do

\externalfigure[test.svg][width=10cm]

and context will handle the conversion

-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
   tel: 038 477 53 69 | www.pragma-ade.nl | 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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] Convert SVG to MetaPost

2019-08-13 Thread Hans Hagen

On 8/12/2019 1:15 PM, Taco Hoekwater wrote:

Hi,


On 12 Aug 2019, at 12:10, Jon Wong  wrote:

Hi all,

Is it possible to convert SVG to MetaPost?

Currently, I have Bash scripts in my workflow to invoke Inkscape (converting 
SVG to PDF). I don’t like to allow shell access to TeX.

If I can convert SVG to MetaPost, I will gladly Git-track MetaPost files 
instead of SVG files. That will do away with having to convert SVG into PDF 
(via Inkscape).


SVG (and Inkscape) can do many graphical things that metapost can not do, so I 
think that would be a bad idea even if there was a tool that could do the 
conversion for some subset of SVG.

That said, SVG is just an XML format, so it should be possible to process 
simple SVG using ConTeXt’s built-in xml parser (with suitable processing 
environments, of course). How much work that would entail and whether it is
feasible depends on the actual SVG graphics.
indeed, and i actually did a partial converter a while ago just to see 
if it could be done but then decided to delay that till i really need it
(normally converting a svg to pdf is quite ok) .. i might pick it up on 
some cold winternight


Hans

--
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
   tel: 038 477 53 69 | www.pragma-ade.nl | 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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] Convert SVG to MetaPost

2019-08-12 Thread Jon Wong
Hi Taco!

Very enlightening!

I’ll just use both MetaPost and SVG for their intended purposes. (SVG will come 
from workflow involving GIMP/Inkscape; MetaPost for logical, rather than 
graphical, figures.)

Regards
Jon


> On Aug 12, 2019, at 7:30 PM, luigi scarso  wrote:
> 
> 
> 
> On Mon, Aug 12, 2019 at 12:11 PM Jon Wong  <mailto:jhannw...@gmail.com>> wrote:
> Hi all,
> 
> Is it possible to convert SVG to MetaPost?
> 
> Currently, I have Bash scripts in my workflow to invoke Inkscape (converting 
> SVG to PDF). I don’t like to allow shell access to TeX.
> 
> If I can convert SVG to MetaPost, I will gladly Git-track MetaPost files 
> instead of SVG files. That will do away with having to convert SVG into PDF 
> (via Inkscape).
> 
> 
> you can check pstoedit 
> http://www.calvina.de/pstoedit/pstoedit.htm 
> <http://www.calvina.de/pstoedit/pstoedit.htm>
> 
> it can convert postscript to metapost.
> So svg->pdf->ps->mp seems to be possible.
> Of course, I am not sure if it fits in  your workflow.
> 
> -- 
> luigi
> ___
> 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://context.aanhet.net
> archive  : https://bitbucket.org/phg/context-mirror/commits/
> wiki : http://contextgarden.net
> ___

___
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] Convert SVG to MetaPost

2019-08-12 Thread luigi scarso
On Mon, Aug 12, 2019 at 12:11 PM Jon Wong  wrote:

> Hi all,
>
> Is it possible to convert SVG to MetaPost?
>
> Currently, I have Bash scripts in my workflow to invoke Inkscape
> (converting SVG to PDF). I don’t like to allow shell access to TeX.
>
> If I can convert SVG to MetaPost, I will gladly Git-track MetaPost files
> instead of SVG files. That will do away with having to convert SVG into PDF
> (via Inkscape).
>
>
you can check pstoedit
http://www.calvina.de/pstoedit/pstoedit.htm

it can convert postscript to metapost.
So svg->pdf->ps->mp seems to be possible.
Of course, I am not sure if it fits in  your workflow.

-- 
luigi
___
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] Convert SVG to MetaPost

2019-08-12 Thread Taco Hoekwater
Hi,

> On 12 Aug 2019, at 12:10, Jon Wong  wrote:
> 
> Hi all,
> 
> Is it possible to convert SVG to MetaPost?
> 
> Currently, I have Bash scripts in my workflow to invoke Inkscape (converting 
> SVG to PDF). I don’t like to allow shell access to TeX.
> 
> If I can convert SVG to MetaPost, I will gladly Git-track MetaPost files 
> instead of SVG files. That will do away with having to convert SVG into PDF 
> (via Inkscape).

SVG (and Inkscape) can do many graphical things that metapost can not do, so I 
think that would be a bad idea even if there was a tool that could do the 
conversion for some subset of SVG.

That said, SVG is just an XML format, so it should be possible to process 
simple SVG using ConTeXt’s built-in xml parser (with suitable processing 
environments, of course). How much work that would entail and whether it is
feasible depends on the actual SVG graphics.

Best wishes,
Taco
 
___
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


[NTG-context] Convert SVG to MetaPost

2019-08-12 Thread Jon Wong
Hi all,

Is it possible to convert SVG to MetaPost?

Currently, I have Bash scripts in my workflow to invoke Inkscape (converting 
SVG to PDF). I don’t like to allow shell access to TeX.

If I can convert SVG to MetaPost, I will gladly Git-track MetaPost files 
instead of SVG files. That will do away with having to convert SVG into PDF 
(via Inkscape).

Regards
Jon
___
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] Wrong MetaPost text output

2019-08-11 Thread Alan Braslau
On Sun, 11 Aug 2019 11:12:55 -0700
Henri Menke  wrote:

> Thank you for the quick repsonse.  This looks good to me.  However,
> could you tell me a way to get the correct baseline with textext?  When
> I use
> 
> \startMPpage
> draw btex dummy etex shifted (0,0);
> draw btex foo   etex shifted (1.5cm,0);
> \stopMPpage
> 
> the baseline is the one that I would expect from TeX, i.e. at the depth
> of the “y” is removed or otherwise correctly accounted for.  In contrast
> when I use
> 
> \startMPpage
> draw textext("dummy") shifted (0,0);
> draw textext("foo")   shifted (1.5cm,0);
> \stopMPpage
> 
> the baseline will be below the depth of the “y” which is sometimes
> unwanted.

textext() is actually textext@#()
so you can use textext.top() for example
to put the *bottom* of the text bounding box at y=0.
Without any @# suffix, the text bounding box gets centered at y=0.

Metafun has a few *new* suffixes defined, so you can use
textext.d(), textext.dlft(), textext.drt(), I BELIEVE,
to position with respect to the tex baseline.
(you need to check this).

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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] Wrong MetaPost text output

2019-08-11 Thread Henri Menke
On 8/11/19 10:51 AM, Hans Hagen wrote:
> I'll do this (lmtx):
> 
> metapost> use 'textext(.)' instead of 'btex ..... etex'
> metapost> rewrapping btex ... etex at the outer level [[dummy]]
> metapost> rewrapping btex ... etex at the outer level [["foo"]]
> metapost> rewrapping btex ... etex at the outer level [[bar]]
> 
> when this is seen
> 
> def drawtest =
> draw btex dummy etex shifted (0,0);
> draw btex "foo" etex shifted (1.5cm,0);
> draw btex bar   etex shifted (3cm,0);
> enddef;
> 
> rewrapping can work kind of ok, but it is still more fragile than textext 
> (which can also be used with variables and concatinated strings and such, 
> which probably is what one wants to do in macros)

Thank you for the quick repsonse.  This looks good to me.  However,
could you tell me a way to get the correct baseline with textext?  When
I use

\startMPpage
draw btex dummy etex shifted (0,0);
draw btex foo   etex shifted (1.5cm,0);
\stopMPpage

the baseline is the one that I would expect from TeX, i.e. at the depth
of the “y” is removed or otherwise correctly accounted for.  In contrast
when I use

\startMPpage
draw textext("dummy") shifted (0,0);
draw textext("foo")   shifted (1.5cm,0);
\stopMPpage

the baseline will be below the depth of the “y” which is sometimes
unwanted.

> 
> Hans
> 
> -
>   Hans Hagen | PRAGMA ADE
>   Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
>tel: 038 477 53 69 | www.pragma-ade.nl | 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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] Wrong MetaPost text output

2019-08-11 Thread Hans Hagen

On 8/11/2019 6:09 PM, Henri Menke wrote:

Dear devs,

There seems to be a bug in the MetaPost integration of ConTeXt.  The MWE
below should produce three different labels “dummy foo bar” but instead
produces “bar bar bar”.  The same example works correctly in plain
MetaPost.  Originally reported on

 
https://tex.stackexchange.com/questions/503773/strange-behaviour-of-the-btex-etex-construct

Cheers, Henri

---

\starttext
\startMPpage
def drawtest(expr i) = %i is not used here
 draw btex dummy etex shifted (0,0);
 draw btex foo   etex shifted (1.5cm,0);
 draw btex bar   etex shifted (3cm,0);
enddef;
drawtest(5);
\stopMPpage
\stoptext
It's not a really bug but a side effect. When metapost parses btex .. 
etex it immediately replaces its content. In mpost the program that is 
hardcoded as 'call out to tex and convert the dvi result into a 
picture'. This parsing is not 'delayed' by wrapping in macro.


So in this case, what happens is that where normally there is some 
interplay between context and the library, this kind of gets messed up. 
Using btex inside a macro body is just a bad idea.


def drawtest(expr i) = %i is not used here
  draw textext("dummy") shifted (0,0);
  draw textext("foo")   shifted (1.5cm,0);
  draw textext("bar")   shifted (3cm,0);
enddef;

works fine because it is not replaced in the macro body when parsed.

In context lmtx I will give a warning when "btex .. etex" is used inside 
a macro definition. Actually btex/etex is just supported in context as a 
kind of 'service' (we could just drop it).


Anyway, you can advice not to use "btex .. etex" but textext instead. As 
with all things tex (and mp) with some hasty programming much can be 
solved but in this case it's not worth the effort and for sure it will 
bring up other side effects.


(In a similar fashion it's not a good idea to have global textexts 
because there are local stored for them but in that case one can enforce 
a persistent textext if needed.)


Hans

-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
   tel: 038 477 53 69 | www.pragma-ade.nl | 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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


[NTG-context] Wrong MetaPost text output

2019-08-11 Thread Henri Menke
Dear devs,

There seems to be a bug in the MetaPost integration of ConTeXt.  The MWE
below should produce three different labels “dummy foo bar” but instead
produces “bar bar bar”.  The same example works correctly in plain
MetaPost.  Originally reported on


https://tex.stackexchange.com/questions/503773/strange-behaviour-of-the-btex-etex-construct

Cheers, Henri

---

\starttext
\startMPpage
def drawtest(expr i) = %i is not used here
draw btex dummy etex shifted (0,0);
draw btex foo   etex shifted (1.5cm,0);
draw btex bar   etex shifted (3cm,0);
enddef;
drawtest(5);
\stopMPpage
\stoptext
___
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] I (metapost) can't handle numbers bigger than 32767.99998

2019-07-05 Thread Zhichu
Hi Hans,

I simply put the unicode character there and everything works pretty well.

I was using only 5 Chinese characters in a document: 中國科學院, which means Chinese 
Academy of Sciences. Looked up their unicode number:

for c in u'中國科學院': print(ord(c))
20013
22283
31185
23416
38498

and draw every glyph carefully in a metapost file "cas-chars.mp":

beginglyph(20013,1000,1000,0);
  % a lot of fillings and drawingsendglyph;

then call them in a test file:

\definemetafont[cas-logo][cas-chars.mp]
\startTEXpage
\definefont[cas][cas@cas-logo]
\cas 中國科學院\stopTEXpage

If I remove the beginglyph(38498,1000,1000,0) part in the mp file and “\cas 
中國科學” will generate the correct output. or if I change 
beginglyph(38498,1000,1000,0) to  beginglyph(32767,1000,1000,0) and “\cas 
中國科學\char"7FFF” also gives the right output.

I'm looking forward to “some” module :-)
--
From:Hans Hagen 
Send Time:2019 Jul. 5 (Fri.) 17:03
To:陈之初 ; mailing list for ConTeXt users 

Subject:Re: [NTG-context] I (metapost) can't handle numbers bigger than 
32767.8

On 7/5/2019 8:32 AM, Zhichu wrote:
> Hi everyone,
> 
> I was using metapost to generate some symbols, as in 
> "tex/texmf-context/metapost/context/fonts/mpiv/demo-symbols.tex"

How do you use these symbols in a document? Do you call them up by 
number somehow? Using some glyph interface doesn't make much sense I 
think, as the font stuff comes from mf which is 8 bit. So, these 
character numbers (and simensions) are not really saying much, other 
than that they're properties of a figure.

(In context lmtx there will likely be some module for mp fonts. We can 
already do a lot but there is some more potential.)

Hans


> Occasionally, I want to customize a glyph whose charcode is a little large, 
> say the character " 
> 院":
> 
> ~~~IPython
> In [1]: for c in u'院': print(ord(c))
> 38498
> 
> 
> so I wrote:
> 
> beginglyph(38498,2,4,0) ; % high voltage
>  interim ahlength := 1 ;
>  drawarrow (1,4) -- (0,2) -- (2,3) -- (1,0) withcolor darkred ;
> endglyph ;
> 
> 
> and I got:
> 
> ! Enormous number has been reduced.
> l.60 beginzhglyph(38498
> );
> I can't handle numbers bigger than 32767.8;
> so I've changed your constant to that maximum amount.
> 
> 
> So charcode is a 15-bit integer?
> 
> Currently, I use `beginglyph(32767,2,4,0) ;` and call it with \char"7FFF. Not 
> an elegant way I think.
> 
> Is there a fix? I checked the metapost manual and found that charcode is only 
> used to set the filename to something like %{jobname}.%{charcode} I can't see 
> why there's a limit for charcode.
> 
> 
> 
> 
> 
> 
> ___
> 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://context.aanhet.net
> archive  : https://bitbucket.org/phg/context-mirror/commits/
> wiki : http://contextgarden.net
> ___
> 


-- 

-
   Hans Hagen | PRAGMA ADE
   Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
tel: 038 477 53 69 | www.pragma-ade.nl | 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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___

___
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] I (metapost) can't handle numbers bigger than 32767.99998

2019-07-05 Thread Hans Hagen

On 7/5/2019 8:32 AM, Zhichu wrote:

Hi everyone,

I was using metapost to generate some symbols, as in 
"tex/texmf-context/metapost/context/fonts/mpiv/demo-symbols.tex"


How do you use these symbols in a document? Do you call them up by 
number somehow? Using some glyph interface doesn't make much sense I 
think, as the font stuff comes from mf which is 8 bit. So, these 
character numbers (and simensions) are not really saying much, other 
than that they're properties of a figure.


(In context lmtx there will likely be some module for mp fonts. We can 
already do a lot but there is some more potential.)


Hans


Occasionally, I want to customize a glyph whose charcode is a little large, say the character " 
院":


~~~IPython
In [1]: for c in u'院': print(ord(c))
38498


so I wrote:

beginglyph(38498,2,4,0) ; % high voltage
 interim ahlength := 1 ;
 drawarrow (1,4) -- (0,2) -- (2,3) -- (1,0) withcolor darkred ;
endglyph ;


and I got:

! Enormous number has been reduced.
l.60 beginzhglyph(38498
);
I can't handle numbers bigger than 32767.8;
so I've changed your constant to that maximum amount.


So charcode is a 15-bit integer?

Currently, I use `beginglyph(32767,2,4,0) ;` and call it with \char"7FFF. Not 
an elegant way I think.

Is there a fix? I checked the metapost manual and found that charcode is only 
used to set the filename to something like %{jobname}.%{charcode} I can't see 
why there's a limit for charcode.






___
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___




--

-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
   tel: 038 477 53 69 | www.pragma-ade.nl | 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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


[NTG-context] I (metapost) can't handle numbers bigger than 32767.99998

2019-07-05 Thread Zhichu
Hi everyone,

I was using metapost to generate some symbols, as in 
"tex/texmf-context/metapost/context/fonts/mpiv/demo-symbols.tex"

Occasionally, I want to customize a glyph whose charcode is a little large, say 
the character "院":

~~~IPython
In [1]: for c in u'院': print(ord(c))
38498


so I wrote:

beginglyph(38498,2,4,0) ; % high voltage
interim ahlength := 1 ;
drawarrow (1,4) -- (0,2) -- (2,3) -- (1,0) withcolor darkred ;
endglyph ;


and I got:

! Enormous number has been reduced.
l.60 beginzhglyph(38498
);
I can't handle numbers bigger than 32767.8;
so I've changed your constant to that maximum amount.


So charcode is a 15-bit integer?

Currently, I use `beginglyph(32767,2,4,0) ;` and call it with \char"7FFF. Not 
an elegant way I think.

Is there a fix? I checked the metapost manual and found that charcode is only 
used to set the filename to something like %{jobname}.%{charcode} I can't see 
why there's a limit for charcode.





___
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] using metapost library makecirc with context.

2019-04-21 Thread Alan Braslau
On Sat, 20 Apr 2019 23:49:26 +0200
Hans Hagen  wrote:

> > let latex=textext ;  
> 
> That crashed here.

In fact, when I used makecirc.mp, I just commented out the following few lines 
at the head of the file:

%input latex;
%
% Commands definitions to do the labeled easier %
%
%LaTeXsetup:=LaTeXsetup & 
%"\def\ohm{\ensuremath{\,\Omega}}" &
%"\def\kohm{\,k\ensuremath{\Omega}}" &
%"\def\modarg#1#2{\setbox0=\hbox{$\mkern-1mu/#2^\circ$}" &
%"\dp0=.21ex $#1\underline{\box0}$}";

and everything worked (the macros use label() for text).

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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] using metapost library makecirc with context.

2019-04-20 Thread Hans Hagen

On 4/20/2019 11:16 PM, Alan Braslau wrote:

On Sat, 20 Apr 2019 23:00:09 +0200
Hans Hagen  wrote:


On 4/20/2019 10:09 PM, Andrea De Michele wrote:


I didn't understand the magic behind that  but it's works.


mp has no real text typesetting options so this hack provides it


Why not
let latex=textext ;


That crashed here.


Another question: there is a library to draw electrics circuit
alternative to makecirc but more context/metafun friendly?

the node library but it lacks things for drawing resistors ... i'll
discuss this whith alan


I played with makecirc a while back (and I even used it to make simple circuit 
diagrams that I used in a patent application). A real electronic circuit 
drawing program these days will do circuit board layouts and automatic routing, 
etc. I'm not sure that we want to get into this with MP.

I assume only for some simple educational drawings.

Hans


-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
   tel: 038 477 53 69 | www.pragma-ade.nl | 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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] using metapost library makecirc with context.

2019-04-20 Thread Alan Braslau
On Sat, 20 Apr 2019 23:00:09 +0200
Hans Hagen  wrote:

> On 4/20/2019 10:09 PM, Andrea De Michele wrote:
> 
> > I didn't understand the magic behind that  but it's works.  
> 
> mp has no real text typesetting options so this hack provides it

Why not
let latex=textext ;

> > Another question: there is a library to draw electrics circuit
> > alternative to makecirc but more context/metafun friendly?  
> the node library but it lacks things for drawing resistors ... i'll 
> discuss this whith alan

I played with makecirc a while back (and I even used it to make simple circuit 
diagrams that I used in a patent application). A real electronic circuit 
drawing program these days will do circuit board layouts and automatic routing, 
etc. I'm not sure that we want to get into this with MP.

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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] using metapost library makecirc with context.

2019-04-20 Thread Hans Hagen

On 4/20/2019 10:09 PM, Andrea De Michele wrote:


I didn't understand the magic behind that  but it's works.


mp has no real text typesetting options so this hack provides it


Another question: there is a library to draw electrics circuit
alternative to makecirc but more context/metafun friendly?
the node library but it lacks things for drawing resistors ... i'll 
discuss this whith alan


Hans

-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
   tel: 038 477 53 69 | www.pragma-ade.nl | 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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] using metapost library makecirc with context.

2019-04-20 Thread Andrea De Michele
Hans Hagen  writes:

> On 4/19/2019 5:48 PM, Andrea De Michele wrote:
>>
>> I'm trying to use with Context  makecirc a metapost library to draw
>> electric circuits, but I have problems with the labels of the circuits
>> element that are not displayed correctly.
>>
>> FIRST EXAMPLE (No labels are displayed)
>> -
>> \starttext
>>
>> \startMPinclusions
>>input makecirc;
>> \stopMPinclusions
>>
>>
>> \startstaticMPfigure{circ1}
>>  u:= 1cm ;
>>  source.e((0,0u),DC,90,"\Delta V","2V") ;
>>  resistor.a((2u,1u),normal,90,"R_1","1$\Omega$") ;
>>  resistor.b((2u,-1u),normal,90,"R_2","2$\Omega$") ;
>>  wire(S.e.p,R.a.r,udsq) ;
>>  wire(S.e.n,R.b.l,udsq) ;
>>  wire(R.a.l,R.b.r,udsq) ;
>> \stopstaticMPfigure
>> \usestaticMPfigure[circ1]
>>
>> \stoptext
> I searched ctab for that library and it has soem hard wired latex
> stuff in it. You can make latex.mp empty (to play safe),
>
> Load the file with:
>
> \startMPinclusions
> string LaTeXsetup ; LaTeXsetup := "";
> input "makecirc.mp";
> vardef latex(expr t) = textext(t) enddef ;
> \stopMPinclusions
>
> I didn't look into the details but yoru example runs then.
>
>
> Hans
>
> -
>   Hans Hagen | PRAGMA ADE
>   Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
>tel: 038 477 53 69 | www.pragma-ade.nl | 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://context.aanhet.net
> archive  : https://bitbucket.org/phg/context-mirror/commits/
> wiki : http://contextgarden.net
> ___
>
Thank you,

I didn't understand the magic behind that  but it's works.

Another question: there is a library to draw electrics circuit
alternative to makecirc but more context/metafun friendly?



-- 
Andrea De Michele

-- 
Andrea De Michele

___
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] using metapost library makecirc with context.

2019-04-19 Thread Hans Hagen

On 4/19/2019 5:48 PM, Andrea De Michele wrote:


I'm trying to use with Context  makecirc a metapost library to draw
electric circuits, but I have problems with the labels of the circuits
element that are not displayed correctly.

FIRST EXAMPLE (No labels are displayed)
-
\starttext

\startMPinclusions
   input makecirc;
\stopMPinclusions


\startstaticMPfigure{circ1}
 u:= 1cm ;
 source.e((0,0u),DC,90,"\Delta V","2V") ;
 resistor.a((2u,1u),normal,90,"R_1","1$\Omega$") ;
 resistor.b((2u,-1u),normal,90,"R_2","2$\Omega$") ;
 wire(S.e.p,R.a.r,udsq) ;
 wire(S.e.n,R.b.l,udsq) ;
 wire(R.a.l,R.b.r,udsq) ;
\stopstaticMPfigure
\usestaticMPfigure[circ1]

\stoptext
I searched ctab for that library and it has soem hard wired latex stuff 
in it. You can make latex.mp empty (to play safe),


Load the file with:

\startMPinclusions
string LaTeXsetup ; LaTeXsetup := "";
input "makecirc.mp";
vardef latex(expr t) = textext(t) enddef ;
\stopMPinclusions

I didn't look into the details but yoru example runs then.


Hans

-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
   tel: 038 477 53 69 | www.pragma-ade.nl | 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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


[NTG-context] using metapost library makecirc with context.

2019-04-19 Thread Andrea De Michele

I'm trying to use with Context  makecirc a metapost library to draw
electric circuits, but I have problems with the labels of the circuits
element that are not displayed correctly.

FIRST EXAMPLE (No labels are displayed)
-
\starttext

\startMPinclusions
  input makecirc;
\stopMPinclusions


\startstaticMPfigure{circ1}
u:= 1cm ;
source.e((0,0u),DC,90,"\Delta V","2V") ;
resistor.a((2u,1u),normal,90,"R_1","1$\Omega$") ;
resistor.b((2u,-1u),normal,90,"R_2","2$\Omega$") ;
wire(S.e.p,R.a.r,udsq) ;
wire(S.e.n,R.b.l,udsq) ;
wire(R.a.l,R.b.r,udsq) ;
\stopstaticMPfigure
\usestaticMPfigure[circ1]

\stoptext
-

SECOND EXAMPLE (In the first circuit are displayed the labels of the
second one and in the second only ?? are displayed)
-
\starttext

\startstaticMPfigure{circ1}
  input makecirc;
u:= 1cm ;
source.e((0,0u),DC,90,"\Delta V","2V") ;
resistor.a((2u,1u),normal,90,"R_1","1$\Omega$") ;
resistor.b((2u,-1u),normal,90,"R_2","2$\Omega$") ;
wire(S.e.p,R.a.r,udsq) ;
wire(S.e.n,R.b.l,udsq) ;
wire(R.a.l,R.b.r,udsq) ;
\stopstaticMPfigure
\usestaticMPfigure[circ1]

\startstaticMPfigure{circ2}
  input makecirc;
u:= 1cm ;
source.e((0,0u),DC,90,"\Delta V","4V") ;
resistor.a((2u,1u),normal,90,"R_3","3$\Omega$") ;
resistor.b((2u,-1u),normal,90,"R_4","4$\Omega$") ;
wire(S.e.p,R.a.r,udsq) ;
wire(S.e.n,R.b.l,udsq) ;
wire(R.a.l,R.b.r,udsq) ;
\stopstaticMPfigure
\usestaticMPfigure[circ2]

\stoptext


-- 
Andrea De Michele

___
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] *** Spam *** Drawing scaled externalfigure in Metapost produces erroneous size in the latest beta

2019-04-04 Thread Lutz Haseloff
Hi Thorsten,

I had the same problem a couple of months ago.
Use sized instead of scaled now.
The same goes for xscaled and yscaled.

Greetings Lutz

Am 4. April 2019 01:31:29 MESZ schrieb "Thorsten S." 
:
>Hello!
>
>The simple Metapost code that follows worked fine until upgrading to
>recent beta. I don't have a clue exactly when this behaviour was
>introduced since I switched just recently from the standard Texlive
>version available in Arch Linux.
>
>\starttext
>\startMPcode
>draw externalfigure "test.pdf" scaled 10mm;
>\stopMPcode
>\stoptext
>
>Now it produces a graphic with size of approximately 110 mm at least in
>my system with various test files which previously scaled just fine..
>Any help is greatly appreciated.
>
>-Thorsten S.
___
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] Drawing scaled externalfigure in Metapost produces erroneous size in the latest beta

2019-04-04 Thread Hans Hagen

On 4/4/2019 1:31 AM, Thorsten S. wrote:

Hello!

The simple Metapost code that follows worked fine until upgrading to 
recent beta. I don't have a clue exactly when this behaviour was 
introduced since I switched just recently from the standard Texlive 
version available in Arch Linux.


\starttext
\startMPcode
draw externalfigure "test.pdf" scaled 10mm;
\stopMPcode
\stoptext

Now it produces a graphic with size of approximately 110 mm at least in 
my system with various test files which previously scaled just fine.. 
Any help is greatly appreciated.
scaled scaled the original size ... long ago that was 1bp but for 
accuracy reasons that is no longer the case, just use:


draw externalfigure "test.pdf" xsized 10mm;

which in most cases is actually a better method than 'scaled'

Hans

-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
   tel: 038 477 53 69 | www.pragma-ade.nl | 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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


[NTG-context] Drawing scaled externalfigure in Metapost produces erroneous size in the latest beta

2019-04-04 Thread Thorsten S.
Hello!

The simple Metapost code that follows worked fine until upgrading to recent 
beta. I don't have a clue exactly when this behaviour was introduced since I 
switched just recently from the standard Texlive version available in Arch 
Linux.

\starttext
\startMPcode
draw externalfigure "test.pdf" scaled 10mm;
\stopMPcode
\stoptext

Now it produces a graphic with size of approximately 110 mm at least in my 
system with various test files which previously scaled just fine.. Any help is 
greatly appreciated.

-Thorsten S.___
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] Metapost graphic in setupbackground

2019-02-08 Thread Jan U. Hasecke
Thanks a lot Wolfgang and Marco. :-)

juh

Am 08.02.19 um 12:57 schrieb Wolfgang Schuster:
> 
> 
> Jan U. Hasecke schrieb am 08.02.19 um 12:36:
>> Hi all,
>>
>> I make my first steps with Metapost.
>>
>> I would like to set the background of all pages to a Metapost graphic.
>>
>> But only the first page has the defined background.
>>
>> I also tried with
>>
>> \startuseMPgraphic
>>
>> with no success
>>
>> --- mwe ---
>>
>> \startreusableMPgraphic{kreis}
>> draw fullcircle scaled 70mm withcolor red withpen pencircle scaled 6mm;
>> \stopreusableMPgraphic
>>
>> \definelayer[kreisbackground][width=70mm,height=70mm]
> 
> \definelayer[kreisbackground][state=repeat]
> 
> Wolfgang
> 

___
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] Metapost graphic in setupbackground

2019-02-08 Thread Wolfgang Schuster



Jan U. Hasecke schrieb am 08.02.19 um 12:36:

Hi all,

I make my first steps with Metapost.

I would like to set the background of all pages to a Metapost graphic.

But only the first page has the defined background.

I also tried with

\startuseMPgraphic

with no success

--- mwe ---

\startreusableMPgraphic{kreis}
draw fullcircle scaled 70mm withcolor red withpen pencircle scaled 6mm;
\stopreusableMPgraphic

\definelayer[kreisbackground][width=70mm,height=70mm]


\definelayer[kreisbackground][state=repeat]

Wolfgang

___
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] Metapost graphic in setupbackground

2019-02-08 Thread Marco Patzer
On Fri, 8 Feb 2019 12:36:16 +0100
"Jan U. Hasecke"  wrote:

> \definelayer[kreisbackground][width=70mm,height=70mm]

\definelayer[kreisbackground][width=70mm,height=70mm, state=repeat]

start: layer appears only on the current page
stop : layer doesn't show up
repeat   : layer prints on all pages
next : layer appears on the following page
continue : layer appears on all pages except the first

> \setupbackgrounds[paper][background=kreisbackground, state=start]

\setupbackgrounds[paper][background=kreisbackground]

Marco
___
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


[NTG-context] Metapost graphic in setupbackground

2019-02-08 Thread Jan U. Hasecke
Hi all,

I make my first steps with Metapost.

I would like to set the background of all pages to a Metapost graphic.

But only the first page has the defined background.

I also tried with

\startuseMPgraphic

with no success

--- mwe ---

\startreusableMPgraphic{kreis}
draw fullcircle scaled 70mm withcolor red withpen pencircle scaled 6mm;
\stopreusableMPgraphic

\definelayer[kreisbackground][width=70mm,height=70mm]

\setlayer[kreisbackground]
  [x=-3mm,y=-3mm]
  {\reuseMPgraphic{kreis}}

\setupbackgrounds[paper][background=kreisbackground, state=start]

\starttext

\input lorem

\page

\input lorem

\stoptext


TIA
juh
___
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] About the macro path intersectionpoint path with Metapost

2019-02-04 Thread Fabrice L
Hi,

I guess your problem is to find the two points of intersection between p
and r ? If so, the problem is that intersectionpoint does return the same
intersection when there is several, as it is the case here. So a quick
solution that you can do is to find intersections for the two part. A
drawing is simple than words ! here is the code to illustrate:

Happy drawing !
F.

\setupcolors[state=start]
\starttext
\startMPpage
  path p, q, r, b , u;
  p:= fullcircle scaled 6cm ;
  q:= fullcircle scaled 4cm shifted (2.5cm,2cm) ;
  r:= fullcircle scaled 4cm shifted (-2.5cm,2cm);
  b:= fullcircle scaled 2cm shifted (0,-3cm);
  pair A, B ;
  path rprime ;
  % Rprime is a a part of r (drawn in black to see it):
  rprime := r cutbefore point .5 along r;
  A:= p intersectionpoint r ;
  B:= p intersectionpoint rprime ;
  draw A withpen pencircle scaled .1in ;
  draw B withpen pencircle scaled .1in ;

  u:= A--B--cycle ;
  draw p withcolor green;
  draw q withcolor blue;
  draw rprime  withpen pencircle scaled .05in withcolor black;
  draw r withcolor red;
  draw b withcolor magenta;
  draw u numberstriped (.25,15,5) withcolor magenta ;
\stopMPpage
\stoptext


Le 3 février 2019 à 06:28:37, Fabrice Couvreur (fabrice1.couvr...@gmail.com)
a écrit:

Hi,
I would like to reproduce the attached figure. My problem is to create the
points of intersection between the circles. It seems that my approach is
not the right one.
Thank you.
Fabrice

\starttext
\startMPcode
  path p, q, r, b ;
  p:= fullcircle scaled 6cm ;
  q:= fullcircle scaled 4cm shifted (2.5cm,2cm) ;
  r:= fullcircle scaled 4cm shifted (-2.5cm,2cm);
  b:= fullcircle scaled 2cm shifted (0,-3cm);
  pair A, B ;
  A:= p intersectionpoint r ;
  B:= p intersectionpoint r ;
  path u ;
  u:= A--B--cycle ;
  draw p ;
  draw q ;
  draw r ;
  draw b ;
  draw u numberstriped (.25,15,5) withcolor magenta ;
\stopMPcode
\stoptext
___
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://context.aanhet.net
archive : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___
___
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] Show the letters of the alphabet with a loop (Metapost)

2019-02-04 Thread Fabrice Couvreur
Hi,
@ Henri Thank you
@ Alan How to use it in my code ?
Thank you
Fabrice

Le dim. 3 févr. 2019 à 21:26, Alan Braslau  a
écrit :

> On Mon, 4 Feb 2019 09:19:26 +1300
> Henri Menke  wrote:
>
> > Use the infont operator.
>
> Easier yet, the string can contain the font switch \bf:
>
> draw textext("\bf "(i)) ;
>
>
> ___
> 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://context.aanhet.net
> archive  : https://bitbucket.org/phg/context-mirror/commits/
> wiki : http://contextgarden.net
>
> ___
>
___
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] About the macro path intersectionpoint path with Metapost

2019-02-03 Thread Jeong Dal
Dear Fabrice,

Metapost is great for drawiang figures  but it is not easy for me  to use it.

>  b:= fullcircle scaled 2cm shifted (0,-3cm);
>  pair A, B ;
>  A:= p intersectionpoint r ;
>  B:= p intersectionpoint r ;
>  path u ;
>  u:= A--B--cycle ;

 A and B are the same point. One of “r” should be changed to “q” or “b”.
Then you can have a line.
I also made similar errors many times too.

Btw, is there any reason to add “—cycle”?

Enjoy the drawing.

Best regards,

Dalyoung
___
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] Show the letters of the alphabet with a loop (Metapost)

2019-02-03 Thread Alan Braslau
On Mon, 4 Feb 2019 09:19:26 +1300
Henri Menke  wrote:

> Use the infont operator.

Easier yet, the string can contain the font switch \bf:

draw textext("\bf "(i)) ;

___
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] Show the letters of the alphabet with a loop (Metapost)

2019-02-03 Thread Henri Menke
On 4/02/19 12:50 AM, Fabrice Couvreur wrote:
> Sorry Henri, but I still have a question : how to have the letters in bold
> type ?

Use the infont operator.  That info is a bit hidden in “2.10 Analyzing
pictures” of the MetaFun manual.

\starttext

\startMPcode
  for i=0 upto 3 :
  for j=0 upto 3 :
  draw unitsquare scaled 4cm shifted (4*i*cm,4*j*cm) ;
  endfor ;
  endfor ;
  for i=0 upto 4 :
  for j=0 upto 4 :
  label.llft(
  char(i*5+j+ASCII "A") infont "SerifBold*default",
  (4*i*cm,4*j*cm)
  ) withcolor white randomized (1,1,1) ;
  endfor ;
  endfor ;
\stopMPcode

\stoptext

> Thank you.
> Fabrice
> 
> Le dim. 3 févr. 2019 à 10:12, Fabrice Couvreur 
> a écrit :
> 
>> Hi Henry
>> Thank you for everything.
>> Fabrice
>>
>> Le sam. 2 févr. 2019 à 20:58, Henri Menke  a écrit :
>>
>>> On 2/2/19 11:49 PM, Fabrice Couvreur wrote:
 Hi Henri,
 Great ! I would also like these letters to be randomly colored.
>>>
>>> You should play with randomseed, the starting color (here white) and the
>>> randomization amplitude (1,1,1).  You mileage may vary.
>>>
>>> \starttext
>>>
>>> \startMPcode
>>>   for i=0 upto 3 :
>>>   for j=0 upto 3 :
>>>   draw unitsquare scaled 4cm shifted (4*i*cm,4*j*cm) ;
>>>   endfor ;
>>>   endfor ;
>>>   for i=0 upto 4 :
>>>   for j=0 upto 4 :
>>>   label.llft(char(i*5+j+ASCII "A"), (4*i*cm,4*j*cm))
>>>   withcolor white randomized (1,1,1) ;
>>>   endfor ;
>>>   endfor ;
>>> \stopMPcode
>>>
>>> \stoptext
>>>
 Thank you.
 Fabrice

 Le sam. 2 févr. 2019 à 11:16, Henri Menke  a
>>> écrit :

> On 2/2/19 10:47 PM, Fabrice Couvreur wrote:
>> The idea is to display the first 25 letters of the alphabet. The code
> below
>> shows the letter a to show what I want to do.
>> Thank you.
>> Fabrice
>
> Use char and ASCII.
>
> \starttext
>
> \startMPcode
>   for i=0 upto 3 :
>   for j=0 upto 3 :
>   draw unitsquare scaled 4cm shifted (4*i*cm,4*j*cm) ;
>   endfor ;
>   endfor ;
>   for i=0 upto 4 :
>   for j=0 upto 4 :
>   label.llft(char(i*5+j+ASCII "A"), (4*i*cm,4*j*cm)) ;
>   endfor ;
>   endfor ;
> \stopMPcode
>
> \stoptext
>
>>
>> \starttext
>>
>> \startMPcode
>>   for i=0 upto 3 :
>>   for j=0 upto 3 :
>>   draw unitsquare scaled 4cm shifted (4*i*cm,4*j*cm) ;
>>   endfor ;
>>   endfor ;
>>   for i=0 upto 4 :
>>   for j=0 upto 4 :
>>   label.llft("A", (4*i*cm,4*j*cm)) ;
>>   endfor ;
>>   endfor ;
>> \stopMPcode
>>
>> \stoptext
>>
>>
>>
>
>>> ___
>> 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://context.aanhet.net
>> archive  : https://bitbucket.org/phg/context-mirror/commits/
>> wiki : http://contextgarden.net
>>
>
>>> ___
>>
>
>
>
>>> ___
> 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://context.aanhet.net
> archive  : https://bitbucket.org/phg/context-mirror/commits/
> wiki : http://contextgarden.net
>
>
>>> ___
>



>>> ___
 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://context.aanhet.net
 archive  : https://bitbucket.org/phg/context-mirror/commits/
 wiki : http://contextgarden.net

>>> ___

>>>
>>>
>>> ___
>>> 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://context.aanhet.net
>>> archive  : https://bitbucket.org/phg/context-mirror/commits/
>>> wiki : http://contextgarden.net
>>>
>>> 

Re: [NTG-context] Show the letters of the alphabet with a loop (Metapost)

2019-02-03 Thread Fabrice Couvreur
Sorry Henri, but I still have a question : how to have the letters in bold
type ?
Thank you.
Fabrice

Le dim. 3 févr. 2019 à 10:12, Fabrice Couvreur 
a écrit :

> Hi Henry
> Thank you for everything.
> Fabrice
>
> Le sam. 2 févr. 2019 à 20:58, Henri Menke  a écrit :
>
>> On 2/2/19 11:49 PM, Fabrice Couvreur wrote:
>> > Hi Henri,
>> > Great ! I would also like these letters to be randomly colored.
>>
>> You should play with randomseed, the starting color (here white) and the
>> randomization amplitude (1,1,1).  You mileage may vary.
>>
>> \starttext
>>
>> \startMPcode
>>   for i=0 upto 3 :
>>   for j=0 upto 3 :
>>   draw unitsquare scaled 4cm shifted (4*i*cm,4*j*cm) ;
>>   endfor ;
>>   endfor ;
>>   for i=0 upto 4 :
>>   for j=0 upto 4 :
>>   label.llft(char(i*5+j+ASCII "A"), (4*i*cm,4*j*cm))
>>   withcolor white randomized (1,1,1) ;
>>   endfor ;
>>   endfor ;
>> \stopMPcode
>>
>> \stoptext
>>
>> > Thank you.
>> > Fabrice
>> >
>> > Le sam. 2 févr. 2019 à 11:16, Henri Menke  a
>> écrit :
>> >
>> >> On 2/2/19 10:47 PM, Fabrice Couvreur wrote:
>> >> > The idea is to display the first 25 letters of the alphabet. The code
>> >> below
>> >> > shows the letter a to show what I want to do.
>> >> > Thank you.
>> >> > Fabrice
>> >>
>> >> Use char and ASCII.
>> >>
>> >> \starttext
>> >>
>> >> \startMPcode
>> >>   for i=0 upto 3 :
>> >>   for j=0 upto 3 :
>> >>   draw unitsquare scaled 4cm shifted (4*i*cm,4*j*cm) ;
>> >>   endfor ;
>> >>   endfor ;
>> >>   for i=0 upto 4 :
>> >>   for j=0 upto 4 :
>> >>   label.llft(char(i*5+j+ASCII "A"), (4*i*cm,4*j*cm)) ;
>> >>   endfor ;
>> >>   endfor ;
>> >> \stopMPcode
>> >>
>> >> \stoptext
>> >>
>> >> >
>> >> > \starttext
>> >> >
>> >> > \startMPcode
>> >> >   for i=0 upto 3 :
>> >> >   for j=0 upto 3 :
>> >> >   draw unitsquare scaled 4cm shifted (4*i*cm,4*j*cm) ;
>> >> >   endfor ;
>> >> >   endfor ;
>> >> >   for i=0 upto 4 :
>> >> >   for j=0 upto 4 :
>> >> >   label.llft("A", (4*i*cm,4*j*cm)) ;
>> >> >   endfor ;
>> >> >   endfor ;
>> >> > \stopMPcode
>> >> >
>> >> > \stoptext
>> >> >
>> >> >
>> >> >
>> >>
>> ___
>> >> > 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://context.aanhet.net
>> >> > archive  : https://bitbucket.org/phg/context-mirror/commits/
>> >> > wiki : http://contextgarden.net
>> >> >
>> >>
>> ___
>> >> >
>> >>
>> >>
>> >>
>> ___
>> >> 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://context.aanhet.net
>> >> archive  : https://bitbucket.org/phg/context-mirror/commits/
>> >> wiki : http://contextgarden.net
>> >>
>> >>
>> ___
>> >>
>> >
>> >
>> >
>> ___
>> > 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://context.aanhet.net
>> > archive  : https://bitbucket.org/phg/context-mirror/commits/
>> > wiki : http://contextgarden.net
>> >
>> ___
>> >
>>
>>
>> ___
>> 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://context.aanhet.net
>> archive  : https://bitbucket.org/phg/context-mirror/commits/
>> wiki : http://contextgarden.net
>>
>> ___
>>
>
___
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


[NTG-context] About the macro path intersectionpoint path with Metapost

2019-02-03 Thread Fabrice Couvreur
Hi,
I would like to reproduce the attached figure. My problem is to create the
points of intersection between the circles. It seems that my approach is
not the right one.
Thank you.
Fabrice

\starttext
\startMPcode
  path p, q, r, b ;
  p:= fullcircle scaled 6cm ;
  q:= fullcircle scaled 4cm shifted (2.5cm,2cm) ;
  r:= fullcircle scaled 4cm shifted (-2.5cm,2cm);
  b:= fullcircle scaled 2cm shifted (0,-3cm);
  pair A, B ;
  A:= p intersectionpoint r ;
  B:= p intersectionpoint r ;
  path u ;
  u:= A--B--cycle ;
  draw p ;
  draw q ;
  draw r ;
  draw b ;
  draw u numberstriped (.25,15,5) withcolor magenta ;
\stopMPcode
\stoptext
___
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] Show the letters of the alphabet with a loop (Metapost)

2019-02-03 Thread Fabrice Couvreur
Hi Henry
Thank you for everything.
Fabrice

Le sam. 2 févr. 2019 à 20:58, Henri Menke  a écrit :

> On 2/2/19 11:49 PM, Fabrice Couvreur wrote:
> > Hi Henri,
> > Great ! I would also like these letters to be randomly colored.
>
> You should play with randomseed, the starting color (here white) and the
> randomization amplitude (1,1,1).  You mileage may vary.
>
> \starttext
>
> \startMPcode
>   for i=0 upto 3 :
>   for j=0 upto 3 :
>   draw unitsquare scaled 4cm shifted (4*i*cm,4*j*cm) ;
>   endfor ;
>   endfor ;
>   for i=0 upto 4 :
>   for j=0 upto 4 :
>   label.llft(char(i*5+j+ASCII "A"), (4*i*cm,4*j*cm))
>   withcolor white randomized (1,1,1) ;
>   endfor ;
>   endfor ;
> \stopMPcode
>
> \stoptext
>
> > Thank you.
> > Fabrice
> >
> > Le sam. 2 févr. 2019 à 11:16, Henri Menke  a
> écrit :
> >
> >> On 2/2/19 10:47 PM, Fabrice Couvreur wrote:
> >> > The idea is to display the first 25 letters of the alphabet. The code
> >> below
> >> > shows the letter a to show what I want to do.
> >> > Thank you.
> >> > Fabrice
> >>
> >> Use char and ASCII.
> >>
> >> \starttext
> >>
> >> \startMPcode
> >>   for i=0 upto 3 :
> >>   for j=0 upto 3 :
> >>   draw unitsquare scaled 4cm shifted (4*i*cm,4*j*cm) ;
> >>   endfor ;
> >>   endfor ;
> >>   for i=0 upto 4 :
> >>   for j=0 upto 4 :
> >>   label.llft(char(i*5+j+ASCII "A"), (4*i*cm,4*j*cm)) ;
> >>   endfor ;
> >>   endfor ;
> >> \stopMPcode
> >>
> >> \stoptext
> >>
> >> >
> >> > \starttext
> >> >
> >> > \startMPcode
> >> >   for i=0 upto 3 :
> >> >   for j=0 upto 3 :
> >> >   draw unitsquare scaled 4cm shifted (4*i*cm,4*j*cm) ;
> >> >   endfor ;
> >> >   endfor ;
> >> >   for i=0 upto 4 :
> >> >   for j=0 upto 4 :
> >> >   label.llft("A", (4*i*cm,4*j*cm)) ;
> >> >   endfor ;
> >> >   endfor ;
> >> > \stopMPcode
> >> >
> >> > \stoptext
> >> >
> >> >
> >> >
> >>
> ___
> >> > 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://context.aanhet.net
> >> > archive  : https://bitbucket.org/phg/context-mirror/commits/
> >> > wiki : http://contextgarden.net
> >> >
> >>
> ___
> >> >
> >>
> >>
> >>
> ___
> >> 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://context.aanhet.net
> >> archive  : https://bitbucket.org/phg/context-mirror/commits/
> >> wiki : http://contextgarden.net
> >>
> >>
> ___
> >>
> >
> >
> >
> ___
> > 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://context.aanhet.net
> > archive  : https://bitbucket.org/phg/context-mirror/commits/
> > wiki : http://contextgarden.net
> >
> ___
> >
>
>
> ___
> 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://context.aanhet.net
> archive  : https://bitbucket.org/phg/context-mirror/commits/
> wiki : http://contextgarden.net
>
> ___
>
___
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] Show the letters of the alphabet with a loop (Metapost)

2019-02-02 Thread Henri Menke
On 2/2/19 11:49 PM, Fabrice Couvreur wrote:
> Hi Henri,
> Great ! I would also like these letters to be randomly colored.

You should play with randomseed, the starting color (here white) and the
randomization amplitude (1,1,1).  You mileage may vary.

\starttext

\startMPcode
  for i=0 upto 3 :
  for j=0 upto 3 :
  draw unitsquare scaled 4cm shifted (4*i*cm,4*j*cm) ;
  endfor ;
  endfor ;
  for i=0 upto 4 :
  for j=0 upto 4 :
  label.llft(char(i*5+j+ASCII "A"), (4*i*cm,4*j*cm))
  withcolor white randomized (1,1,1) ;
  endfor ;
  endfor ;
\stopMPcode

\stoptext

> Thank you.
> Fabrice
> 
> Le sam. 2 févr. 2019 à 11:16, Henri Menke  a écrit :
> 
>> On 2/2/19 10:47 PM, Fabrice Couvreur wrote:
>> > The idea is to display the first 25 letters of the alphabet. The code
>> below
>> > shows the letter a to show what I want to do.
>> > Thank you.
>> > Fabrice
>>
>> Use char and ASCII.
>>
>> \starttext
>>
>> \startMPcode
>>   for i=0 upto 3 :
>>   for j=0 upto 3 :
>>   draw unitsquare scaled 4cm shifted (4*i*cm,4*j*cm) ;
>>   endfor ;
>>   endfor ;
>>   for i=0 upto 4 :
>>   for j=0 upto 4 :
>>   label.llft(char(i*5+j+ASCII "A"), (4*i*cm,4*j*cm)) ;
>>   endfor ;
>>   endfor ;
>> \stopMPcode
>>
>> \stoptext
>>
>> >
>> > \starttext
>> >
>> > \startMPcode
>> >   for i=0 upto 3 :
>> >   for j=0 upto 3 :
>> >   draw unitsquare scaled 4cm shifted (4*i*cm,4*j*cm) ;
>> >   endfor ;
>> >   endfor ;
>> >   for i=0 upto 4 :
>> >   for j=0 upto 4 :
>> >   label.llft("A", (4*i*cm,4*j*cm)) ;
>> >   endfor ;
>> >   endfor ;
>> > \stopMPcode
>> >
>> > \stoptext
>> >
>> >
>> >
>> ___
>> > 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://context.aanhet.net
>> > archive  : https://bitbucket.org/phg/context-mirror/commits/
>> > wiki : http://contextgarden.net
>> >
>> ___
>> >
>>
>>
>> ___
>> 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://context.aanhet.net
>> archive  : https://bitbucket.org/phg/context-mirror/commits/
>> wiki : http://contextgarden.net
>>
>> ___
>>
> 
> 
> ___
> 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://context.aanhet.net
> archive  : https://bitbucket.org/phg/context-mirror/commits/
> wiki : http://contextgarden.net
> ___
> 

___
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] Show the letters of the alphabet with a loop (Metapost)

2019-02-02 Thread Fabrice Couvreur
Hi Henri,
Great ! I would also like these letters to be randomly colored.
Thank you.
Fabrice

Le sam. 2 févr. 2019 à 11:16, Henri Menke  a écrit :

> On 2/2/19 10:47 PM, Fabrice Couvreur wrote:
> > The idea is to display the first 25 letters of the alphabet. The code
> below
> > shows the letter a to show what I want to do.
> > Thank you.
> > Fabrice
>
> Use char and ASCII.
>
> \starttext
>
> \startMPcode
>   for i=0 upto 3 :
>   for j=0 upto 3 :
>   draw unitsquare scaled 4cm shifted (4*i*cm,4*j*cm) ;
>   endfor ;
>   endfor ;
>   for i=0 upto 4 :
>   for j=0 upto 4 :
>   label.llft(char(i*5+j+ASCII "A"), (4*i*cm,4*j*cm)) ;
>   endfor ;
>   endfor ;
> \stopMPcode
>
> \stoptext
>
> >
> > \starttext
> >
> > \startMPcode
> >   for i=0 upto 3 :
> >   for j=0 upto 3 :
> >   draw unitsquare scaled 4cm shifted (4*i*cm,4*j*cm) ;
> >   endfor ;
> >   endfor ;
> >   for i=0 upto 4 :
> >   for j=0 upto 4 :
> >   label.llft("A", (4*i*cm,4*j*cm)) ;
> >   endfor ;
> >   endfor ;
> > \stopMPcode
> >
> > \stoptext
> >
> >
> >
> ___
> > 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://context.aanhet.net
> > archive  : https://bitbucket.org/phg/context-mirror/commits/
> > wiki : http://contextgarden.net
> >
> ___
> >
>
>
> ___
> 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://context.aanhet.net
> archive  : https://bitbucket.org/phg/context-mirror/commits/
> wiki : http://contextgarden.net
>
> ___
>
___
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] Show the letters of the alphabet with a loop (Metapost)

2019-02-02 Thread Henri Menke
On 2/2/19 10:47 PM, Fabrice Couvreur wrote:
> The idea is to display the first 25 letters of the alphabet. The code below
> shows the letter a to show what I want to do.
> Thank you.
> Fabrice

Use char and ASCII.

\starttext

\startMPcode
  for i=0 upto 3 :
  for j=0 upto 3 :
  draw unitsquare scaled 4cm shifted (4*i*cm,4*j*cm) ;
  endfor ;
  endfor ;
  for i=0 upto 4 :
  for j=0 upto 4 :
  label.llft(char(i*5+j+ASCII "A"), (4*i*cm,4*j*cm)) ;
  endfor ;
  endfor ;
\stopMPcode

\stoptext

> 
> \starttext
> 
> \startMPcode
>   for i=0 upto 3 :
>   for j=0 upto 3 :
>   draw unitsquare scaled 4cm shifted (4*i*cm,4*j*cm) ;
>   endfor ;
>   endfor ;
>   for i=0 upto 4 :
>   for j=0 upto 4 :
>   label.llft("A", (4*i*cm,4*j*cm)) ;
>   endfor ;
>   endfor ;
> \stopMPcode
> 
> \stoptext
> 
> 
> ___
> 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://context.aanhet.net
> archive  : https://bitbucket.org/phg/context-mirror/commits/
> wiki : http://contextgarden.net
> ___
> 

___
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


<    1   2   3   4   5   6   7   8   9   10   >