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 "&char(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 "&char(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
___


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

2019-02-02 Thread Fabrice Couvreur
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

\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
___


Re: [NTG-context] ! Declared variable conflicts with previous vardef [Metapost]

2019-01-03 Thread Taco Hoekwater
Hi,



> On 3 Jan 2019, at 11:31, Fabrice Couvreur  wrote:
> 
> Hi,
> It is true that Alan has already answered this question but I was misled 
> because the file that I compiled without problem is this one, even leaving 
> pair z[ ] (I can think that it is because of this instruction   z := point 
> 3.6 of p ;)

It works because of the "pair z” statement. Attempted explanation:


Metapost variable names are built up hierarchically. When you
say “path p” or “color V.Q” or “numeric z[]” or “vardef z”, it 
changes the type of just the last segment, not other segments
(not even the immediately preceding one).

Note that in the case of z[], the last variable segment is the 
common subscript [] not the ‘alphabetical segment’ “z”. 

It is actually OK to say e,g, 

pair z ; 
color z[];
numeric z[].a;
z := point 3.6 of p ;
z[1] := red;
path z[]; % z[1] is now undefined again after this line,
  % but z[].a is still numeric
z[3] = unitsquare;
z[2].a = 5;

Redeclaration of intermediate segments works for all declarations except 
for ‘vardef’. The reason behind this is that vardefs can have suffixes, 
and metapost does not really differentiate between vardefs defined with
and without suffixes (except when called). Of course actual suffixes 
would interfere with the parsing of any potentially following name 
segments, which is why re-declarations ‘below’ a vardef’d segment are 
illegal.

I hope that makes sense, it is not the easiest thing to explain.

Best wishes,
Taco 


> 
> \starttext
> \startMPpage[offset=2pt]
>  path p, q, r, b ; pair z ;
>  p := unitsquare scaled 4cm ;
>  z := point 3.6 of p ;
>  q := z--urcorner p ;
>  r := z--urcorner p-- reverse bottomboundary p--cycle ;
>  b := reverse bottomboundary p ; 
>  %r := q -- reverse bottomboundary p -- cycle ; definition of Hans
>  draw b--q withpen pencircle scaled 1mm withcolor red ;
>  draw p ;
>  draw r numberstriped (.25,10,5) withcolor magenta ;
>  label.llft("B", p) ;
>  label.lrt("C", p) ;
>  label.ulft("A", p) ;
>  label.urt("D", p) ;
>  label.lft("M", p) ;
> \stopMPpage
> \startMPpage[offset=2pt]
>   defaultfont := "texgyrepagella-regular*default" ;
>   defaultscale :=0.8 ;
>   path p, q, r, b ; pair z[];
>   p  := unitsquare xyscaled (9cm,5cm) ;
>   z[0] = (2cm,0cm) ;
>   z[1] = (2cm,2cm) ;
>   z[2] = (0cm,2cm) ;
>   q := llcorner p--z[0]--z[1]--z[2]--cycle ;
>   r := unitsquare xyscaled (7cm,3cm) shifted(2cm,2cm) ;
>   b := z[2]--z[1]--ulcorner r--urcorner p--lrcorner r--z[1]--z[0]--llcorner 
> p--cycle ;
>   draw p ;
>   draw b numberstriped (.25,15,5) withcolor magenta ;
>   label.llft("A", p) ;
>   label.lrt("D", p) ;
>   label.ulft("C", p) ;
>   label.urt("B", p) ;
>   label.lft("M", z[2]) ;
>   label.ulft("N", z[1]) ;
>   label.bot("P", z[0]) ;
>   label.top("J", ulcorner r) ;
>   label.rt("I", lrcorner r) ;
>   label.bot(btex $x$ etex,(llcorner p+z[0])/2);
>   label.lft(btex $x$ etex,(llcorner p+z[2])/2);
> \stopMPpage
>
> \stoptext
> 
> Le jeu. 3 janv. 2019 à 07:12, Alan Braslau  a écrit 
> :
> On Thu, 3 Jan 2019 16:22:06 +1300 (UTC)
> Henri Menke  wrote:
> 
> > z is a MetaPost intrinsic, something along the lines of
> > 
> > vardef z@#=(x@#,y@#) enddef;
> > 
> > so you can't use the same name for a pair.  Actually you can simply
> > delete the declaration
> > 
> >pair z[];
> 
> I had already told Fabrice this a couple of days ago...
> 
> 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
> ___
> ___
> 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] ! Declared variable conflicts with previous vardef [Metapost]

2019-01-03 Thread Fabrice Couvreur
Hi,
It is true that Alan has already answered this question but I was misled
because the file that I compiled without problem is this one, even leaving
pair z[ ] (I can think that it is because of this instruction   z := point
3.6 of p ;)

\starttext
\startMPpage[offset=2pt]
 path p, q, r, b ; pair z ;
 p := unitsquare scaled 4cm ;
* z := point 3.6 of p ;*
 q := z--urcorner p ;
 r := z--urcorner p-- reverse bottomboundary p--cycle ;
 b := reverse bottomboundary p ;
 %r := q -- reverse bottomboundary p -- cycle ; definition of Hans
 draw b--q withpen pencircle scaled 1mm withcolor red ;
 draw p ;
 draw r numberstriped (.25,10,5) withcolor magenta ;
 label.llft("B", p) ;
 label.lrt("C", p) ;
 label.ulft("A", p) ;
 label.urt("D", p) ;
 label.lft("M", p) ;
\stopMPpage
\startMPpage[offset=2pt]
  defaultfont := "texgyrepagella-regular*default" ;
  defaultscale :=0.8 ;
  path p, q, r, b ;* pair z[];*
  p  := unitsquare xyscaled (9cm,5cm) ;
  z[0] = (2cm,0cm) ;
  z[1] = (2cm,2cm) ;
  z[2] = (0cm,2cm) ;
  q := llcorner p--z[0]--z[1]--z[2]--cycle ;
  r := unitsquare xyscaled (7cm,3cm) shifted(2cm,2cm) ;
  b := z[2]--z[1]--ulcorner r--urcorner p--lrcorner r--z[1]--z[0]--llcorner
p--cycle ;
  draw p ;
  draw b numberstriped (.25,15,5) withcolor magenta ;
  label.llft("A", p) ;
  label.lrt("D", p) ;
  label.ulft("C", p) ;
  label.urt("B", p) ;
  label.lft("M", z[2]) ;
  label.ulft("N", z[1]) ;
  label.bot("P", z[0]) ;
  label.top("J", ulcorner r) ;
  label.rt("I", lrcorner r) ;
  label.bot(btex $x$ etex,(llcorner p+z[0])/2);
  label.lft(btex $x$ etex,(llcorner p+z[2])/2);
\stopMPpage

\stoptext

Le jeu. 3 janv. 2019 à 07:12, Alan Braslau  a
écrit :

> On Thu, 3 Jan 2019 16:22:06 +1300 (UTC)
> Henri Menke  wrote:
>
> > z is a MetaPost intrinsic, something along the lines of
> >
> > vardef z@#=(x@#,y@#) enddef;
> >
> > so you can't use the same name for a pair.  Actually you can simply
> > delete the declaration
> >
> >pair z[];
>
> I had already told Fabrice this a couple of days ago...
>
> 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
>
> ___
___
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] ! Declared variable conflicts with previous vardef [Metapost]

2019-01-02 Thread Alan Braslau
On Thu, 3 Jan 2019 16:22:06 +1300 (UTC)
Henri Menke  wrote:

> z is a MetaPost intrinsic, something along the lines of
> 
> vardef z@#=(x@#,y@#) enddef;
> 
> so you can't use the same name for a pair.  Actually you can simply
> delete the declaration
> 
>pair z[];

I had already told Fabrice this a couple of days ago...

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] ! Declared variable conflicts with previous vardef [Metapost]

2019-01-02 Thread Henri Menke
z is a MetaPost intrinsic, something along the lines of

vardef z@#=(x@#,y@#) enddef;

so you can't use the same name for a pair.  Actually you can simply
delete the declaration

   pair z[];

from your file and it will work as intended.  If you insist on using
your own declaration of z, then you have to stash away MetaPost's
definition using

   save z; pair z[];

I recommend the former, just delete pair z[];

On 3/01/19 2:43 PM, Fabrice Couvreur wrote:
> Hi,
> I have a problem compiling this file.
> Thanks.
> Fabrice
> 
> ## test file 
> \starttext
> \setupbodyfont [pagella,9pt]
> \startMPpage[offset=2pt]
>   path p, q, r, b ; pair z[];
>   p  := unitsquare xyscaled (9cm,5cm) ;
>   z[0] = (2cm,0cm) ;
>   z[1] = (2cm,2cm) ;
>   z[2] = (0cm,2cm) ;
>   q := llcorner p--z[0]--z[1]--z[2]--cycle ;
>   r := unitsquare xyscaled (7cm,3cm) shifted(2cm,2cm) ;
>   b := z[2]--z[1]--ulcorner r--urcorner p--lrcorner r--z[1]--z[0]--llcorner
> p--cycle ;
>   draw p ;
>   draw b numberstriped (.25,15,5) withcolor magenta ;
>   label.llft("A", p) ;
>   label.lrt("D", p) ;
>   label.ulft("C", p) ;
>   label.urt("B", p) ;
>   label.lft("M", z[2]) ;
>   label.ulft("N", z[1]) ;
>   label.bot("P", z[0]) ;
>   label.top("J", ulcorner r) ;
>   label.rt("I", lrcorner r) ;
>   label.bot(btex $x$ etex,(llcorner p+z[0])/2);
>   label.lft(btex $x$ etex,(llcorner p+z[2])/2);
> \stopMPpage
> 
> \stoptext
> #
> ! Declared variable conflicts with previous vardef.
> 
> ;
> <*> path p, q, r, b ; pair z[] ;
> z[0] = (2cm,0cm) ; z[1] = (2cm,2cm) ; z[2] ...
> You can't use, e.g., `numeric foo[]' after `vardef foo'.
> Proceed, and I'll ignore the illegal redeclaration.
> 
> 
> ___
> 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] ! Declared variable conflicts with previous vardef [Metapost]

2019-01-02 Thread Fabrice Couvreur
Hi,
I have a problem compiling this file.
Thanks.
Fabrice

## test file 
\starttext
\setupbodyfont [pagella,9pt]
\startMPpage[offset=2pt]
  path p, q, r, b ; pair z[];
  p  := unitsquare xyscaled (9cm,5cm) ;
  z[0] = (2cm,0cm) ;
  z[1] = (2cm,2cm) ;
  z[2] = (0cm,2cm) ;
  q := llcorner p--z[0]--z[1]--z[2]--cycle ;
  r := unitsquare xyscaled (7cm,3cm) shifted(2cm,2cm) ;
  b := z[2]--z[1]--ulcorner r--urcorner p--lrcorner r--z[1]--z[0]--llcorner
p--cycle ;
  draw p ;
  draw b numberstriped (.25,15,5) withcolor magenta ;
  label.llft("A", p) ;
  label.lrt("D", p) ;
  label.ulft("C", p) ;
  label.urt("B", p) ;
  label.lft("M", z[2]) ;
  label.ulft("N", z[1]) ;
  label.bot("P", z[0]) ;
  label.top("J", ulcorner r) ;
  label.rt("I", lrcorner r) ;
  label.bot(btex $x$ etex,(llcorner p+z[0])/2);
  label.lft(btex $x$ etex,(llcorner p+z[2])/2);
\stopMPpage

\stoptext
#
! Declared variable conflicts with previous vardef.

;
<*> path p, q, r, b ; pair z[] ;
z[0] = (2cm,0cm) ; z[1] = (2cm,2cm) ; z[2] ...
You can't use, e.g., `numeric foo[]' after `vardef foo'.
Proceed, and I'll ignore the illegal redeclaration.
___
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] Question about defining a path with Metapost

2018-12-20 Thread Alan Braslau
On Fri, 21 Dec 2018 00:17:25 +0100
Fabrice Couvreur  wrote:

> Why does the definition of the r path that Hans proposed give the
> same result as what I propose ?

Look at the definition of bottomboundary in mp-tool.mpiv
Use whatever you prefer.

You might also be interested in the modification that I added to
label:

label.llft("B", p) ;
label.lrt ("C", p) ;

etc.

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
___

[NTG-context] Question about defining a path with Metapost

2018-12-20 Thread Fabrice Couvreur
Hi,
I need to make a figure with shaded areas and I found this code proposed by
Hans. Why does the definition of the r path that Hans proposed give the
same result as what I propose ?
Thank you.
Fabrice

\starttext
\startMPpage[offset=2pt]
 path p, q, r ; pair z ;
 p := unitsquare scaled 4cm ;
 z := point 3.6 of p ;
 q := z--urcorner p ;
 r := z--urcorner p--lrcorner p--llcorner p--cycle ;
  %r := q -- reverse bottomboundary p -- cycle ; definition of Hans
 draw p ;
 draw r numberstriped (.25,10,5) withcolor magenta ;
 draw thetextext.llft("B", llcorner p) ;
 draw thetextext.lrt ("C", lrcorner p) ;
 draw thetextext.ulft("A", ulcorner p) ;
 draw thetextext.urt ("D", urcorner p) ;
 draw thetextext.lft ("M", z) ;
\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] Scale image in MetaPost, maintaining aspect ratio

2018-07-08 Thread Alan Braslau
On Sun, 8 Jul 2018 11:21:55 +0200
Hans Hagen  wrote:

> the "externalfigure" variant is an old one that had to deal with 
> dimensions in a way that avoids overflows
> 
> in a future context (read luatex 1.09+) we go one-pass-mp so we can
> have a different approach (i never wanted to add a ton of code for
> images) so there externalfigure will scale proportionally too

ConTeXt running on the luatex experimental branch under development
indeed works with one-pass-MP calculations as opposed to the two-pass
mechanism that is standard today. For documents with extensive and
complicated MP graphics, this yields a huge gain. Hans is at present
working out all side-effects (such as recursive MP/TeX/lua calls) and is
cleaning up some old ways of doing things that date from mkii. This
might seem somewhat minor but is really exciting for those who use a
lot of graphics and MetaPost effects.

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] Scale image in MetaPost, maintaining aspect ratio

2018-07-08 Thread Hans Hagen

On 7/8/2018 11:02 AM, Marco Patzer wrote:

On Sun, 8 Jul 2018 10:39:52 +0200
Hans Hagen  wrote:


On 7/8/2018 1:45 AM, Marco Patzer wrote:

On Sat, 7 Jul 2018 14:27:38 -0600
Alan Braslau  wrote:
   

For "historic" reasons,
  draw externalfigure "cow" scaled 5cm ;
normalizes the figure to a square. This will not be changed as it
is a very old feature of MetaFun.

The solution is
  draw rawtextext("\externalfigure[cow]") xsized 5cm ;
where one can use xsized, ysized or xysized (taking a pair).


That works indeed. Thanks.

draw figure "" ...


That's what I was looking for. Thanks.
the "externalfigure" variant is an old one that had to deal with 
dimensions in a way that avoids overflows


in a future context (read luatex 1.09+) we go one-pass-mp so we can have 
a different approach (i never wanted to add a ton of code for images) so 
there externalfigure will scale proportionally too


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] Scale image in MetaPost, maintaining aspect ratio

2018-07-08 Thread Marco Patzer
On Sun, 8 Jul 2018 10:39:52 +0200
Hans Hagen  wrote:

> On 7/8/2018 1:45 AM, Marco Patzer wrote:
> > On Sat, 7 Jul 2018 14:27:38 -0600
> > Alan Braslau  wrote:
> >   
> >> For "historic" reasons,
> >>  draw externalfigure "cow" scaled 5cm ;
> >> normalizes the figure to a square. This will not be changed as it
> >> is a very old feature of MetaFun.
> >>
> >> The solution is
> >>  draw rawtextext("\externalfigure[cow]") xsized 5cm ;
> >> where one can use xsized, ysized or xysized (taking a pair).  
> > 
> > That works indeed. Thanks.  
> draw figure "" ...

That's what I was looking for. Thanks.

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
___

Re: [NTG-context] Scale image in MetaPost, maintaining aspect ratio

2018-07-08 Thread Hans Hagen

On 7/8/2018 1:45 AM, Marco Patzer wrote:

On Sat, 7 Jul 2018 14:27:38 -0600
Alan Braslau  wrote:


For "historic" reasons,
 draw externalfigure "cow" scaled 5cm ;
normalizes the figure to a square. This will not be changed as it is a
very old feature of MetaFun.

The solution is
 draw rawtextext("\externalfigure[cow]") xsized 5cm ;
where one can use xsized, ysized or xysized (taking a pair).


That works indeed. Thanks.

draw figure "" ...



-
  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] Scale image in MetaPost, maintaining aspect ratio

2018-07-07 Thread Marco Patzer
On Sat, 7 Jul 2018 14:27:38 -0600
Alan Braslau  wrote:

> For "historic" reasons,
> draw externalfigure "cow" scaled 5cm ;
> normalizes the figure to a square. This will not be changed as it is a
> very old feature of MetaFun.
> 
> The solution is
> draw rawtextext("\externalfigure[cow]") xsized 5cm ;
> where one can use xsized, ysized or xysized (taking a pair).

That works indeed. Thanks.

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
___

Re: [NTG-context] Scale image in MetaPost, maintaining aspect ratio

2018-07-07 Thread Marco Patzer
On Sat, 7 Jul 2018 22:27:51 +0200
Hans Hagen  wrote:

> On 7/7/2018 8:58 PM, Marco Patzer wrote:
> > Hi!
> > 
> > How to scale an image in MetaPost, maintaining the aspect ratio
> > (without specifying the height explicitly)?
> > 
> > Example:
> > 
> > \setupexternalfigures [location=default]
> > \starttext
> >\externalfigure [cow][width=5cm]
> > 
> >\startMPcode
> >  draw externalfigure "cow" scaled 5cm;
> >\stopMPcode
> > \stoptext
> it's all in the metafun manual

No doubts about that. It's more a matter of knowing what to search
for.

> xsized 5cm

I tried it, same result - square image:

  draw externalfigure "cow" xsized 5cm;

As Alan mentioned including the image with textext() works. Not as
elegant, but it gets the job done.

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
___

Re: [NTG-context] Scale image in MetaPost, maintaining aspect ratio

2018-07-07 Thread Hans Hagen

On 7/7/2018 8:58 PM, Marco Patzer wrote:

Hi!

How to scale an image in MetaPost, maintaining the aspect ratio
(without specifying the height explicitly)?

Example:

\setupexternalfigures [location=default]
\starttext
   \externalfigure [cow][width=5cm]

   \startMPcode
 draw externalfigure "cow" scaled 5cm;
   \stopMPcode
\stoptext

it's all in the metafun manual

xsized 5cm

-
  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] Scale image in MetaPost, maintaining aspect ratio

2018-07-07 Thread Alan Braslau
On Sat, 7 Jul 2018 20:58:40 +0200
Marco Patzer  wrote:

> Hi!
> 
> How to scale an image in MetaPost, maintaining the aspect ratio
> (without specifying the height explicitly)?
> 
> Example:
> 
> \setupexternalfigures [location=default]
> \starttext
>   \externalfigure [cow][width=5cm]
> 
>   \startMPcode
> draw externalfigure "cow" scaled 5cm;
>   \stopMPcode
> \stoptext

For "historic" reasons,
draw externalfigure "cow" scaled 5cm ;
normalizes the figure to a square. This will not be changed as it is a
very old feature of MetaFun.

The solution is
draw rawtextext("\externalfigure[cow]") xsized 5cm ;
where one can use xsized, ysized or xysized (taking a pair).

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
___

[NTG-context] Scale image in MetaPost, maintaining aspect ratio

2018-07-07 Thread Marco Patzer
Hi!

How to scale an image in MetaPost, maintaining the aspect ratio
(without specifying the height explicitly)?

Example:

\setupexternalfigures [location=default]
\starttext
  \externalfigure [cow][width=5cm]

  \startMPcode
draw externalfigure "cow" scaled 5cm;
  \stopMPcode
\stoptext

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
___

Re: [NTG-context] MetaPost shading broken with latest beta

2018-06-24 Thread Hans Hagen

On 6/24/2018 12:17 AM, Adam Reviczky wrote:

Hi,

Using the shading function in a metapost image the whole page is
filled in instead of the figure that defines it.

Minimal example as from the metafun manual 8.3.3
(http://www.pragma-ade.nl/general/manuals/metafun-p.pdf):
\starttext
\startMPcode
fill fullsquare xyscaled (1cm,1cm)
withshademethod "linear"
withshadevector (1,0)
withshadecolors (darkred,darkgreen)
;
\stopMPcode
\stoptext

ConTeXt  ver: 2018.06.23 12:12 MKIV beta  fmt: 2018.6.23  int: english/english
luatex version 1.09 with functionality level 6823,
MetaPost 2.00

With this, I get a full A4 page with the shading colors.
This worked until the beta 2018-06-22 16:02 and the desired output is
shown when using live.contextgarden.net.
fixed a next beta ... this relates to the context mp inclusion handler 
now following a one-pass approach (again experimental and only > 1.08)


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] MetaPost shading broken with latest beta

2018-06-23 Thread Akira Kakuto

With this, I get a full A4 page with the shading colors.
This worked until the beta 2018-06-22 16:02 and the desired output is
shown when using live.contextgarden.net.


Even in the previous
mtx-context | current version: 2018.06.22 15:55
I get a full A4 page with the shading colors if I use
Luatex 1.09.0
Development id: 6823

The desired output is obtained if I use
Luatex 1.08.0
Development id: 6731

So I think the latest experimental binary is problematic
in this example.

Best,
Akira

___
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 shading broken with latest beta

2018-06-23 Thread Adam Reviczky
Hi,

Using the shading function in a metapost image the whole page is
filled in instead of the figure that defines it.

Minimal example as from the metafun manual 8.3.3
(http://www.pragma-ade.nl/general/manuals/metafun-p.pdf):
\starttext
\startMPcode
fill fullsquare xyscaled (1cm,1cm)
withshademethod "linear"
withshadevector (1,0)
withshadecolors (darkred,darkgreen)
;
\stopMPcode
\stoptext

ConTeXt  ver: 2018.06.23 12:12 MKIV beta  fmt: 2018.6.23  int: english/english
luatex version 1.09 with functionality level 6823,
MetaPost 2.00

With this, I get a full A4 page with the shading colors.
This worked until the beta 2018-06-22 16:02 and the desired output is
shown when using live.contextgarden.net.

Thanks,
Adam
___
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] Fatal error with followtokens (metapost)

2018-04-07 Thread Hans Hagen

On 4/7/2018 6:34 PM, Pablo Rodriguez wrote:

On 04/07/2018 12:59 PM, Gerhard Kugler wrote:

Hi,

the code:

-

\mainlanguage[de]
\enableregime[utf-8]


In ConTeXt MkIV, UTF-8 is the default encoding for source files. The
second line isn’t required.

Just incase it helps,
also i often see colors being enable dwhich is not needed as they're 
enabled by default (a few decades ago color took way more runtime)


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] Fatal error with followtokens (metapost)

2018-04-07 Thread Pablo Rodriguez
On 04/07/2018 12:59 PM, Gerhard Kugler wrote:
> Hi,
> 
> the code:
> 
> -
> 
> \mainlanguage[de]
> \enableregime[utf-8]

In ConTeXt MkIV, UTF-8 is the default encoding for source files. The
second line isn’t required.

Just incase 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
___

Re: [NTG-context] Fatal error with followtokens (metapost)

2018-04-07 Thread Hans Hagen

On 4/7/2018 12:59 PM, Gerhard Kugler wrote:

Hi,



If change the content of the first followtokens the error disappears.

i'll send you a patch

-
  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] Fatal error with followtokens (metapost)

2018-04-07 Thread Gerhard Kugler
Hi,

the code:

-

\mainlanguage[de]
\enableregime[utf-8]

\useMPlibrary[txt]

\starttext


\setupbodyfont[big]

\setupcolors[state=start]

\setuplayout
[topspace=192pt,
backspace=48pt,
cutspace=12pt,
width=500pt,
margin=0cm,
rightedge=88pt,
rightedgedistance=48pt,
header=0cm,
footer=0cm,
height=400pt]



\startuseMPgraphic{followtokens}
  path RotPath, q , cp; 


  RotPath := halfcircle scaled 14cm rotated 180 ;

\stopuseMPgraphic

\followtokens{Voranbringen struktureller Politik-Veränderungen}

\startuseMPgraphic{followtokens}
  path RotPath, q , cp;


  RotPath := quartercircle scaled 17cm rotated 220 ;

\stopuseMPgraphic

\followtokens{\ \ \ Präsenz in Medien\ }


\stoptext

-

If change the content of the first followtokens the error disappears.


Gerhard




-- 
Gerhard Kugler
Bensheim
___
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] Circled text in metapost

2018-04-04 Thread Gerhard Kugler
One question:

How can I give the several half circle text lines the same origin
(that of the circles)?

Gerhard


-- 
Gerhard Kugler
Bensheim
___
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] Circled text in metapost

2018-04-02 Thread Gerhard Kugler
On Mon, Apr 02, 2018 at 11:30:05AM -0600, Alan Braslau wrote:
> This is very easy to do in MetaPost, but you should not expect the
> mailing list to design your graphic for you.
> 

You are right totally. It is not my expectation. I succeeded in
programming several graphics in metapost in the past. But in the
present I am a blockhead.

Gerhard


-- 
Gerhard Kugler
Bensheim
___
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] Circled text in metapost

2018-04-02 Thread Alan Braslau
This is very easy to do in MetaPost, but you should not expect the
mailing list to design your graphic for you.

Alan


On Mon, 2 Apr 2018 19:21:05 +0200
Gerhard Kugler  wrote:

> Perhaps it is better if I send the final graphic which I have
> prorammed with the programming langguage "logo". See attachment!
> 
> The problem: it is pixel graphic.
> 
> Gerhard
> 
> 
> On Mon, Apr 02, 2018 at 06:34:42PM +0200, Gerhard Kugler wrote:
> > Finally I want to place 8 (halfcircled) texts within 8 colores
> > (full)rings. Your proposal places the second text outside of the
> > circles.
> >   
> 

___
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] Circled text in metapost

2018-04-02 Thread Gerhard Kugler
Perhaps it is better if I send the final graphic which I have
prorammed with the programming langguage "logo". See attachment!

The problem: it is pixel graphic.

Gerhard


On Mon, Apr 02, 2018 at 06:34:42PM +0200, Gerhard Kugler wrote:
> Finally I want to place 8 (halfcircled) texts within 8 colores
> (full)rings. Your proposal places the second text outside of the
> circles.
> 

-- 
Gerhard Kugler
Bensheim
___
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] Circled text in metapost

2018-04-02 Thread Gerhard Kugler
Finally I want to place 8 (halfcircled) texts within 8 colores
(full)rings. Your proposal places the second text outside of the
circles.

Gerhard


On Mon, Apr 02, 2018 at 06:08:56PM +0200, Hans Hagen wrote:
> On 4/2/2018 5:52 PM, Gerhard Kugler wrote:
> >Thank you very much!
> >
> >And if I want to place different text between the (half-)circles?
> 
> \startuseMPgraphic{followtokens-1}
> path RotPath ; RotPath := halfcircle scaled 7cm rotated 180 ;
> for i=1 upto 6 :
> draw halfcircle scaled (i*cm) rotated 180 ;
> endfor ;
> setbounds currentpicture to boundingbox halfcircle scaled 7cm rotated
> 180 ;
> \stopuseMPgraphic
> 
> \startuseMPgraphic{followtokens-2}
> path RotPath ; RotPath := halfcircle scaled 6cm rotated 180 ;
> setbounds currentpicture to boundingbox halfcircle scaled 7cm rotated
> 180 ;
> \stopuseMPgraphic
> 
> \startoverlay
> 
> {\startuseMPgraphic{followtokens}\includeMPgraphic{followtokens-1}\stopuseMPgraphic
>  \followtokens{\strut Dies ist ein anderer Text\strut}}
> 
> {\startuseMPgraphic{followtokens}\includeMPgraphic{followtokens-2}\stopuseMPgraphic
>  \followtokens{\strut Less text than before\strut}}
> \stopoverlay
> 
> 
> >On Mon, Apr 02, 2018 at 03:16:11PM +0200, Hans Hagen wrote:
> >>\useMPlibrary[txt]
> >>
> >>\starttext
> >>
> >>\startuseMPgraphic{followtokens}
> >> path RotPath ; RotPath := halfcircle scaled 7cm rotated 180 ;
> >> for i=1 upto 6 :
> >> draw halfcircle scaled (i*cm) rotated 180 ;
> >> endfor ;
> >>\stopuseMPgraphic
> >>
> >>\followtokens{Dies ist ein anderer Text}
> >>
> >>\stoptext
> >>
> >
> 
> 
> -- 
> 
> -
>   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
> ___

-- 
Gerhard Kugler
Bensheim
___
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] Circled text in metapost

2018-04-02 Thread Hans Hagen

On 4/2/2018 5:52 PM, Gerhard Kugler wrote:

Thank you very much!

And if I want to place different text between the (half-)circles?


\startuseMPgraphic{followtokens-1}
path RotPath ; RotPath := halfcircle scaled 7cm rotated 180 ;
for i=1 upto 6 :
draw halfcircle scaled (i*cm) rotated 180 ;
endfor ;
setbounds currentpicture to boundingbox halfcircle scaled 7cm 
rotated 180 ;

\stopuseMPgraphic

\startuseMPgraphic{followtokens-2}
path RotPath ; RotPath := halfcircle scaled 6cm rotated 180 ;
setbounds currentpicture to boundingbox halfcircle scaled 7cm 
rotated 180 ;

\stopuseMPgraphic

\startoverlay

{\startuseMPgraphic{followtokens}\includeMPgraphic{followtokens-1}\stopuseMPgraphic
 \followtokens{\strut Dies ist ein anderer Text\strut}}

{\startuseMPgraphic{followtokens}\includeMPgraphic{followtokens-2}\stopuseMPgraphic
 \followtokens{\strut Less text than before\strut}}
\stopoverlay



On Mon, Apr 02, 2018 at 03:16:11PM +0200, Hans Hagen wrote:

\useMPlibrary[txt]

\starttext

\startuseMPgraphic{followtokens}
 path RotPath ; RotPath := halfcircle scaled 7cm rotated 180 ;
 for i=1 upto 6 :
 draw halfcircle scaled (i*cm) rotated 180 ;
 endfor ;
\stopuseMPgraphic

\followtokens{Dies ist ein anderer Text}

\stoptext






--

-
  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] Circled text in metapost

2018-04-02 Thread Gerhard Kugler
Thank you very much!

And if I want to place different text between the (half-)circles?

Gerhard


On Mon, Apr 02, 2018 at 03:16:11PM +0200, Hans Hagen wrote:
> \useMPlibrary[txt]
> 
> \starttext
> 
> \startuseMPgraphic{followtokens}
> path RotPath ; RotPath := halfcircle scaled 7cm rotated 180 ;
> for i=1 upto 6 :
> draw halfcircle scaled (i*cm) rotated 180 ;
> endfor ;
> \stopuseMPgraphic
> 
> \followtokens{Dies ist ein anderer Text}
> 
> \stoptext
> 

-- 
Gerhard Kugler
Bensheim
___
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] Circled text in metapost

2018-04-02 Thread Alan Braslau
On Mon, 2 Apr 2018 15:16:11 +0200
Hans Hagen  wrote:

> \useMPlibrary[txt]
> 
> \starttext
> 
> \startuseMPgraphic{followtokens}
>  path RotPath ; RotPath := halfcircle scaled 7cm rotated 180 ;
>  for i=1 upto 6 :
>  draw halfcircle scaled (i*cm) rotated 180 ;
>  endfor ;
> \stopuseMPgraphic
> 
> \followtokens{Dies ist ein anderer Text}
> 
> \stoptext

or, perhaps (a question of taste):

for i=1 upto 6 :
draw RotPath scaled (i/7) ;
endfor ;


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] Circled text in metapost

2018-04-02 Thread Hans Hagen

On 3/31/2018 7:22 PM, Gerhard Kugler wrote:

Hi,

my very slow proceedings are here:




\useMPlibrary[txt]

\starttext

\setupbodyfont[pp1]

\setupcolors[state=start]

\setuplayout
[topspace=192pt,
backspace=48pt,
cutspace=12pt,
width=400pt,
margin=0cm,
rightedge=88pt,
rightedgedistance=48pt,
header=0cm,
footer=0cm,
height=400pt]



\startuseMPgraphic{followtokens}
   path RotPath ;

   RotPath := halfcircle scaled 7cm rotated 180 ;

\stopuseMPgraphic

\followtokens{Dies ist ein anderer Text}

\startuseMPgraphic{followtokens}
   path RotPath ;

   RotPath := halfcircle scaled 14cm rotated 180 ;

\stopuseMPgraphic

\followtokens{Dies ist ein selbst geschriebener Text}



But I want to place the round lines concentrically in a circle (more
than two). And I want to place all the lines on colored circled
background.

\useMPlibrary[txt]

\starttext

\startuseMPgraphic{followtokens}
path RotPath ; RotPath := halfcircle scaled 7cm rotated 180 ;
for i=1 upto 6 :
draw halfcircle scaled (i*cm) rotated 180 ;
endfor ;
\stopuseMPgraphic

\followtokens{Dies ist ein anderer Text}

\stoptext

-
  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] Circled text in metapost

2018-03-31 Thread Gerhard Kugler
Hi,

my very slow proceedings are here:




\useMPlibrary[txt]

\starttext

\setupbodyfont[pp1]

\setupcolors[state=start]

\setuplayout
[topspace=192pt,
backspace=48pt,
cutspace=12pt,
width=400pt,
margin=0cm,
rightedge=88pt,
rightedgedistance=48pt,
header=0cm,
footer=0cm,
height=400pt]



\startuseMPgraphic{followtokens}
  path RotPath ;

  RotPath := halfcircle scaled 7cm rotated 180 ;

\stopuseMPgraphic

\followtokens{Dies ist ein anderer Text}

\startuseMPgraphic{followtokens}
  path RotPath ;

  RotPath := halfcircle scaled 14cm rotated 180 ;

\stopuseMPgraphic

\followtokens{Dies ist ein selbst geschriebener Text}



But I want to place the round lines concentrically in a circle (more
than two). And I want to place all the lines on colored circled
background.

In the nice children programming language "logo" it is easy, but
yealds pixle grapics only.

Gerhard



-- 
Gerhard Kugler
Bensheim
___
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] Circled text in metapost

2018-03-30 Thread Henri Menke
On Sat, 2018-03-31 at 12:22 +1300, Henri Menke wrote:
> On Thu, 2018-03-29 at 18:05 +0200, Gerhard Kugler wrote:
> > 
> > On Thu, Mar 29, 2018 at 07:11:50AM -0600, Alan Braslau wrote:
> > > 
> > > 
> > > On Thu, 29 Mar 2018 12:43:56 +0200
> > > Gerhard Kugler  wrote:
> > > 
> > > > 
> > > > 
> > > > One misunderstanding made by my post: I want to write the text curved
> > > > as a (half-)circle.
> > > Take a look at the Metafun manual.
> > > 
> > In the manual is an example on page 233 with the following content:
> Nah!  Don't use those macros.  They are only for demonstration.  Use the
> builtin
> \followtokens instead:
> 
> 
> \loadmarkfile{meta-imp-txt} % is this supposed to be loaded like that?

\loadmarkfile{meta-imp-txt} is the wrong way.  It's supposed to be
\useMPlibrary[txt]

> \starttext
> 
> \startuseMPgraphic{followtokens}
>   path RotPath ; RotPath := reverse halfcircle ;
> \stopuseMPgraphic
> \followtokens{Text on a half circle}
> 
> \stoptext
> 
> 
> > 
> > 
> > -
> > 
> > \def\rotatetokens#1#2#3#4% delta extra radius tokens
> > {\vbox\bgroup
> > \MPtoks\emptytoks
> > \resetMPdrawing
> > \startMPdrawing
> > picture pic[] ;
> > numeric wid, len[], rot ;
> > numeric delta, extra, radius, n, r ;
> > len[0] := n := 0 ;
> > delta := #1 ; extra := #2 ; radius := #3 ;
> > \stopMPdrawing
> > \handletokens#4\with\processrotationtoken
> > \startMPdrawing
> > r := len[n]/Pi ;
> > for i=1 upto n :
> > wid := abs(xpart lrcorner pic[i] -
> > xpart llcorner pic[i]) ;
> > rot := extra + delta -
> > ((len[i]-.5wid)/len[n]) * (180+2delta) ;
> > draw pic[i]
> > rotatedaround (origin,-270) shifted (-r-radius,
> > ypart -.5[ulcorner pic[i], llcorner pic[i]])
> > rotatedaround (origin,rot) ;
> > endfor ;
> > \stopMPdrawing
> > \MPdrawingdonetrue
> > \getMPdrawing
> > \resetMPdrawing
> > \egroup}
> > 
> > \startcombination[3*1]
> > {\rotatetokens {0} {0}{0}{Does it work ok?}} {A}
> > {\rotatetokens{20} {0}{0}{Does it work ok?}} {B}
> > {\rotatetokens{20}{30}{0}{Does it work ok?}} {C}
> > \stopcombination
> > 
> > -
> > 
> > But I cannot see what part calls what parts and how they can be
> > embedded.
> > 
> > Gerhard
> > 
> > 
___
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] Circled text in metapost

2018-03-30 Thread Henri Menke
On Thu, 2018-03-29 at 18:05 +0200, Gerhard Kugler wrote:
> On Thu, Mar 29, 2018 at 07:11:50AM -0600, Alan Braslau wrote:
> > 
> > On Thu, 29 Mar 2018 12:43:56 +0200
> > Gerhard Kugler  wrote:
> > 
> > > 
> > > One misunderstanding made by my post: I want to write the text curved
> > > as a (half-)circle.
> > Take a look at the Metafun manual.
> > 
> In the manual is an example on page 233 with the following content:

Nah!  Don't use those macros.  They are only for demonstration.  Use the builtin
\followtokens instead:


\loadmarkfile{meta-imp-txt} % is this supposed to be loaded like that?
\starttext

\startuseMPgraphic{followtokens}
  path RotPath ; RotPath := reverse halfcircle ;
\stopuseMPgraphic
\followtokens{Text on a half circle}

\stoptext


> 
> -
> 
> \def\rotatetokens#1#2#3#4% delta extra radius tokens
> {\vbox\bgroup
> \MPtoks\emptytoks
> \resetMPdrawing
> \startMPdrawing
> picture pic[] ;
> numeric wid, len[], rot ;
> numeric delta, extra, radius, n, r ;
> len[0] := n := 0 ;
> delta := #1 ; extra := #2 ; radius := #3 ;
> \stopMPdrawing
> \handletokens#4\with\processrotationtoken
> \startMPdrawing
> r := len[n]/Pi ;
> for i=1 upto n :
> wid := abs(xpart lrcorner pic[i] -
> xpart llcorner pic[i]) ;
> rot := extra + delta -
> ((len[i]-.5wid)/len[n]) * (180+2delta) ;
> draw pic[i]
> rotatedaround (origin,-270) shifted (-r-radius,
> ypart -.5[ulcorner pic[i], llcorner pic[i]])
> rotatedaround (origin,rot) ;
> endfor ;
> \stopMPdrawing
> \MPdrawingdonetrue
> \getMPdrawing
> \resetMPdrawing
> \egroup}
> 
> \startcombination[3*1]
> {\rotatetokens {0} {0}{0}{Does it work ok?}} {A}
> {\rotatetokens{20} {0}{0}{Does it work ok?}} {B}
> {\rotatetokens{20}{30}{0}{Does it work ok?}} {C}
> \stopcombination
> 
> -
> 
> But I cannot see what part calls what parts and how they can be
> embedded.
> 
> Gerhard
> 
> 
___
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] Circled text in metapost

2018-03-30 Thread Gerhard Kugler
Thank you,

this seems a very informative explanation for me, and now I will try
to transpose it for my intention.

Gerhard

On Fri, Mar 30, 2018 at 08:44:23AM -0600, Alan Braslau wrote:
> Hello,
> 
> luatex includes the MetaPost library MPlib, so MetaPost code is called
> and then injected into the output stream...


-- 
Gerhard Kugler
Bensheim
___
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] Circled text in metapost

2018-03-30 Thread Alan Braslau
Hello,

luatex includes the MetaPost library MPlib, so MetaPost code is called
and then injected into the output stream. As a user, it is useful to
know that MP is in fact called in two passes, thus twice, and this can
have some unexpected consequences when not programmed cleanly. Global
variable storage, for example, can reflect the multiple passes. Take
the following (silly) example:

\starttext

\startMPcode
if unknown n : n := 0 ; fi
n := n + 1 ;
draw textext(decimal n) ;
\stopMPcode

\startMPcode
n := n + 1 ;
draw textext(decimal n) ;
\stopMPcode

\stoptext

yielding:
1
3

(perhaps Hans or Taco can explain why one does not get 2 4)


This side effect is somewhat handled by the fact that each call to MP
is treated as a group : begingroup  ... endgroup so

\startMPcode
save n ; n := 0 ;
...
\stopMPcode

works as expected, but n is then local and becomes unknown (or keeps
its global value) for subsequent calls to MP.

What should be understood is that calls to MP returns a bounding box to
TeX, and space is reserved for this bounding box. Likewise, calls
within MP to TeX, for example textext() or label(), or btex ... etex
returns a bounding box to MP, and this (picture) object is placed in
the graphic. Mechanisms exist allowing the passing of values of
variables via lua (as strings, in fact). This is a more advanced
subject.


Now, there are a number of ways of calling MP from TeX, directly as
above, but also as unique MP graphics or as reusable MP graphics, ...
This is another subject all together.

Hopefully this helps some.

Alan



On Fri, 30 Mar 2018 13:31:30 +0200
Gerhard Kugler  wrote:

> Hello,
> 
> my problem is that in other programming langguages there is a main
> procedure which calls others. In metapost in the context of ConteXt I
> can use \starttext ... \stoptext or \startMPpage ... \stopMPpage or
> \beginfig ... \endfig
> 
> And it seems not to be transparent how procedures are called.
> 
> Gerhard
> 
> 

___
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] Circled text in metapost

2018-03-30 Thread Gerhard Kugler
Hello,

my problem is that in other programming langguages there is a main
procedure which calls others. In metapost in the context of ConteXt I
can use \starttext ... \stoptext or \startMPpage ... \stopMPpage or
\beginfig ... \endfig

And it seems not to be transparent how procedures are called.

Gerhard


-- 
Gerhard Kugler
Bensheim
___
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] Circled text in metapost

2018-03-29 Thread Gerhard Kugler
On Thu, Mar 29, 2018 at 07:11:50AM -0600, Alan Braslau wrote:
> On Thu, 29 Mar 2018 12:43:56 +0200
> Gerhard Kugler  wrote:
> 
> > One misunderstanding made by my post: I want to write the text curved
> > as a (half-)circle.
> 
> Take a look at the Metafun manual.
> 

In the manual is an example on page 233 with the following content:

-

\def\rotatetokens#1#2#3#4% delta extra radius tokens
{\vbox\bgroup
\MPtoks\emptytoks
\resetMPdrawing
\startMPdrawing
picture pic[] ;
numeric wid, len[], rot ;
numeric delta, extra, radius, n, r ;
len[0] := n := 0 ;
delta := #1 ; extra := #2 ; radius := #3 ;
\stopMPdrawing
\handletokens#4\with\processrotationtoken
\startMPdrawing
r := len[n]/Pi ;
for i=1 upto n :
wid := abs(xpart lrcorner pic[i] -
xpart llcorner pic[i]) ;
rot := extra + delta -
((len[i]-.5wid)/len[n]) * (180+2delta) ;
draw pic[i]
rotatedaround (origin,-270) shifted (-r-radius,
ypart -.5[ulcorner pic[i], llcorner pic[i]])
rotatedaround (origin,rot) ;
endfor ;
\stopMPdrawing
\MPdrawingdonetrue
\getMPdrawing
\resetMPdrawing
\egroup}

\startcombination[3*1]
{\rotatetokens {0} {0}{0}{Does it work ok?}} {A}
{\rotatetokens{20} {0}{0}{Does it work ok?}} {B}
{\rotatetokens{20}{30}{0}{Does it work ok?}} {C}
\stopcombination

-

But I cannot see what part calls what parts and how they can be
embedded.

Gerhard


-- 
Gerhard Kugler
Bensheim
___
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] Circled text in metapost

2018-03-29 Thread Alan Braslau
On Thu, 29 Mar 2018 12:43:56 +0200
Gerhard Kugler  wrote:

> One misunderstanding made by my post: I want to write the text curved
> as a (half-)circle.

Take a look at the Metafun manual.

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] Circled text in metapost

2018-03-29 Thread Gerhard Kugler
Thank you very much for these examples. The most important hints are
given now. Perhaps I am able to apply them.

One misunderstanding made by my post: I want to write the text curved
as a (half-)circle.

Gerhard

-- 
Gerhard Kugler
Bensheim
___
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] Circled text in metapost

2018-03-29 Thread Hans Hagen

On 3/29/2018 11:52 AM, Henri Menke wrote:

On 03/29/2018 10:28 PM, Gerhard Kugler wrote:

Hi,

in documentations I can find various examples of circled text. But
copying them I had no success till now.

I want to place text in half circles of various radiuses. Is there
anywhere a simple example?


The Metafun experts would probably tear this apart...
 
\startuniqueMPgraphic{half circle}

   path p, q ;
   p := fullcircle scaled OverlayWidth;
   q := (p cutafter (point .5 along p)) shifted (0,-.5BodyFontSize) ;
   fill q -- cycle withcolor lightgray ;
   draw q withpen pencircle scaled 2pt withcolor darkred ;
   setbounds currentpicture to boundingbox p ;
\stopuniqueMPgraphic

\defineoverlay[half circle][\uniqueMPgraphic{half circle}]

\starttext

\framed[background=half circle,frame=off]{Text width half circle.}

\stoptext


Well, if you really want a tear down ...

\startuniqueMPgraphic{half circle}
path p ; p := halfcircle scaled OverlayWidth shifted center 
OverlayBox ;

path q ; q := p shifted (0,-StrutDepth)  ;
draw image (
fill q -- cycle withcolor OverlayColor ;
draw q  withcolor OverlayLineColor ;
) withpen pencircle scaled 2pt ;
setbounds currentpicture to boundingbox OverlayBox ;
\stopuniqueMPgraphic

\defineoverlay[half circle][\uniqueMPgraphic{half circle}]

\starttext

\framed
  [background=half circle,
   frame=off,
   framecolor=red,
   backgroundcolor=lightgray]
  {Text width half circle.}

\framed
  [background=half circle,
   frame=off,
   framecolor=red,
   backgroundcolor=lightgray]
  {Text width half circle and more.}

\stoptext




My greatest problems seem to be in the embedding code.

Gerhard




___
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
___

Re: [NTG-context] Circled text in metapost

2018-03-29 Thread Henri Menke
On 03/29/2018 10:28 PM, Gerhard Kugler wrote:
> Hi,
> 
> in documentations I can find various examples of circled text. But
> copying them I had no success till now.
> 
> I want to place text in half circles of various radiuses. Is there
> anywhere a simple example?

The Metafun experts would probably tear this apart...


\startuniqueMPgraphic{half circle}
  path p, q ;
  p := fullcircle scaled OverlayWidth;
  q := (p cutafter (point .5 along p)) shifted (0,-.5BodyFontSize) ;
  fill q -- cycle withcolor lightgray ;
  draw q withpen pencircle scaled 2pt withcolor darkred ;
  setbounds currentpicture to boundingbox p ;
\stopuniqueMPgraphic

\defineoverlay[half circle][\uniqueMPgraphic{half circle}]

\starttext

\framed[background=half circle,frame=off]{Text width half circle.}

\stoptext


> 
> My greatest problems seem to be in the embedding code.
> 
> Gerhard
> 
> 

___
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] Circled text in metapost

2018-03-29 Thread Gerhard Kugler
Hi,

in documentations I can find various examples of circled text. But
copying them I had no success till now.

I want to place text in half circles of various radiuses. Is there
anywhere a simple example?

My greatest problems seem to be in the embedding code.

Gerhard


-- 
Gerhard Kugler
Bensheim
___
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 makempy (metapost outlines)

2018-02-19 Thread Jeong Dal
Dear Otared,

I am sorry that the sample code is not fully loaded. 
Although Hans said that we don’t need  ‘makempy’, I copied the whole code again 
for the sake of test.
\setuphead[section][style={\effect[outer]}] is working well.

For korean, use \setupbodyfont[unfonts] as Hans said.

Thank you. 

Best regards,

Dalyoung

> 
> Tha sample code below runs correctly, except that the Korean words are not 
> displayed, since there is no body fonts set up for that language.
> Could you please send a more complete sample in order for us to see what you 
> are reporting?
> 
> Best regards: OK

\setupbodyfont[unfonts]

% the following is copied from makempy manual.

\startuseMPgraphic{text}
  graphictext \MPstring{string} scaled 4
withdrawcolor \MPcolor{blue} withfillcolor \MPcolor{gray}
withpen pencircle scaled 2pt ;
\stopuseMPgraphic
\startuseMPgraphic{number}
  graphictext \MPstring{string} scaled 10
withdrawcolor \MPcolor{red} withfillcolor \MPcolor{gray}
withpen pencircle scaled 2pt ;
\stopuseMPgraphic
\def\TextCommand#1%
  {\setMPtext{string}{#1}%
   \framed
 [frame=off,offset=overlay,height=3cm,width=\hsize]
 {\useMPgraphic{text}}}
\def\NumberCommand#1%
  {\expanded{\setMPtext{string}{\currentheadnumber}}%
   \hsmash
 {\framed
[frame=off,offset=overlay,height=3cm,width=\hsize]
{\useMPgraphic{number
\setuphead
  [section]
  [distance=0pt,
   textcommand=\TextCommand,
   numbercommand=\NumberCommand]
%\setuphead[section][style={\effect[outer]}]

\starttext
\section{First One}
This worked fine before. %이 전에는 잘 되었습니다.

\startformula
\int f(x) dx 
\stopformula

\section{Second Two}
Who made the Euler font. x, y, z

$x^2 + y^2 =  z^2$
\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] about makempy (metapost outlines)

2018-02-19 Thread Hans Hagen

On 2/19/2018 3:21 AM, Jeong Dal wrote:

tex error       > tex error on line 4 in file 
/Users/graph/Documents/TeXfiles/test-mpgraph.tex: ! Undefined control 
sequence


 \setstrut \begstrut \getheadtitle
                                   \endstrut
\MPLIBgraphictext ...\startTEXpage [scale=1]#1
                                                   \stopTEXpage
l.4 ...\setstrut \begstrut \getheadtitle \endstrut }



1     \starttext
2     \def\MPLIBgraphictext#1{\startTEXpage[scale=1]#1\stopTEXpage}
3
4 >>  \MPLIBgraphictext{\setstrut \begstrut \getheadtitle \endstrut }
5     \stoptext


You're not handling a section head or so so \getheadtitle is meaningless 
out of that context.


How about

\setuphead[section][style={\effect[outer]}]

which is normally ok for outlines and has been around for ages.

(btw, the mp outlin emechanism has changed and doesn't use makempy any 
longer .. it's better now, see metafun manual etc)


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] about makempy (metapost outlines)

2018-02-19 Thread Hans Hagen

On 2/19/2018 8:09 AM, Otared Kavian wrote:

Tha sample code below runs correctly, except that the Korean words are 
not displayed, since there is no body fonts set up for that language.
Could you please send a more complete sample in order for us to see what 
you are reporting?

\setupbodyfont[unfonts]

-
  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] about makempy (metapost outlines)

2018-02-18 Thread Otared Kavian
Hi Dalyoung,

Tha sample code below runs correctly, except that the Korean words are not 
displayed, since there is no body fonts set up for that language.
Could you please send a more complete sample in order for us to see what you 
are reporting?

Best regards: OK

> On 19 Feb 2018, at 03:21, Jeong Dal  wrote:
> 
> 
> Hi, 
> 
> During the search Euler font, I found a manual “creating metapost outlines”.
> It is what I looking for at the last year.
> 
> I tried an example for section head, but it issued an undefined control 
> sequence message.
> 
> Please tell me what is wrong and how to change.
> I copied the  sample code and a part of log file at the end.
> 
> Thank you for reading.
> 
> Best regards,
> 
> Dalyoung
> 
> 
> %%%
> \starttext
> \section{First One}
> This worked fine before. 이 전에는 잘 되었습니다.
> 
> \startformula
> \int f(x) dx 
> \stopformula
> 
> \section{Second Two}
> Who made the Euler font. x, y, z
> 
> $x^2 + y^2 =  z^2$
> \stoptext
> %
> 
> tex error   > tex error on line 4 in file 
> /Users/graph/Documents/TeXfiles/test-mpgraph.tex: ! Undefined control sequence
> 
>  \setstrut \begstrut \getheadtitle 
>   \endstrut 
> \MPLIBgraphictext ...\startTEXpage [scale=1]#1
>   \stopTEXpage 
> l.4 ...\setstrut \begstrut \getheadtitle \endstrut }
>   
> 
> 1 \starttext
> 2 \def\MPLIBgraphictext#1{\startTEXpage[scale=1]#1\stopTEXpage}
> 3 
> 4 >>  \MPLIBgraphictext{\setstrut \begstrut \getheadtitle \endstrut }
> 5 \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
___

[NTG-context] about makempy (metapost outlines)

2018-02-18 Thread Jeong Dal

Hi, 

During the search Euler font, I found a manual “creating metapost outlines”.
It is what I looking for at the last year.

I tried an example for section head, but it issued an undefined control 
sequence message.

Please tell me what is wrong and how to change.
I copied the  sample code and a part of log file at the end.

Thank you for reading.

Best regards,

Dalyoung


%%%
\starttext
\section{First One}
This worked fine before. 이 전에는 잘 되었습니다.

\startformula
\int f(x) dx 
\stopformula

\section{Second Two}
Who made the Euler font. x, y, z

$x^2 + y^2 =  z^2$
\stoptext
%

tex error   > tex error on line 4 in file 
/Users/graph/Documents/TeXfiles/test-mpgraph.tex: ! Undefined control sequence

 \setstrut \begstrut \getheadtitle 
  \endstrut 
\MPLIBgraphictext ...\startTEXpage [scale=1]#1
  \stopTEXpage 
l.4 ...\setstrut \begstrut \getheadtitle \endstrut }
  

1 \starttext
2 \def\MPLIBgraphictext#1{\startTEXpage[scale=1]#1\stopTEXpage}
3 
4 >>  \MPLIBgraphictext{\setstrut \begstrut \getheadtitle \endstrut }
5 \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] Can MetaPost draw directly datapoints from a data file?

2017-12-28 Thread Jorge Manuel
Thanks a lot for this nice and clean solution. It’s fantastic. Now it is very 
easy to make scatter plots from the output of c++ libraries and other kind of 
applications: two axes and a path build like this

 path curve; 
 numeric i; i:=1;
 curve :=  my_offset(i) forever: hide(i := i + 1) exitif i >  my_nofelements .. 
my_offset(i) endfor;

Thanks again

Have a great 2018

Jorge


> No dia 28/12/2017, às 18:47, Hans Hagen  escreveu:
> 
> \starttext
> 
> \startluacode
>MP.mycode = { }
> 
>local elements = { }
> 
>function MP.mycode.loadelements(filename)
>elements = { }
>for line in io.lines(filename) do
>elements[#elements+1] = { string.match(line, 
> '(%S+)%s*(%S+)%s*(%S+)%s*(%S+)%s*(%S+)') }
>end
>end
> 
>function MP.mycode.nofelements()
>mp.print(#elements)
>end
> 
>function MP.mycode.getlabel(i)
>mp.quoted(elements[i][1])
>end
> 
>function MP.mycode.getoffset(i)
>mp.pair(elements[i][2],elements[i][3])
>end
> \stopluacode
> 
> \startMPcode
>lua.MP.mycode.loadelements("molecule.xyz ") ;
>for i=1 upto lua.MP.mycode.nofelements() :
>label (lua.MP.mycode.getlabel(i),50 * lua.MP.mycode.getoffset(i)) ;
>endfor ;
> \stopMPcode
> 
> \startMPcode
>def my_loadelements(expr name) =
>lua.MP.mycode.loadelements(name) ;
>enddef ;
>vardef my_nofelements =
>lua.MP.mycode.nofelements()
>enddef ;
>vardef my_label(expr i) =
>lua.MP.mycode.getlabel(i)
>enddef ;
>vardef my_offset(expr i) =
>lua.MP.mycode.getoffset(i)
>enddef ;
> 
>my_loadelements("molecule.xyz ") ;
>for i=1 upto my_nofelements :
>label (my_label(i),50 * my_offset(i)) ;
>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
___

Re: [NTG-context] Can MetaPost draw directly datapoints from a data file?

2017-12-28 Thread Hans Hagen

On 12/28/2017 6:36 PM, Jorge Manuel wrote:
When I need to draw datapoints from a external data file I’m using lua, 
like this:


\starttext

\startluacode

Elemento = {}
x = {}
y ={}
z= {}
carga = {}
i=1
context("\\startMPcode”)

context("numeric u; u := 1.5cm;")
for line in io.lines("molecule.xyz <http://molecule.xyz>") do
    local a, b, c, d, e = string.match(line, 
'(%a+)%s*%s*(%S+)%s*%s*(%S+)%s*%s*(%S+)%s*%s*(%S+)')

    Elemento[i]= a
    x[i]= tonumber(b)
    y[i]= tonumber(c)
    z[i]= tonumber(d)
    carga[i]= tonumber(e)

    context("label(\"%s\", (%0.6f u, %0.6f u));", a, x[i],y[i])

    i=i+1
end

context("\\stopMPcode”)

\stopluacode


\stoptext

*Is there a way to pass directly the external data to MetaPost without 
using Lua?*


I know that I can use a similar function to gdata from graph.mp. I try 
to reuse this piece of code, but not works.


\startMPcode

vardef Grdln_@#(expr f) =
   save n_, s_; string s_;
   s_ = readfrom f;
   string @#[];
   if s_<>EOF:
     @#1 := loptok s_;
     n_ = if @#1="%": 0 else: 1 fi;
     forever:
       @#[incr n_] := loptok s_;
       exitif @#[n_]="  ";
     endfor
     @#1<>"  "
   else: false
   fi
enddef;

Grdln_$("molecule.xyz <http://molecule.xyz>");

\stopMPcode

mp file handling is rather crippled so this is where lua is better

\starttext

\startluacode
MP.mycode = { }

local elements = { }

function MP.mycode.loadelements(filename)
elements = { }
for line in io.lines(filename) do
elements[#elements+1] = { string.match(line, 
'(%S+)%s*(%S+)%s*(%S+)%s*(%S+)%s*(%S+)') }

end
end

function MP.mycode.nofelements()
mp.print(#elements)
end

function MP.mycode.getlabel(i)
mp.quoted(elements[i][1])
end

function MP.mycode.getoffset(i)
mp.pair(elements[i][2],elements[i][3])
end
\stopluacode

\startMPcode
lua.MP.mycode.loadelements("molecule.xyz") ;
for i=1 upto lua.MP.mycode.nofelements() :
label (lua.MP.mycode.getlabel(i),50 * lua.MP.mycode.getoffset(i)) ;
endfor ;
\stopMPcode

\startMPcode
def my_loadelements(expr name) =
lua.MP.mycode.loadelements(name) ;
enddef ;
vardef my_nofelements =
lua.MP.mycode.nofelements()
enddef ;
vardef my_label(expr i) =
lua.MP.mycode.getlabel(i)
enddef ;
vardef my_offset(expr i) =
lua.MP.mycode.getoffset(i)
enddef ;

my_loadelements("molecule.xyz") ;
for i=1 upto my_nofelements :
label (my_label(i),50 * my_offset(i)) ;
endfor ;
\stopMPcode

\stoptext

If you use that kind of code a lot you can hide the lua calls in macros 
which makes it look like metapost does it all.


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] Can MetaPost draw directly datapoints from a data file?

2017-12-28 Thread Jorge Manuel
When I need to draw datapoints from a external data file I’m using lua, like this:\starttext\startluacodeElemento = {}x = {}y ={}z= {}carga = {}i=1context("\\startMPcode”)context("numeric u; u := 1.5cm;")for line in io.lines("molecule.xyz") do   local a, b, c, d, e = string.match(line, '(%a+)%s*%s*(%S+)%s*%s*(%S+)%s*%s*(%S+)%s*%s*(%S+)')   Elemento[i]= a   x[i]= tonumber(b)   y[i]= tonumber(c)   z[i]= tonumber(d)   carga[i]= tonumber(e)   context("label(\"%s\", (%0.6f u, %0.6f u));", a, x[i],y[i])   i=i+1 endcontext("\\stopMPcode”)\stopluacode\stoptextIs there a way to pass directly the external data to MetaPost without using Lua?I know that I can use a similar function to gdata from graph.mp. I try to reuse this piece of code, but not works.\startMPcodevardef Grdln_@#(expr f) =  save n_, s_; string s_;  s_ = readfrom f;  string @#[];  if s_<>EOF:    @#1 := loptok s_;    n_ = if @#1="%": 0 else: 1 fi;    forever:      @#[incr n_] := loptok s_;      exitif @#[n_]="  ";    endfor    @#1<>"  "  else: false  fienddef;Grdln_$("molecule.xyz");\stopMPcode

molecule.xyz
Description: Binary data


read_external.tex
Description: Binary data
Jorge___
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: How to get total number of pages?

2017-11-17 Thread Procházka Lukáš Ing .

Hello Thomas,

thank you, I'll keep it in mind!

Best regards,

Lukas


On Fri, 17 Nov 2017 14:42:58 +0100, Thomas A. Schmitz 
 wrote:


On 17.11.2017 14:02, Procházka Lukáš Ing. wrote:

it seems that there is 'PageNumber' variable (macro) available within MP
code, maybe introduced by 'StartPage', within MP.

How do I get total number of pages or last page number within MP (in
Ctx: \totalnumberofpages, \lastpage)?


NOfPages

If you had grepped the source for PageNumber, you would have discovered
that all of this is defined in meta-pag.mkiv.

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
___



--
Ing. Lukáš Procházka | mailto:l...@pontex.cz
Pontex s. r. o.  | mailto:pon...@pontex.cz | http://www.pontex.cz | 
IDDS:nrpt3sn
Bezová 1658
147 14 Praha 4

Mob.: +420 702 033 396

___
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: How to get total number of pages?

2017-11-17 Thread Thomas A. Schmitz

On 17.11.2017 14:02, Procházka Lukáš Ing. wrote:
it seems that there is 'PageNumber' variable (macro) available within MP 
code, maybe introduced by 'StartPage', within MP.


How do I get total number of pages or last page number within MP (in 
Ctx: \totalnumberofpages, \lastpage)?


NOfPages

If you had grepped the source for PageNumber, you would have discovered 
that all of this is defined in meta-pag.mkiv.


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] Metapost: How to get total number of pages?

2017-11-17 Thread Procházka Lukáš Ing .

Hello,

it seems that there is 'PageNumber' variable (macro) available within MP code, 
maybe introduced by 'StartPage', within MP.

How do I get total number of pages or last page number within MP (in Ctx: 
\totalnumberofpages, \lastpage)?

TIA.

Best regards,

Lukas


--
Ing. Lukáš Procházka | mailto:l...@pontex.cz
Pontex s. r. o.  | mailto:pon...@pontex.cz | http://www.pontex.cz | 
IDDS:nrpt3sn
Bezová 1658
147 14 Praha 4

Mob.: +420 702 033 396

___
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] question for metapost experts

2017-08-10 Thread Schmitz Thomas A.

> On 10. Aug 2017, at 14:18, Hans Hagen  wrote:
> 
> p intersection_point q
> 
> (also sets intersection_found)

Boy, impressive and wonderful, thanks a lot!!! It also made me see why I the 
error stopped the compilation: I had a naming conflict between the slide 
background and one of included metapost graphics, so now I can correct this!

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
___

Re: [NTG-context] question for metapost experts

2017-08-10 Thread Hans Hagen

On 8/10/2017 2:07 PM, Schmitz Thomas A. wrote:

Hi all,

this one is for all the metapos/metafun experts out there (Alan, are you 
there?). For a counter in one of my slide backgrounds, I have to calculate an 
intersectionpoint, given in percentage of the difference between current page 
and last page. I have always had some difficulties on the first run, when the 
value of the last page isn’t known yet and hence not written to the tuc file, 
but the error


! The paths don't intersect.




used to disappear in subsequent runs. Now, ConTeXt doesn’t compile the file at 
all and stops on this error. There is an error message I haven’t seen before:


intersectionpoint->...The paths don't intersect");
origin.else:0.5[point.x_.o...

;
<*> ... ;z13 = (z11 -- z12) intersectionpoint qw ;
draw z13 withcolor (0.1,0
This error message was generated by an `errmessage'
command, so I can't give any explicit help.
Pretend that you're Miss Marple: Examine all clues,
and deduce the truth by inspired guesses.


Is there a way to make this conditional, such as (pseudocode)


p intersection_point q

(also sets intersection_found)


if q intersects p:
  z = q intersectionpoint p ;
else:
  z = (0,0) ;
fi ;

I hope that this would allow ConTeXt to proceed and calculate the point 
correctly on the second run.

Thanks, and 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
___




--

-
  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] question for metapost experts

2017-08-10 Thread Schmitz Thomas A.
Hi all,

this one is for all the metapos/metafun experts out there (Alan, are you 
there?). For a counter in one of my slide backgrounds, I have to calculate an 
intersectionpoint, given in percentage of the difference between current page 
and last page. I have always had some difficulties on the first run, when the 
value of the last page isn’t known yet and hence not written to the tuc file, 
but the error 

> ! The paths don't intersect.
> 


used to disappear in subsequent runs. Now, ConTeXt doesn’t compile the file at 
all and stops on this error. There is an error message I haven’t seen before:

> intersectionpoint->...The paths don't intersect");
> origin.else:0.5[point.x_.o...
> 
> ;
> <*> ... ;z13 = (z11 -- z12) intersectionpoint qw ;
> draw z13 withcolor (0.1,0
> This error message was generated by an `errmessage'
> command, so I can't give any explicit help.
> Pretend that you're Miss Marple: Examine all clues,
> and deduce the truth by inspired guesses.

Is there a way to make this conditional, such as (pseudocode)

if q intersects p:
 z = q intersectionpoint p ;
else:
 z = (0,0) ;
fi ; 

I hope that this would allow ConTeXt to proceed and calculate the point 
correctly on the second run.

Thanks, and 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
___

Re: [NTG-context] Passing data back and forth between metapost and lua

2017-03-19 Thread Hans Hagen

On 3/19/2017 7:29 PM, Aditya Mahajan wrote:

On Sun, 19 Mar 2017, Aditya Mahajan wrote:


On Tue, 20 Dec 2016, Alan Braslau wrote:


On Mon, 19 Dec 2016 08:19:25 -0800
Aditya Mahajan  wrote:


The ability to pass parameters to metapost has been around since the
beginning. See the metafun manual for details (search for MPvar).


Hans has developed tools making it quite easy to pass data back and
forth between MetaPost and lua. This is quite efficient, and it is
being used more and more in the development of macro functionality.


I finally need to write a macro where I want to pass data from lua to
metapost. I could not find an example in the source code showing this.
Can someone show a basic example of how lua-metapost interface works
or point me to the appropriate files in the source.


Found some information in the CLD manual. That is sufficient for the
task at hand for me. But a pointer to a more detailed source will be
welcome.


real low level

\starttext

\startluacode

document.mydata = { foo = "foo", bar = 123 }

\stopluacode

\startMPcode

draw fullcircle scaled lua("mp.print(document.mydata.bar)") ;
draw textext (lua("mp.quoted(document.mydata.foo)")) ;

\stopMPcode

\stoptext

i'll mail you the new chapter in the metafun manual

-
  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] Passing data back and forth between metapost and lua

2017-03-19 Thread Aditya Mahajan

On Sun, 19 Mar 2017, Aditya Mahajan wrote:


On Tue, 20 Dec 2016, Alan Braslau wrote:


On Mon, 19 Dec 2016 08:19:25 -0800
Aditya Mahajan  wrote:


The ability to pass parameters to metapost has been around since the
beginning. See the metafun manual for details (search for MPvar).


Hans has developed tools making it quite easy to pass data back and
forth between MetaPost and lua. This is quite efficient, and it is
being used more and more in the development of macro functionality.


I finally need to write a macro where I want to pass data from lua to 
metapost. I could not find an example in the source code showing this. 
Can someone show a basic example of how lua-metapost interface works or 
point me to the appropriate files in the source.


Found some information in the CLD manual. That is sufficient for the 
task at hand for me. But a pointer to a more detailed source will be 
welcome.


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] Passing data back and forth between metapost and lua

2017-03-19 Thread Aditya Mahajan

On Tue, 20 Dec 2016, Alan Braslau wrote:


On Mon, 19 Dec 2016 08:19:25 -0800
Aditya Mahajan  wrote:


The ability to pass parameters to metapost has been around since the
beginning. See the metafun manual for details (search for MPvar).


Hans has developed tools making it quite easy to pass data back and
forth between MetaPost and lua. This is quite efficient, and it is
being used more and more in the development of macro functionality.


I finally need to write a macro where I want to pass data from lua to 
metapost. I could not find an example in the source code showing this. 
Can someone show a basic example of how lua-metapost interface works or 
point me to the appropriate files in the source.


Thanks,
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] Asymptote or Metapost and ConTeXt parameters.

2016-12-23 Thread Aditya Mahajan

On Sat, 24 Dec 2016, Jaroslav Hajtmar wrote:

It seems now, that everything at this time works as intended. Many 
thanks for your support. Below is a minimal example. Attached is a PDF 
sample result.


Nice to know that it works.

I tried also to experiment with the choice "object = no", as suggested 
by Hans, but without success.


Note that it is "object=no" (without spaces around equal to)


I would asking if you make any changes in filter module?
Or have I misunderstood Your opinion?


I will add the code between \unprotect ... \protect to the filter module after
I have tested it a bit more thoroughly.

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] Asymptote or Metapost and ConTeXt parameters.

2016-12-23 Thread Jaroslav Hajtmar
Hello Adytia.
It seems now, that everything at this time works as intended. Many thanks for 
your support. Below is a minimal example. Attached is a PDF sample result.
I tried also to experiment with the choice "object = no", as suggested by Hans, 
but without success. I would asking  if you make any changes in filter module?
Or have I misunderstood Your opinion? 
Thank you once again
Jaroslav Hajtmar


Here is minimal example:

\usemodule[filter]

\unprotect
\appendtoks
   \setuevalue{set\currentexternalfilter 
buffer}{\externalfilter@set[\currentexternalfilter]}%
\to \everydefineexternalfilter

\unexpanded\def\externalfilter@set
   {\dodoubleargument\externalfiter@set_indeed}

\starttexdefinition externalfiter@set_indeed [#1][#2]#3
% #1 = filter
% #2 = options

\begingroup
\edef\currentexternalfilter{#1}

\setupexternalfilter[#1][\c!name=,#2]

\externalfilter@set_filenames
\setbuffer[\externalfilter@buffer_name]#3\endbuffer

\externalfilter@process_filter
  \stoptexdefinition
\protect

\defineexternalfilter
   [ASY]
   [
 filtercommand={asy -tex context \externalfilterinputfile\space -o 
\externalfilteroutputfile}, output=\externalfilterbasefile.pdf,
 purge=no, 
 cache=yes,
 readcommand=\ReadImage,
   ]

\define[1]\ReadImage{\externalfigure[#1]}

\define[1]\mycircle{
\setASYbuffer{
import graph;
draw(Circle((0,0),#1));
}}


\starttext

\startASY
 import graph;
 draw((0,0)--(100,100));
\stopASY

\mycircle{10}

\mycircle{20}

\mycircle{30}

\stoptext







Dne 23.12.16 20:22, ntg-context za uživatele Aditya Mahajan 
 napsal(a):

On Fri, 23 Dec 2016, Jaroslav Hajtmar wrote:

> Thanks for sending Your code. It seems that it works with Asymptote. 
> Unfortunately, when I am trying to multiple call a macro then I get 
> fatal error, and then compile collapse. I do not know what it could be.

When called for the first time, the code generates test-ASY.pdf file and 
includes it. After the second call, a new test-ASY.pdf is generated. 
ConTeXt generates an error because the name of the files is the same, but 
the content is not.

There should be an option for \externalfigure to disable this check, but I 
couldn't find it. Here is an alternative approach, that changes the name 
of the PDF.

\usemodule[filter]

\unprotect
\appendtoks
   \setuevalue{set\currentexternalfilter 
buffer}{\externalfilter@set[\currentexternalfilter]}%
\to \everydefineexternalfilter

\unexpanded\def\externalfilter@set
   {\dodoubleargument\externalfiter@set_indeed}

\starttexdefinition externalfiter@set_indeed [#1][#2]#3
% #1 = filter
% #2 = options

\begingroup
\edef\currentexternalfilter{#1}

\setupexternalfilter[#1][\c!name=,#2]

\externalfilter@set_filenames
\setbuffer[\externalfilter@buffer_name]#3\endbuffer

\externalfilter@process_filter
  \stoptexdefinition
\protect

\defineexternalfilter
 [MARKDOWN]
 [
   filtercommand={pandoc -f markdown -t context 
\externalfilterinputfile\space -o \externalfilteroutputfile},
   cache=yes,
   purge=no,
 ]

\define[1]\NEW
 {\setMARKDOWNbuffer{This is #1}}

\traceexternalfilters

\starttext
\startMARKDOWN
   This is **one**
\stopMARKDOWN

\NEW{**ONE**}

\NEW{_TWO_}
\stoptext

Note that this has the same limitation as using \type{...}. The contents of
\NEW{...} must have matched braces. If this works, I can include the code in
t-filter (mkiv only, as I no longer want to maintain the mkii branch).

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

___



AsymptoteCodeInConTeXt03a-Adytia.pdf
Description: AsymptoteCodeInConTeXt03a-Adytia.pdf
___
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] Asymptote or Metapost and ConTeXt parameters.

2016-12-23 Thread Hans Hagen

On 12/23/2016 8:22 PM, Aditya Mahajan wrote:

On Fri, 23 Dec 2016, Jaroslav Hajtmar wrote:


Thanks for sending Your code. It seems that it works with Asymptote.
Unfortunately, when I am trying to multiple call a macro then I get
fatal error, and then compile collapse. I do not know what it could be.


When called for the first time, the code generates test-ASY.pdf file and
includes it. After the second call, a new test-ASY.pdf is generated.
ConTeXt generates an error because the name of the files is the same,
but the content is not.

There should be an option for \externalfigure to disable this check, but
I couldn't find it. Here is an alternative approach, that changes the
name of the PDF.


object=no should work but even then, the backend can keep files open and 
flush later


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] Asymptote or Metapost and ConTeXt parameters.

2016-12-23 Thread Aditya Mahajan

On Fri, 23 Dec 2016, Jaroslav Hajtmar wrote:

Thanks for sending Your code. It seems that it works with Asymptote. 
Unfortunately, when I am trying to multiple call a macro then I get 
fatal error, and then compile collapse. I do not know what it could be.


When called for the first time, the code generates test-ASY.pdf file and 
includes it. After the second call, a new test-ASY.pdf is generated. 
ConTeXt generates an error because the name of the files is the same, but 
the content is not.


There should be an option for \externalfigure to disable this check, but I 
couldn't find it. Here is an alternative approach, that changes the name 
of the PDF.


\usemodule[filter]

\unprotect
\appendtoks
  \setuevalue{set\currentexternalfilter 
buffer}{\externalfilter@set[\currentexternalfilter]}%
\to \everydefineexternalfilter

\unexpanded\def\externalfilter@set
  {\dodoubleargument\externalfiter@set_indeed}

\starttexdefinition externalfiter@set_indeed [#1][#2]#3
   % #1 = filter
   % #2 = options

   \begingroup
   \edef\currentexternalfilter{#1}

   \setupexternalfilter[#1][\c!name=,#2]

   \externalfilter@set_filenames
   \setbuffer[\externalfilter@buffer_name]#3\endbuffer

   \externalfilter@process_filter
 \stoptexdefinition
\protect

\defineexternalfilter
[MARKDOWN]
[
  filtercommand={pandoc -f markdown -t context 
\externalfilterinputfile\space -o \externalfilteroutputfile},
  cache=yes,
  purge=no,
]

\define[1]\NEW
{\setMARKDOWNbuffer{This is #1}}

\traceexternalfilters

\starttext
\startMARKDOWN
  This is **one**
\stopMARKDOWN

\NEW{**ONE**}

\NEW{_TWO_}
\stoptext

Note that this has the same limitation as using \type{...}. The contents of
\NEW{...} must have matched braces. If this works, I can include the code in
t-filter (mkiv only, as I no longer want to maintain the mkii branch).

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] Asymptote or Metapost and ConTeXt parameters.

2016-12-23 Thread Jaroslav Hajtmar
Hello Adytia.
Thanks for sending Your code. It seems that it works with Asymptote. 
Unfortunately, when I am trying to multiple call a macro then I get fatal 
error, and then compile collapse. I do not know what it could be. Is it 
possible that my code is wrong. But it is possible that there is a stack 
overflow etc. It would be a need to look at why the fatal error occurs - It 
probably can evaluate Hans. Thanks again for your support. Below is my code. If 
removed commentary characters occurs advised error.

Jaroslav Hajtmar


\usemodule[filter]

\defineexternalfilter
   [ASY]
   [
 filtercommand={asy -tex context \externalfilterinputfile\space -o 
\externalfilteroutputfile}, output=\externalfilterbasefile.pdf,
 purge=no, 
 cache=yes,
 readcommand=\ReadImage,
   ]

\define[1]\ReadImage{\externalfigure[#1]}

\define[1]\mycircle{
#1 - XXX
\setbuffer[ASY]
import graph;
draw(Circle((0,0),#1));
\endbuffer
\processASYbuffer[ASY]
}

\starttext
AAA
\startASY
import graph;
draw((0,0)--(100,100));
\stopASY

BBB
\mycircle{100}


%CCC
%\mycircle{50}

%DDD
%\mycircle{200}

\stoptext





Dne 22.12.16 5:49, ntg-context za uživatele Aditya Mahajan 
 napsal(a):

On Tue, 20 Dec 2016, Jaroslav Hajtmar wrote:

> very much for your Metapost example. This I certainly sufficient for the 
> production of simple images for my ideas.

> \define[1]\mycircle{
>   \startASY
>   import graph;
>   draw(Circle((0,0),#1));
>   \stopASY
> }
>
> \starttext
> \mycircle{20}
> \mycircle{30}
> \mycircle{40}
> \stoptext

It is already feasible to define something this simple using the filter 
module. I don't have asymptote installed on the machine that I am 
currently working on, but here is an example that uses pandoc.

\usemodule[filter]

\defineexternalfilter
 [MARKDOWN]
 [
   filtercommand={pandoc -f markdown -t context 
\externalfilterinputfile\space -o \externalfilteroutputfile},
   cache=yes,
   purge=no, % Just for testing. May be removed.
 ]

\define[1]\TEST
 {\setbuffer[MARKDOWN]This is #1\endbuffer
  \processMARKDOWNbuffer[MARKDOWN]}

\starttext
\startMARKDOWN
   This is **one**
\stopMARKDOWN

\TEST{**ONE**}

\TEST{_TWO_}
\stoptext

With this method, the results are not cached. Let me know if this works 
for your needs.

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

___

___
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] Asymptote or Metapost and ConTeXt parameters.

2016-12-21 Thread Aditya Mahajan

On Tue, 20 Dec 2016, Jaroslav Hajtmar wrote:

very much for your Metapost example. This I certainly sufficient for the 
production of simple images for my ideas.



\define[1]\mycircle{
\startASY
import graph;
draw(Circle((0,0),#1));
\stopASY
}

\starttext
\mycircle{20}
\mycircle{30}
\mycircle{40}
\stoptext


It is already feasible to define something this simple using the filter 
module. I don't have asymptote installed on the machine that I am 
currently working on, but here is an example that uses pandoc.


\usemodule[filter]

\defineexternalfilter
[MARKDOWN]
[
  filtercommand={pandoc -f markdown -t context 
\externalfilterinputfile\space -o \externalfilteroutputfile},
  cache=yes,
  purge=no, % Just for testing. May be removed.
]

\define[1]\TEST
{\setbuffer[MARKDOWN]This is #1\endbuffer
 \processMARKDOWNbuffer[MARKDOWN]}

\starttext
\startMARKDOWN
  This is **one**
\stopMARKDOWN

\TEST{**ONE**}

\TEST{_TWO_}
\stoptext

With this method, the results are not cached. Let me know if this works 
for your needs.


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] Asymptote or Metapost and ConTeXt parameters.

2016-12-20 Thread Aditya Mahajan

On Tue, 20 Dec 2016, Alan Braslau wrote:


On Mon, 19 Dec 2016 08:19:25 -0800
Aditya Mahajan  wrote:


The ability to pass parameters to metapost has been around since the
beginning. See the metafun manual for details (search for MPvar).


Hans has developed tools making it quite easy to pass data back and
forth between MetaPost and lua. This is quite efficient, and it is
being used more and more in the development of macro functionality.


Thanks. It has been a few years since I read the ConTeXt+MP related part 
of the source. I'll look again to see how MP-Lua interface is developed.


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] Asymptote or Metapost and ConTeXt parameters.

2016-12-20 Thread Alan Braslau
On Mon, 19 Dec 2016 08:19:25 -0800
Aditya Mahajan  wrote:

> The ability to pass parameters to metapost has been around since the 
> beginning. See the metafun manual for details (search for MPvar).

Hans has developed tools making it quite easy to pass data back and
forth between MetaPost and lua. This is quite efficient, and it is
being used more and more in the development of macro functionality.

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] Asymptote or Metapost and ConTeXt parameters.

2016-12-20 Thread Jaroslav Hajtmar
Thanx Aditya 
very much for your Metapost example. This I certainly sufficient for the 
production of simple images for my ideas. I attach source code, which outlines 
how I imagined inserting Asymptote images into Context. In the lower part of 
commented code is fully functional, compiled ConTEXt of TeX Live 2016 (included 
in the package is also Asymptote). My idea is that Asymptote code is part of my 
ConTeXt macro and parameters of macro are passed into Asymptote. My example 
does not work because Asymptote is probably not enough linked with Context. I 
am very grateful that You would to deal with my problem. 

I am not sure whether it will do Asymptote example as in the case Metapost. 
That's why I use  filter in my own example (taken from 
https://mailman.ntg.nl/pipermail/ntg-context/2015/080581.html ).


Thank you once again.

Jaroslav Hajtmar



\usemodule[filter]

\defineexternalfilter
   [ASY]
   [
 filter={asy -tex "context" -outformat pdf
 -outname \externalfilteroutputfile},
 output=\externalfilterbasefile.pdf,
 cache=yes,
 readcommand=\ReadImage,
   ]

\define[1]\ReadImage{\externalfigure[#1]}

\define[1]\mycircle{
\startASY
import graph;
draw(Circle((0,0),#1));
\stopASY
}

\starttext
\mycircle{20}
\mycircle{30}
\mycircle{40}
\stoptext


%% simple asymptote example (compiled ConTeXt (LuaTeX) from TeX Live 2016)
%
%\usemodule[filter]
%
%\defineexternalfilter
%   [ASY]
%   [
% filter={asy -tex "context" -outformat pdf
% -outname \externalfilteroutputfile},
% output=\externalfilterbasefile.pdf,
% cache=yes,
% readcommand=\ReadImage,
%   ]
%
%\define[1]\ReadImage{\externalfigure[#1]}
%
%\starttext
%\startASY
%import graph;
%draw(Circle((0,0),20));
%\stopASY
%\stoptext


Dne 19.12.16 17:19, ntg-context za uživatele Aditya Mahajan 
 napsal(a):

On Mon, 19 Dec 2016, Jaroslav Hajtmar wrote:

> There is a similar possibility, at least in Metapost? For simpler 
> pictures it would probably suffice 

The ability to pass parameters to metapost has been around since the 
beginning. See the metafun manual for details (search for MPvar). For 
simple images, you can also do:

\define[1]\Circle{\startMPcode draw fullcircle scaled #1*cm; \stopMPcode}

\Circle{1} \Circle{2} \Circle{3}

> Is there a way to pass the ConTeXt parameter which influenced the 
> creation of the Asymptote image? My point eg. the ability to define 
> macros, which gave its parameters to Asymptote procedure or function and 
> depending on these parameters, the image created by Asymptote looked 
> differently.

In principle, something similar to \MPvar can work for asymptote as well 
(or one could do parse the content in Lua rather than expand variables in 
TeX).

> Before starting work on an illustrative example I am asking, whether it 
> makes sense to deal with such a thing ... I suppose the impossibility of 
> combining asymptote code and such Lua code (or not?).

ConTeXt and Metapost are very well integrated, even in MkII. The same 
ideas could work with other graphic backends as well (Asymptote, tikz, and 
others). But it does require a good knowledge of the graphics package.

I am willing to write the code at the context end, if someone who knows 
asymptote can tell me what needs to be done at the asymptote end.

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

___

___
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] Asymptote or Metapost and ConTeXt parameters.

2016-12-19 Thread Aditya Mahajan

On Mon, 19 Dec 2016, Jaroslav Hajtmar wrote:

There is a similar possibility, at least in Metapost? For simpler 
pictures it would probably suffice 


The ability to pass parameters to metapost has been around since the 
beginning. See the metafun manual for details (search for MPvar). For 
simple images, you can also do:


\define[1]\Circle{\startMPcode draw fullcircle scaled #1*cm; \stopMPcode}

\Circle{1} \Circle{2} \Circle{3}

Is there a way to pass the ConTeXt parameter which influenced the 
creation of the Asymptote image? My point eg. the ability to define 
macros, which gave its parameters to Asymptote procedure or function and 
depending on these parameters, the image created by Asymptote looked 
differently.


In principle, something similar to \MPvar can work for asymptote as well 
(or one could do parse the content in Lua rather than expand variables in 
TeX).


Before starting work on an illustrative example I am asking, whether it 
makes sense to deal with such a thing ... I suppose the impossibility of 
combining asymptote code and such Lua code (or not?).


ConTeXt and Metapost are very well integrated, even in MkII. The same 
ideas could work with other graphic backends as well (Asymptote, tikz, and 
others). But it does require a good knowledge of the graphics package.


I am willing to write the code at the context end, if someone who knows 
asymptote can tell me what needs to be done at the asymptote end.


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] Asymptote or Metapost and ConTeXt parameters.

2016-12-19 Thread Hans Hagen

On 12/19/2016 10:10 AM, Fabrice Couvreur wrote:

Hello,
I do not answer the question, but I'm interested because I also use
Asymptote. The following code works with context in texlive 2016 but
does not work with standalone context.
thank you,


it probably depends on what you want to pass as info (i don't have 
asymptote installed nor time to check it) but if the code you pass gets 
expanded then you can add expandable macros or \the\foo kind of code to it


Hans


Fabrice
% macros=mkvi

\usemodule[filter]

\defineexternalfilter
   [ASY]
   [
 filter={asy -tex "context" -outformat pdf
 -outname \externalfilteroutputfile},
 output=\externalfilterbasefile.pdf,
 cache=yes,
 readcommand=\ReadImage,
   ]

\define[1]\ReadImage{\externalfigure[#1]}

\starttext
   Testing if we can include an asymptote image
   \startplacefigure[location={here}, title={An Asymptote figure}]
 \startASY
   import three;
size(8cm,0);
currentlight.background=black;

material White(real x, real y){
   return material(diffusepen=gray(.05+.1x+.3y),
   emissivepen=gray(.05+.1x+.3y));
}

for(int y=0; y<=2; ++y)
for(int x=0; x<3; ++x)
draw(shift(2x,2y,0)*unitsphere,White(x,y));
 \stopASY
   \stopplacefigure
\stoptext


2016-12-19 8:41 GMT+01:00 Jaroslav Hajtmar mailto:hajt...@gyza.cz>>:

Hello ConTeXtist,

I saw the opportunity to insert an Asymptote picture into Context
source code (due filter).

For example here:
https://mailman.ntg.nl/pipermail/ntg-context/2015/080581.html
<https://mailman.ntg.nl/pipermail/ntg-context/2015/080581.html>

__ __

Is there a way to pass the ConTeXt parameter which influenced the
creation of the Asymptote image? My point eg. the ability to define
macros, which gave its parameters to Asymptote procedure or function
and depending on these parameters, the image created by Asymptote
looked differently.

__ __

Before starting work on an illustrative example I am asking, whether
it makes sense to deal with such a thing ... I suppose the
impossibility of combining asymptote code and such Lua code (or
not?).

__ __

There is a similar possibility, at least in Metapost? For simpler
pictures it would probably suffice 

__ __

Thanx 

Jaroslav Hajtmar

__ __



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

maillist : ntg-context@ntg.nl <mailto:ntg-context@ntg.nl> /
http://www.ntg.nl/mailman/listinfo/ntg-context
<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/
<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
___




--

-
  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] Asymptote or Metapost and ConTeXt parameters.

2016-12-19 Thread Fabrice Couvreur
Hello,
I do not answer the question, but I'm interested because I also use
Asymptote. The following code works with context in texlive 2016 but does
not work with standalone context.
thank you,
Fabrice
% macros=mkvi

\usemodule[filter]

\defineexternalfilter
   [ASY]
   [
 filter={asy -tex "context" -outformat pdf
 -outname \externalfilteroutputfile},
 output=\externalfilterbasefile.pdf,
 cache=yes,
 readcommand=\ReadImage,
   ]

\define[1]\ReadImage{\externalfigure[#1]}

\starttext
   Testing if we can include an asymptote image
   \startplacefigure[location={here}, title={An Asymptote figure}]
 \startASY
   import three;
size(8cm,0);
currentlight.background=black;

material White(real x, real y){
   return material(diffusepen=gray(.05+.1x+.3y),
   emissivepen=gray(.05+.1x+.3y));
}

for(int y=0; y<=2; ++y)
for(int x=0; x<3; ++x)
draw(shift(2x,2y,0)*unitsphere,White(x,y));
 \stopASY
   \stopplacefigure
\stoptext


2016-12-19 8:41 GMT+01:00 Jaroslav Hajtmar :

> Hello ConTeXtist,
>
> I saw the opportunity to insert an Asymptote picture into Context source
> code (due filter).
>
> For example here: https://mailman.ntg.nl/pipermail/ntg-context/2015/
> 080581.html
>
>
>
> Is there a way to pass the ConTeXt parameter which influenced the creation
> of the Asymptote image? My point eg. the ability to define macros, which
> gave its parameters to Asymptote procedure or function and depending on
> these parameters, the image created by Asymptote looked differently.
>
>
>
> Before starting work on an illustrative example I am asking, whether it
> makes sense to deal with such a thing ... I suppose the impossibility of
> combining asymptote code and such Lua code (or not?).
>
>
>
> There is a similar possibility, at least in Metapost? For simpler pictures
> it would probably suffice 
>
>
>
> Thanx
>
> Jaroslav Hajtmar
>
>
>
> 
> ___
> 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] Asymptote or Metapost and ConTeXt parameters.

2016-12-18 Thread Jaroslav Hajtmar
Hello ConTeXtist,
I saw the opportunity to insert an Asymptote picture into Context source code 
(due filter).
For example here: https://mailman.ntg.nl/pipermail/ntg-context/2015/080581.html

Is there a way to pass the ConTeXt parameter which influenced the creation of 
the Asymptote image? My point eg. the ability to define macros, which gave its 
parameters to Asymptote procedure or function and depending on these 
parameters, the image created by Asymptote looked differently.

Before starting work on an illustrative example I am asking, whether it makes 
sense to deal with such a thing ... I suppose the impossibility of combining 
asymptote code and such Lua code (or not?).

There is a similar possibility, at least in Metapost? For simpler pictures it 
would probably suffice 

Thanx
Jaroslav Hajtmar

___
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] Bug in latest beta, shifted metapost (possibly with drawarrow)

2016-11-04 Thread Hans Hagen

On 11/3/2016 5:09 PM, Mikael P. Sundqvist wrote:

Dear list,

the example below has shifted axes. I updated to the latest standalone
earlier today. The problem was not present some weeks ago.

In particular look at the red line that should start from the origin...

\starttext
\startMPpage
ut:=1.0cm;
ux:=0.6cm;

vardef diffp(expr riktn) =
 ((-1,0)--(1,0)) rotatedaround (origin,angle(ut,riktn*ux))
enddef;

path taxel,xaxel;
taxel:=((-1.4,0)--(5.4,0));
xaxel:=((0,-1.4)--(0,4.6));
drawarrow taxel xyscaled(ut,ux);
drawarrow xaxel xyscaled(ut,ux);

label.bot("$t$", (point length(taxel) of taxel) xyscaled(ut,ux));
label.lft("$P$", (point length(xaxel) of xaxel) xyscaled(ut,ux));

draw image(
 vardef fun(expr t, x) = x*(3-x) enddef;
 for i=-1 step 0.5 until 5 :
  for j=-1 step 0.5 until 4 :
ii:=i;
jj:=j;
draw diffp(fun(ii,jj)) scaled 2bp shifted (ii*ut,jj*ux);
  endfor;
 endfor;

draw function (2, "x", "3/(1+2*exp(-3*x))" ,-1, 5, 1/5) xyscaled (ut,ux);

draw (0,0)--(3,3) xyscaled(ut,ux) withcolor darkred;

);
\stopMPpage
\stoptext


I'll fix it. Alan: we really need this one then:

vardef image@#(text t) =
save currentpicture ;
picture currentpicture ;
currentpicture := nullpicture ;
t ;
currentpicture
if str @# <> "" :
shifted (
  mfun_labxf@#   * lrcorner currentpicture
 + mfun_labyf@#  * ulcorner currentpicture
 + (1-mfun_labxf@#-mfun_labyf@#) * llcorner currentpicture
)
fi
enddef ;




--

-
  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] Bug in latest beta, shifted metapost (possibly with drawarrow)

2016-11-03 Thread Mikael P. Sundqvist
Dear list,

the example below has shifted axes. I updated to the latest standalone
earlier today. The problem was not present some weeks ago.

In particular look at the red line that should start from the origin...

\starttext
\startMPpage
ut:=1.0cm;
ux:=0.6cm;

vardef diffp(expr riktn) =
 ((-1,0)--(1,0)) rotatedaround (origin,angle(ut,riktn*ux))
enddef;

path taxel,xaxel;
taxel:=((-1.4,0)--(5.4,0));
xaxel:=((0,-1.4)--(0,4.6));
drawarrow taxel xyscaled(ut,ux);
drawarrow xaxel xyscaled(ut,ux);

label.bot("$t$", (point length(taxel) of taxel) xyscaled(ut,ux));
label.lft("$P$", (point length(xaxel) of xaxel) xyscaled(ut,ux));

draw image(
 vardef fun(expr t, x) = x*(3-x) enddef;
 for i=-1 step 0.5 until 5 :
  for j=-1 step 0.5 until 4 :
ii:=i;
jj:=j;
draw diffp(fun(ii,jj)) scaled 2bp shifted (ii*ut,jj*ux);
  endfor;
 endfor;

draw function (2, "x", "3/(1+2*exp(-3*x))" ,-1, 5, 1/5) xyscaled (ut,ux);

draw (0,0)--(3,3) xyscaled(ut,ux) withcolor darkred;

);
\stopMPpage
\stoptext

/Mikael


ctx-listexample17.pdf
Description: Adobe PDF document
___
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] ANN: Updated Vim scripts for METAFONT/MetaPost

2016-10-05 Thread luigi scarso
On Wed, Oct 5, 2016 at 10:26 AM, Nicola  wrote:
> FYI:
> https://github.com/vim/vim/commit/2ec618c9feac4573b154510236ad8121c77d0eca
>
> Click on "changed files".
>
good.

Btw
http://www.guitex.org/home/meeting

-- 
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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___

Re: [NTG-context] ANN: Updated Vim scripts for METAFONT/MetaPost

2016-09-18 Thread Nicola

On 2016-09-18 12:09:12 +, luigi scarso said:


On Sun, Sep 18, 2016 at 12:46 PM, Nicola  wrote:

Hello,
as a Vim user, I was not satisfied with its support for MetaPost
(especially indenting). I have updated the {mf,mp}.vim scripts
in Vim, which you find attached, and which I have forwarded to
the respective maintainers. Hopefully, they will be included in
a future release of Vim. For the time being, just unpack and put
in your .vim folder.


Thank you very much !


Mini ascii-cast: https://asciinema.org/a/9a101ghqmipqqmw3x61erwmx8

Nicola


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

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

Re: [NTG-context] [metapost] ANN: Updated Vim scripts for METAFONT/MetaPost

2016-09-18 Thread luigi scarso
On Sun, Sep 18, 2016 at 12:46 PM, Nicola  wrote:
> Hello,
> as a Vim user, I was not satisfied with its support for MetaPost
> (especially indenting). I have updated the {mf,mp}.vim scripts
> in Vim, which you find attached, and which I have forwarded to
> the respective maintainers. Hopefully, they will be included in
> a future release of Vim. For the time being, just unpack and put
> in your .vim folder.

Thank you very much !


-- 
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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___

Re: [NTG-context] ANN: Updated Vim scripts for METAFONT/MetaPost

2016-09-18 Thread Nicola

On 2016-09-18 10:46:44 +, Nicola said:


 I have updated the {mf,mp}.vim scripts in Vim



ConTeXt users will benefit from these scripts, too, inside MetaPost
environments.


Put these lines in ./vim/after/ftplugin/context.vim:

setlocal omnifunc=syntaxcomplete#Complete
let g:omni_syntax_group_include_context_mp='mf\w\+,mp\w\+'

(note the ..._context_mp) and set the filetype of your document as
follows:

:set ft=context.mp

The only drawback is that indentation rules are applied throughout the
whole document, not only to the MetaPost parts. Depending on how many
'if' and 'forever' there are in your novel, it might get annoying.

Nicola


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

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

Re: [NTG-context] Info about MetaPost

2016-09-09 Thread Nicola

On 2016-09-09 13:21:21 +, luigi scarso said:


On Fri, Sep 9, 2016 at 12:47 PM, Nicola  wrote:

Hi,
I write to this mailing list because the MetaPost mailing list has been
silent for a while. I hope it is ok.

I am getting to grips with MetaPost after a long hiatus, so I have not
followed recent developments. I see that the version shipped with
TeX Live 2016 is 1.9991 and that the current maintainer is Luigi.
My questions:

- What is the official MetaPost site (if there is any), with the latest
source (superlec.fr does not seem up to date and I cannot find any
code on CTAN)?

svn at supelec
https://foundry.supelec.fr/scm/viewvc.php/?root=metapost


I should have taken a deeper look. I was misled by the main page:

https://foundry.supelec.fr/projects/metapost/

which still reports 1.902 as the latest release.

Thanks!
Nicola


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

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

Re: [NTG-context] Info about MetaPost

2016-09-09 Thread luigi scarso
On Fri, Sep 9, 2016 at 12:47 PM, Nicola  wrote:
> Hi,
> I write to this mailing list because the MetaPost mailing list has been
> silent for a while. I hope it is ok.
>
> I am getting to grips with MetaPost after a long hiatus, so I have not
> followed recent developments. I see that the version shipped with
> TeX Live 2016 is 1.9991 and that the current maintainer is Luigi.
> My questions:
>
> - What is the official MetaPost site (if there is any), with the latest
>  source (superlec.fr does not seem up to date and I cannot find any
>  code on CTAN)?
svn at supelec
https://foundry.supelec.fr/scm/viewvc.php/?root=metapost

>
> - Are there any release notes to know what has changed since version 1.90x?
>
hm, the file CHANGES

> - I know that LuaTeX uses an embedded version of MetaPost. Is that aligned
>  with the stand-alone executable (mpost)?
yes, always, otherwise it's an error.



-- 
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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___

[NTG-context] Info about MetaPost

2016-09-09 Thread Nicola

Hi,
I write to this mailing list because the MetaPost mailing list has been
silent for a while. I hope it is ok.

I am getting to grips with MetaPost after a long hiatus, so I have not
followed recent developments. I see that the version shipped with
TeX Live 2016 is 1.9991 and that the current maintainer is Luigi.
My questions:

- What is the official MetaPost site (if there is any), with the latest
 source (superlec.fr does not seem up to date and I cannot find any
 code on CTAN)?

- Are there any release notes to know what has changed since version 1.90x?

- I know that LuaTeX uses an embedded version of MetaPost. Is that aligned
 with the stand-alone executable (mpost)?

Thanks in advance,
Nicola


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

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

Re: [NTG-context] Randomize control points in metapost/metafun?

2016-08-01 Thread Hans Hagen

On 8/1/2016 12:47 PM, Mikael P. Sundqvist wrote:


Wow! That was fast! I just updated and it indeed works as expected.

I hate to ask another thing when I just got this fast and nice help,
but is there also a way to change the control points in such a way
that no _new_ sharp corners occur?


that's a challenge for alan (who likes mp challenges) as it involves math

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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___

Re: [NTG-context] Randomize control points in metapost/metafun?

2016-08-01 Thread Mikael P. Sundqvist
On Mon, Aug 1, 2016 at 10:12 AM, Hans Hagen  wrote:
> On 8/1/2016 8:03 AM, Mikael P. Sundqvist wrote:
>>
>> Hi!
>>
>> I look for a way to randomize control points of a path, leaving the
>> coordinates themselves untouched.
>>
>> The reason is the following: I want to draw (for example) a circle
>> with a triangle inside, and I want them to look slightly randomized.
>> If I do (see attached pdf for a typical result of this)
>>
>> \startMPpage
>> draw fullcircle scaled 2cm randomized 0.1cm;
>> draw ((1cm,0)--(0,1cm)--(-1cm,0)--cycle) randomized 0.1cm;
>> \stopMPpage
>>
>> then the corners of the triangle does not stay on the circle (and I
>> want them to). [I dont want the triangle to consist of perfectly
>> straight lines, so I cannot (directly) draw the triangle using
>> different points along the randomized circle] I imagine that one could
>> achieve what I want if one could randomize the control points only.
>
>
> i'll add
>
> primarydef p randomizedcontrols s = (
> if path p :
> for i=0 upto length(p)-1 :
>  (point   iof p) .. controls
> ((postcontrol iof p) randomshifted s) and
> ((precontrol (i+1) of p) randomshifted s) ..
> endfor
> if cycle p :
> cycle
> else :
> (point length(p) of p)
> fi
> else :
> p randomized s
> fi
> ) enddef ;
>
>> Also, is it possible to randomize a picture (consisting of several
>> paths/points) somehow, without randomizing each part of it manually?
>
>
> so:
>
> vardef mfun_randomized_path(expr p,s) =
> for i=0 upto length(p)-1 :
>  (point   iof p) .. controls
> ((postcontrol iof p) randomshifted s) and
> ((precontrol (i+1) of p) randomshifted s) ..
> endfor
> if cycle p :
> cycle
> else :
> (point length(p) of p)
> fi
> enddef;
>
> vardef mfun_randomized_picture(expr p,s) =
> save currentpicture ;
> picture currentpicture ;
> currentpicture := nullpicture ;
> for i within p :
> addto currentpicture
> if stroked i :
> doublepath pathpart i randomizedcontrols s
> dashed dashpart i
> withpen penpart i
> withcolor colorpart i
> withprescript prescriptpart i
> withpostscript postscriptpart i
> elseif filled i :
> contour pathpart i randomizedcontrols s
> withpen penpart i
> withcolor colorpart i
> withprescript prescriptpart i
> withpostscript postscriptpart i
> else :
> also i
> fi
> ;
> endfor ;
> currentpicture
> enddef ;
>
> primarydef p randomizedcontrols s = (
> if path p :
> mfun_randomized_path(p,s)
> elseif picture p :
> mfun_randomized_picture(p,s)
> else :
> p randomized s
> fi
> ) enddef ;
>
> with
>
> draw fullcircle scaled 2cm randomizedcontrols 0.1cm;
> draw ((1cm,0)--(0,1cm)--(-1cm,0)--cycle) randomizedcontrols 0.1cm;
>
> draw image (
> draw fullcircle scaled 2cm ;
> draw ((1cm,0)--(0,1cm)--(-1cm,0)--cycle);
> ) randomizedcontrols 0.1cm ;
>
>
>
> -
>   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://tex.aanhet.net
> archive  : http://foundry.supelec.fr/projects/contextrev/
> wiki : http://contextgarden.net
> ___

Wow! That was fast! I just updated and it indeed works as expected.

I hate to ask another thing when I just got this fast and nice help,
but is there also a way to change the control points in such a way
that no _new_ sharp corners occur?

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

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

Re: [NTG-context] Randomize control points in metapost/metafun?

2016-08-01 Thread Hans Hagen

On 8/1/2016 8:03 AM, Mikael P. Sundqvist wrote:

Hi!

I look for a way to randomize control points of a path, leaving the
coordinates themselves untouched.

The reason is the following: I want to draw (for example) a circle
with a triangle inside, and I want them to look slightly randomized.
If I do (see attached pdf for a typical result of this)

\startMPpage
draw fullcircle scaled 2cm randomized 0.1cm;
draw ((1cm,0)--(0,1cm)--(-1cm,0)--cycle) randomized 0.1cm;
\stopMPpage

then the corners of the triangle does not stay on the circle (and I
want them to). [I dont want the triangle to consist of perfectly
straight lines, so I cannot (directly) draw the triangle using
different points along the randomized circle] I imagine that one could
achieve what I want if one could randomize the control points only.


i'll add

primarydef p randomizedcontrols s = (
if path p :
for i=0 upto length(p)-1 :
 (point   iof p) .. controls
((postcontrol iof p) randomshifted s) and
((precontrol (i+1) of p) randomshifted s) ..
endfor
if cycle p :
cycle
else :
(point length(p) of p)
fi
else :
p randomized s
fi
) enddef ;


Also, is it possible to randomize a picture (consisting of several
paths/points) somehow, without randomizing each part of it manually?


so:

vardef mfun_randomized_path(expr p,s) =
for i=0 upto length(p)-1 :
 (point   iof p) .. controls
((postcontrol iof p) randomshifted s) and
((precontrol (i+1) of p) randomshifted s) ..
endfor
if cycle p :
cycle
else :
(point length(p) of p)
fi
enddef;

vardef mfun_randomized_picture(expr p,s) =
save currentpicture ;
picture currentpicture ;
currentpicture := nullpicture ;
for i within p :
addto currentpicture
if stroked i :
doublepath pathpart i randomizedcontrols s
dashed dashpart i
withpen penpart i
withcolor colorpart i
withprescript prescriptpart i
withpostscript postscriptpart i
elseif filled i :
contour pathpart i randomizedcontrols s
withpen penpart i
withcolor colorpart i
withprescript prescriptpart i
withpostscript postscriptpart i
else :
also i
fi
;
endfor ;
currentpicture
enddef ;

primarydef p randomizedcontrols s = (
if path p :
mfun_randomized_path(p,s)
elseif picture p :
mfun_randomized_picture(p,s)
else :
p randomized s
fi
) enddef ;

with

draw fullcircle scaled 2cm randomizedcontrols 0.1cm;
draw ((1cm,0)--(0,1cm)--(-1cm,0)--cycle) randomizedcontrols 0.1cm;

draw image (
draw fullcircle scaled 2cm ;
draw ((1cm,0)--(0,1cm)--(-1cm,0)--cycle);
) randomizedcontrols 0.1cm ;



-
  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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___

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