[NTG-context] Re: Metapost limitation ?

2024-05-12 Thread Mikael Sundqvist
Hi,

On Sun, May 12, 2024 at 6:24 PM Fabrice Couvreur <
fabrice1.couvr...@gmail.com> wrote:
>
> With Okular, it works !

Very good. You can still try the thing below:

\startluacode
  local exp = math.exp
  local N   = 1000
  local xstep  = 1.6/N
  local ystep  = 1.8/N
  local xmin   = 0.3
  local ymin   = 0.4

  local function f(x,y)
local x = xstep*x - xmin
local y = ystep*y - ymin
local z = x + exp(-60*x) - y
if z > 0 then
  return '1'
else
  return '0'
end
  end

  potrace.setbitmap("mybitmap", potrace.contourplot(N,N,f))
\stopluacode

\startMPpage[offset=1dk]
  path p ; p := lmt_potraced [
stringname = "mybitmap",
value  = "1",
tolerance  = 0.1,
threshold  = 0.2,
optimize   = true,
  ] ;
  p := p xsized 10cm ;
  draw p withpen pencircle scaled 5 withcolor "darkblue" ;
  drawpoints p withcolor "orange" ;
  drawpointlabels p ;
  p := subpath(6,19) of p ;
  draw p withpen pencircle scaled 3 withcolor "yellow" ;
\stopMPpage

Another thing, Hans added nocycle, so you can write your loop if you want
to use it as something like

  def compute_curve(suffix f)(expr xmin, xmax, xinc) =
  for x=xmin step xinc until xmax:
   (x,f(x)) ..
  endfor nocycle ;
  enddef;

Then you do not need to think about the first and/or last point separately.
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: Metapost limitation ?

2024-05-12 Thread Fabrice Couvreur
With Okular, it works !

Le dim. 12 mai 2024 à 17:55, Hans Hagen  a écrit :

> On 5/12/2024 5:36 PM, Fabrice Couvreur wrote:
> > Sorry for the comment !
> > I use Evince
> so how about okular or mupdf
>
> -
>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 /
> https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
> webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
> archive  : https://github.com/contextgarden/context
> wiki : https://wiki.contextgarden.net
>
> ___
>
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: Metapost limitation ?

2024-05-12 Thread Hans Hagen

On 5/12/2024 5:36 PM, Fabrice Couvreur wrote:

Sorry for the comment !
I use Evince

so how about okular or mupdf

-
  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 / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: Metapost limitation ?

2024-05-12 Thread Fabrice Couvreur
Sorry for the comment !
I use Evince

Le dim. 12 mai 2024 à 17:30, Hans Hagen  a écrit :

> On 5/12/2024 3:57 PM, Fabrice Couvreur wrote:
> > Hi,
> > When I want to draw the curve which corresponds to n=60 (blue curve), it
> > doesn't seem possible: I don't understand.
> > Thanks
> > Fabrice
> >
> >   \startMPpage[offset=1DK]
> >
> >numeric u;
> >u = 6cm;
> >
> >interim linejoin := mitered;
> >interim ahangle := 30;
> >
> >path xx, yy;
> >xx = ( (-0.3,0) -- 1.4 right) scaled u;
> >yy = ( (-0.1,0) -- 1.8 right) rotated 90 scaled u;
> >
> >def compute_curve(suffix f)(expr xmin, xmax, xinc) =
> >((xmin,f(xmin))
> >for x=xmin+xinc step xinc until xmax:
> > .. (x,f(x))
> >endfor)
> >enddef;
> >
> >
> >for i = 1 upto 4:
> >
> >vardef f(expr x) =x+exp(-i*x) enddef;
> >
> >path curve;
> >
> >curve = compute_curve(f,-0.4,1.4,0.0001) scaled u;
> >
> >draw curve;
> >
> >endfor;
> >
> >vardef f(expr x) =x+exp(-6*x) enddef;
> >
> >path curve;
> >
> >curve = compute_curve(f,-0.4,1.4,0.0001) scaled u;
> >
> >draw curve;
> >
> >vardef f(expr x) =x+exp(-15*x) enddef;
> >
> >path curve;
> >
> >curve = compute_curve(f,-0.4,1.4,0.0001) scaled u;
> >
> >draw curve;
> >
> >
> >vardef f(expr x) =x+exp(-60*x) enddef;
> >
> >path curve;
> >
> >curve = compute_curve(f,-0.4,1.4,0.0001) scaled u; -> not
> > drawn
>
> best put a comment before the ->>>
>
> >draw curve withcolor blue;
> >
> >
> >drawarrow (0,0) -- (u,0) withpen pencircle scaled 1.5bp;
> >drawarrow (0,0) -- (0,u) withpen pencircle scaled 1.5bp;
> >
> >
> >label.urt("A",(0,1u));
> >
> >draw xx;
> >draw  yy;
> >
> >draw (1u,0) -- (1u,1.8u);
> >
> >
> >label.llft("0",(0,0));
> >
> > vardef mark_y_axis(expr value, name) =
> >  save p; pair p; p = value * u * up;
> >  draw (left--right) scaled 1 shifted p;
> >  label.lft(name, p shifted 2 left);
> >enddef;
> >
> >for a = 1 upto 1:
> >  mark_y_axis(a, "");
> >endfor
> >
> > mark_y_axis(1, "$1$");
> >
> >
> >   vardef mark_x_axis(expr value, name) =
> > save p; pair p; p = value * u * right;
> > draw (up--down) scaled 1 shifted p;
> > label.bot(name, p shifted 2 down);
> >   enddef;
> >
> >   for a = 1 upto 1:
> > mark_x_axis(a, "");
> >   endfor
> >
> >   mark_x_axis(1, "$1$");
> >
> >
> >path rectangle;
> >rectangle = (-0.3u,-0.4u) -- (1.3u,-0.4u) -- (1.3u,-0.4u) --
> > (1.3u,1.4u) -- (-0.3u,1.4u)--cycle;
> >
> >clip currentpicture to rectangle;
> >   \stopMPpage
> >
> your exp usage:
>
>exp(-60*-0.4)
>
> if you see what huge numbers come out of that, like
>
> -51.006602 11100558579.857309 l
> -50.989594 11034154639.123087 l
> -50.972586 10968147929.149401 l
> -50.955579 10902536073.687559 l
> -50.938571 10837316710.703716 l
>
> you could imagine a viewer crapping out on that because no matter what
> one clips it still is 'kind of drawn', so what viewer do you use?
>
> 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 /
> https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
> webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
> archive  : https://github.com/contextgarden/context
> wiki : https://wiki.contextgarden.net
>
> ___
>
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: Metapost limitation ?

2024-05-12 Thread Hans Hagen

On 5/12/2024 3:57 PM, Fabrice Couvreur wrote:

Hi,
When I want to draw the curve which corresponds to n=60 (blue curve), it 
doesn't seem possible: I don't understand.

Thanks
Fabrice

  \startMPpage[offset=1DK]

           numeric u;
           u = 6cm;

           interim linejoin := mitered;
           interim ahangle := 30;

           path xx, yy;
           xx = ( (-0.3,0) -- 1.4 right) scaled u;
           yy = ( (-0.1,0) -- 1.8 right) rotated 90 scaled u;

           def compute_curve(suffix f)(expr xmin, xmax, xinc) =
               ((xmin,f(xmin))
               for x=xmin+xinc step xinc until xmax:
                    .. (x,f(x))
               endfor)
           enddef;


           for i = 1 upto 4:

           vardef f(expr x) =x+exp(-i*x) enddef;

           path curve;

           curve = compute_curve(f,-0.4,1.4,0.0001) scaled u;

           draw curve;

           endfor;

           vardef f(expr x) =x+exp(-6*x) enddef;

           path curve;

           curve = compute_curve(f,-0.4,1.4,0.0001) scaled u;

           draw curve;

           vardef f(expr x) =x+exp(-15*x) enddef;

           path curve;

           curve = compute_curve(f,-0.4,1.4,0.0001) scaled u;

           draw curve;


           vardef f(expr x) =x+exp(-60*x) enddef;

           path curve;

           curve = compute_curve(f,-0.4,1.4,0.0001) scaled u; -> not 
drawn


best put a comment before the ->>>


           draw curve withcolor blue;


           drawarrow (0,0) -- (u,0) withpen pencircle scaled 1.5bp;
           drawarrow (0,0) -- (0,u) withpen pencircle scaled 1.5bp;


           label.urt("A",(0,1u));

           draw xx;
           draw  yy;

           draw (1u,0) -- (1u,1.8u);


           label.llft("0",(0,0));

            vardef mark_y_axis(expr value, name) =
             save p; pair p; p = value * u * up;
             draw (left--right) scaled 1 shifted p;
             label.lft(name, p shifted 2 left);
           enddef;

           for a = 1 upto 1:
             mark_y_axis(a, "");
           endfor

            mark_y_axis(1, "$1$");


          vardef mark_x_axis(expr value, name) =
            save p; pair p; p = value * u * right;
            draw (up--down) scaled 1 shifted p;
            label.bot(name, p shifted 2 down);
          enddef;

          for a = 1 upto 1:
            mark_x_axis(a, "");
          endfor

          mark_x_axis(1, "$1$");


           path rectangle;
           rectangle = (-0.3u,-0.4u) -- (1.3u,-0.4u) -- (1.3u,-0.4u) -- 
(1.3u,1.4u) -- (-0.3u,1.4u)--cycle;


           clip currentpicture to rectangle;
          \stopMPpage


your exp usage:

  exp(-60*-0.4)

if you see what huge numbers come out of that, like

-51.006602 11100558579.857309 l
-50.989594 11034154639.123087 l
-50.972586 10968147929.149401 l
-50.955579 10902536073.687559 l
-50.938571 10837316710.703716 l

you could imagine a viewer crapping out on that because no matter what 
one clips it still is 'kind of drawn', so what viewer do you use?


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 / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Metapost limitation ?

2024-05-12 Thread Fabrice Couvreur
Hi,
When I want to draw the curve which corresponds to n=60 (blue curve), it
doesn't seem possible: I don't understand.
Thanks
Fabrice

 \startMPpage[offset=1DK]

  numeric u;
  u = 6cm;

  interim linejoin := mitered;
  interim ahangle := 30;

  path xx, yy;
  xx = ( (-0.3,0) -- 1.4 right) scaled u;
  yy = ( (-0.1,0) -- 1.8 right) rotated 90 scaled u;

  def compute_curve(suffix f)(expr xmin, xmax, xinc) =
  ((xmin,f(xmin))
  for x=xmin+xinc step xinc until xmax:
   .. (x,f(x))
  endfor)
  enddef;


  for i = 1 upto 4:

  vardef f(expr x) =x+exp(-i*x) enddef;

  path curve;

  curve = compute_curve(f,-0.4,1.4,0.0001) scaled u;

  draw curve;

  endfor;

  vardef f(expr x) =x+exp(-6*x) enddef;

  path curve;

  curve = compute_curve(f,-0.4,1.4,0.0001) scaled u;

  draw curve;

  vardef f(expr x) =x+exp(-15*x) enddef;

  path curve;

  curve = compute_curve(f,-0.4,1.4,0.0001) scaled u;

  draw curve;


  vardef f(expr x) =x+exp(-60*x) enddef;

  path curve;

  curve = compute_curve(f,-0.4,1.4,0.0001) scaled u; -> not
drawn

  draw curve withcolor blue;


  drawarrow (0,0) -- (u,0) withpen pencircle scaled 1.5bp;
  drawarrow (0,0) -- (0,u) withpen pencircle scaled 1.5bp;


  label.urt("A",(0,1u));

  draw xx;
  draw  yy;

  draw (1u,0) -- (1u,1.8u);


  label.llft("0",(0,0));

   vardef mark_y_axis(expr value, name) =
save p; pair p; p = value * u * up;
draw (left--right) scaled 1 shifted p;
label.lft(name, p shifted 2 left);
  enddef;

  for a = 1 upto 1:
mark_y_axis(a, "");
  endfor

   mark_y_axis(1, "$1$");


 vardef mark_x_axis(expr value, name) =
   save p; pair p; p = value * u * right;
   draw (up--down) scaled 1 shifted p;
   label.bot(name, p shifted 2 down);
 enddef;

 for a = 1 upto 1:
   mark_x_axis(a, "");
 endfor

 mark_x_axis(1, "$1$");


  path rectangle;
  rectangle = (-0.3u,-0.4u) -- (1.3u,-0.4u) -- (1.3u,-0.4u) --
(1.3u,1.4u) -- (-0.3u,1.4u)--cycle;

  clip currentpicture to rectangle;
 \stopMPpage
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: The graph is not visible.

2024-04-25 Thread Fabrice Couvreur
Hi,
Here is the code that interferes with the graph from the last chapter but
why ?

 \startMPcode
 pickup pencircle xscaled 1;
 defaultfont  := "texgyrepagella-regular*default" ;
 defaultscale := 0.8 ;
 path circle, p, q, b;

 circle = fullcircle xscaled 5cm yscaled 3.5cm;
 p = (point 2 of circle .. (-0.15cm,1.5cm)
..(0,0)..(0.15cm,-1.5cm).. point 6 of circle);
 q = (subpath(0,2) of circle -- p -- subpath(6,8) of circle
--cycle);
 b = (reverse p -- subpath(2,6) of circle -- cycle);

 definecolor [ name = "mp:red", r = 1 ];
 definecolor [ name = "mp:blue", r = 0.54, g = 0.17, b = 0.89 ];

 fill q withcolor "mp:red" withtransparency(1,0.4) ;
 fill b withcolor "mp:blue" withtransparency(1,0.4) ;
 draw circle;
 draw p;

 label("$\overline{\text{A}}$",( 1.5cm,0));
 label("$\text{A}$",(-1.5cm,0));
 label.top("E",(0,1.85cm));
   \stopMPcode

Le jeu. 25 avr. 2024 à 16:55, Fabrice Couvreur 
a écrit :

> Hi Hans and Taco,
> @Hans, I compiled by commenting and uncommenting one component at a time;
> it is component 5 which interferes with the metapost code of component 14
> All I have to do now is find out what the cause is.
> Fabrice
>
> Le jeu. 25 avr. 2024 à 16:40, Taco Hoekwater  a écrit :
>
>>
>>
>> > On 25 Apr 2024, at 16:08, Fabrice Couvreur 
>> wrote:
>> >
>> > Hi Taco,
>> > I knew I wouldn't be able to explain what was happening.
>> > The code works perfectly and the figure is clearly visible in the
>> component chapter-14 :
>>
>> It is probably not related to the figure itself. Something may be
>> different in this component compared to the other ones. I cannot really
>> say, of course. Still, using external image instead of inline metapost may
>> be fix it. Not elegant, but if it works it works!
>>
>> Good luck,
>> Taco
>>
>>
>> >
>> > \startcomponent[chapter-14]
>> > \startMPpage
>> > ...
>> > \stopMPpage
>> > \stopcomponent
>> >
>> > But if I compile my project, it disappears !!
>> >
>> > \startproduct[terminale-manual]
>> >  \startbodymatter
>> >   \component[chapter-1]
>> >   \component[chapter-2]
>> >   \component[chapter-3]
>> >   \component[chapter-4]
>> >   \component[chapter-5]
>> >   \component[chapter-6]
>> >   \component[chapter-7]
>> >   \component[chapter-8]
>> >   \component[chapter-9]
>> >   \component[chapter-10]
>> >   \component[chapter-11]
>> >   \component[chapter-12]
>> >   \component[chapter-13]
>> >   \component[chapter-14]
>> > \stopbodymatter
>> > \stopproduct
>>
>> —
>> Taco Hoekwater  E: t...@bittext.nl
>> genderfluid (all pronouns)
>>
>>
>>
>> ___
>> If your question is of interest to others as well, please add an entry to
>> the Wiki!
>>
>> maillist : ntg-context@ntg.nl /
>> https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
>> webpage  : https://www.pragma-ade.nl / https://context.aanhet.net
>> (mirror)
>> archive  : https://github.com/contextgarden/context
>> wiki : https://wiki.contextgarden.net
>>
>> ___
>>
>
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: The graph is not visible.

2024-04-25 Thread Fabrice Couvreur
Hi Hans and Taco,
@Hans, I compiled by commenting and uncommenting one component at a time;
it is component 5 which interferes with the metapost code of component 14
All I have to do now is find out what the cause is.
Fabrice

Le jeu. 25 avr. 2024 à 16:40, Taco Hoekwater  a écrit :

>
>
> > On 25 Apr 2024, at 16:08, Fabrice Couvreur 
> wrote:
> >
> > Hi Taco,
> > I knew I wouldn't be able to explain what was happening.
> > The code works perfectly and the figure is clearly visible in the
> component chapter-14 :
>
> It is probably not related to the figure itself. Something may be
> different in this component compared to the other ones. I cannot really
> say, of course. Still, using external image instead of inline metapost may
> be fix it. Not elegant, but if it works it works!
>
> Good luck,
> Taco
>
>
> >
> > \startcomponent[chapter-14]
> > \startMPpage
> > ...
> > \stopMPpage
> > \stopcomponent
> >
> > But if I compile my project, it disappears !!
> >
> > \startproduct[terminale-manual]
> >  \startbodymatter
> >   \component[chapter-1]
> >   \component[chapter-2]
> >   \component[chapter-3]
> >   \component[chapter-4]
> >   \component[chapter-5]
> >   \component[chapter-6]
> >   \component[chapter-7]
> >   \component[chapter-8]
> >   \component[chapter-9]
> >   \component[chapter-10]
> >   \component[chapter-11]
> >   \component[chapter-12]
> >   \component[chapter-13]
> >   \component[chapter-14]
> > \stopbodymatter
> > \stopproduct
>
> —
> Taco Hoekwater  E: t...@bittext.nl
> genderfluid (all pronouns)
>
>
>
> ___
> If your question is of interest to others as well, please add an entry to
> the Wiki!
>
> maillist : ntg-context@ntg.nl /
> https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
> webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
> archive  : https://github.com/contextgarden/context
> wiki : https://wiki.contextgarden.net
>
> ___
>
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: The graph is not visible.

2024-04-25 Thread Taco Hoekwater


> On 25 Apr 2024, at 16:08, Fabrice Couvreur  
> wrote:
> 
> Hi Taco,
> I knew I wouldn't be able to explain what was happening.
> The code works perfectly and the figure is clearly visible in the component 
> chapter-14 :

It is probably not related to the figure itself. Something may be different in 
this component compared to the other ones. I cannot really say, of course. 
Still, using external image instead of inline metapost may be fix it. Not 
elegant, but if it works it works!

Good luck,
Taco


> 
> \startcomponent[chapter-14]
> \startMPpage
> ...
> \stopMPpage
> \stopcomponent
> 
> But if I compile my project, it disappears !!
> 
> \startproduct[terminale-manual]
>  \startbodymatter
>   \component[chapter-1]
>   \component[chapter-2]
>   \component[chapter-3]
>   \component[chapter-4]
>   \component[chapter-5]
>   \component[chapter-6]
>   \component[chapter-7]
>   \component[chapter-8]
>   \component[chapter-9]
>   \component[chapter-10]
>   \component[chapter-11]
>   \component[chapter-12]
>   \component[chapter-13]
>   \component[chapter-14]
> \stopbodymatter
> \stopproduct

— 
Taco Hoekwater  E: t...@bittext.nl
genderfluid (all pronouns)


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

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: The graph is not visible.

2024-04-25 Thread Hans Hagen

On 4/25/2024 4:08 PM, Fabrice Couvreur wrote:

Hi Taco,
I knew I wouldn't be able to explain what was happening.
The code works perfectly and the figure is clearly visible in the 
component chapter-14 :


\startcomponent[chapter-14]
\startMPpage
...
\stopMPpage
\stopcomponent

But if I compile my project, it disappears !!

\startproduct[terminale-manual]
  \startbodymatter
       \component[chapter-1]
       \component[chapter-2]
       \component[chapter-3]
       \component[chapter-4]
       \component[chapter-5]
       \component[chapter-6]
       \component[chapter-7]
       \component[chapter-8]
       \component[chapter-9]
       \component[chapter-10]
       \component[chapter-11]
       \component[chapter-12]
       \component[chapter-13]
       \component[chapter-14]
     \stopbodymatter
\stopproduct

-- compile with specific preceding chapters commented
-- when the interfering one is found, make a copy and strip till the 
problem is gone


it might be that you redefine something metapost

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 / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: The graph is not visible.

2024-04-25 Thread Fabrice Couvreur
Hi Taco,
I knew I wouldn't be able to explain what was happening.
The code works perfectly and the figure is clearly visible in the component
chapter-14 :

\startcomponent[chapter-14]
\startMPpage
...
\stopMPpage
\stopcomponent

But if I compile my project, it disappears !!

\startproduct[terminale-manual]
 \startbodymatter
  \component[chapter-1]
  \component[chapter-2]
  \component[chapter-3]
  \component[chapter-4]
  \component[chapter-5]
  \component[chapter-6]
  \component[chapter-7]
  \component[chapter-8]
  \component[chapter-9]
  \component[chapter-10]
  \component[chapter-11]
  \component[chapter-12]
  \component[chapter-13]
  \component[chapter-14]
\stopbodymatter
\stopproduct

Le jeu. 25 avr. 2024 à 13:36, Taco Hoekwater  a écrit :

> H Fabrice,
>
> You did not provide a good minimum test because the graph by itself
> renders fine:
>
>
>
> Best wishes,
> Taco
> (if all else fails, you can replace \startMPcode with \startMPpage and
> generate a standalone graph that way)
>
> > On 25 Apr 2024, at 12:27, Fabrice Couvreur 
> wrote:
> >
> > Hi,
> > I don't know if I can explain the problem I'm having. I made a project
> with 14 chapters. In each of them, there are graphics embedding metapost
> code. I proceed as follows : I compile each chapter alone with lmtx then I
> compile the project containing the 14 chapters. I didn't encounter any
> problems except with a graphic from the last chapter. It is indeed in
> chapter 14 but not in the project ! I give the code for this graph.
> > Thanks.
> > Fabrice
> >
> > \startMPcode
> >
> >interim linejoin := mitered;
> >interim ahangle := 30;
> >numeric u, pi;
> >
> >pi = 3.141592653589793;
> >u = 1.5cm;
> >
> >vardef graph_of_function (suffix f) (expr xmin, xmax,
> xsep) =
> >   for x = xmin step xsep until xmax: (x, f(x)) .. endfor
> (xmax, f(xmax))
> >enddef ;
> >
> >vardef vline (suffix f, g) (expr x) = (x, min(f(x),
> g(x))) -- (x, max(f(x),g(x))) enddef;
> >
> >vardef area_between_functions (suffix f, g)(expr a, b,
> xsep) =
> >   buildcycle(graph_of_function(f, a, b, xsep), vline(f,
> g, b),
> >   reverse graph_of_function(g, a, b, xsep), reverse
> vline(f, g, a))
> >enddef;
> >
> >vardef xaxis (expr xmin, xmax) = (xmin, 0) -- (xmax, 0)
> enddef ;
> >vardef yaxis (expr ymin, ymax) = (0, ymin) -- (0, ymax)
> enddef ;
> >
> >
> >xmin:=-pi/2; xmax := 3*pi/2;
> >ymin := -1.5; ymax := 5;
> >
> >
> >vardef f(expr x)= exp(-x)*(-cos(x)+sin(x)+1) enddef;
> >vardef g(expr x)=-exp(-x)*cos(x) enddef;
> >path C_f, C_g;
> >C_f = graph_of_function(f,xmin, xmax, .1);
> >C_g = graph_of_function(g, xmin, xmax, .1);
> >
> >a := xpart(C_f intersectionpoint C_g);
> >b := xpart(reverse C_f intersectionpoint reverse C_g);
> >
> >fill (area_between_functions(f, g, a, b, 0.1)) scaled u
> withcolor 0.4[white, blue];
> >draw C_f scaled u withcolor blue;
> >draw C_g scaled u withcolor blue;
> >
> >
> >\stopMPcode
> >
> ___
> > If your question is of interest to others as well, please add an entry
> to the Wiki!
> >
> > maillist : ntg-context@ntg.nl /
> https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
> > webpage  : https://www.pragma-ade.nl / https://context.aanhet.net
> (mirror)
> > archive  : https://github.com/contextgarden/context
> > wiki : https://wiki.contextgarden.net
> >
> ___
>
> —
> Taco Hoekwater  E: t...@bittext.nl
> genderfluid (all pronouns)
>
>
>
> ___
> If your question is of interest to others as well, please add an entry to
> the Wiki!
>
> maillist : ntg-context@ntg.nl /
> https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
> webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
> archive  : https://github.com/contextgarden/context
> wiki : https://wiki.contextgarden.net
&

[NTG-context] Re: The graph is not visible.

2024-04-25 Thread Taco Hoekwater
H Fabrice,

You did not provide a good minimum test because the graph by itself renders 
fine:



fabr.pdf
Description: Adobe PDF document


Best wishes,
Taco
(if all else fails, you can replace \startMPcode with \startMPpage and generate 
a standalone graph that way)

> On 25 Apr 2024, at 12:27, Fabrice Couvreur  
> wrote:
> 
> Hi,
> I don't know if I can explain the problem I'm having. I made a project with 
> 14 chapters. In each of them, there are graphics embedding metapost code. I 
> proceed as follows : I compile each chapter alone with lmtx then I compile 
> the project containing the 14 chapters. I didn't encounter any problems 
> except with a graphic from the last chapter. It is indeed in chapter 14 but 
> not in the project ! I give the code for this graph.
> Thanks.
> Fabrice
> 
> \startMPcode
> 
>interim linejoin := mitered;
>interim ahangle := 30;
>numeric u, pi;
>  
>pi = 3.141592653589793;
>u = 1.5cm;
>  
>vardef graph_of_function (suffix f) (expr xmin, xmax, xsep) =
>   for x = xmin step xsep until xmax: (x, f(x)) .. endfor 
> (xmax, f(xmax))
>enddef ;
> 
>vardef vline (suffix f, g) (expr x) = (x, min(f(x), g(x))) -- 
> (x, max(f(x),g(x))) enddef;
> 
>vardef area_between_functions (suffix f, g)(expr a, b, xsep) =
>   buildcycle(graph_of_function(f, a, b, xsep), vline(f, g, 
> b), 
>   reverse graph_of_function(g, a, b, xsep), reverse vline(f, 
> g, a))
>enddef;
> 
>vardef xaxis (expr xmin, xmax) = (xmin, 0) -- (xmax, 0) enddef 
> ;
>vardef yaxis (expr ymin, ymax) = (0, ymin) -- (0, ymax) enddef 
> ;
> 
>  
>xmin:=-pi/2; xmax := 3*pi/2; 
>ymin := -1.5; ymax := 5;
>   
> 
>vardef f(expr x)= exp(-x)*(-cos(x)+sin(x)+1) enddef;
>vardef g(expr x)=-exp(-x)*cos(x) enddef;
>path C_f, C_g;
>C_f = graph_of_function(f,xmin, xmax, .1);
>C_g = graph_of_function(g, xmin, xmax, .1);
> 
>a := xpart(C_f intersectionpoint C_g); 
>b := xpart(reverse C_f intersectionpoint reverse C_g);
> 
>fill (area_between_functions(f, g, a, b, 0.1)) scaled u 
> withcolor 0.4[white, blue];
>draw C_f scaled u withcolor blue;
>draw C_g scaled u withcolor blue;
>   
>   
>\stopMPcode
> ___
> If your question is of interest to others as well, please add an entry to the 
> Wiki!
> 
> maillist : ntg-context@ntg.nl / 
> https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
> webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
> archive  : https://github.com/contextgarden/context
> wiki : https://wiki.contextgarden.net
> ___

— 
Taco Hoekwater  E: t...@bittext.nl
genderfluid (all pronouns)


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

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] The graph is not visible.

2024-04-25 Thread Fabrice Couvreur
Hi,
I don't know if I can explain the problem I'm having. I made a project with
14 chapters. In each of them, there are graphics embedding metapost code. I
proceed as follows : I compile each chapter alone with lmtx then I compile
the project containing the 14 chapters. I didn't encounter any problems
except with a graphic from the last chapter. It is indeed in chapter 14 but
not in the project ! I give the code for this graph.
Thanks.
Fabrice

\startMPcode

   interim linejoin := mitered;
   interim ahangle := 30;
   numeric u, pi;

   pi = 3.141592653589793;
   u = 1.5cm;

   vardef graph_of_function (suffix f) (expr xmin, xmax, xsep) =
  for x = xmin step xsep until xmax: (x, f(x)) .. endfor
(xmax, f(xmax))
   enddef ;

   vardef vline (suffix f, g) (expr x) = (x, min(f(x), g(x)))
-- (x, max(f(x),g(x))) enddef;

   vardef area_between_functions (suffix f, g)(expr a, b, xsep)
=
  buildcycle(graph_of_function(f, a, b, xsep), vline(f, g,
b),
  reverse graph_of_function(g, a, b, xsep), reverse
vline(f, g, a))
   enddef;

   vardef xaxis (expr xmin, xmax) = (xmin, 0) -- (xmax, 0)
enddef ;
   vardef yaxis (expr ymin, ymax) = (0, ymin) -- (0, ymax)
enddef ;


   xmin:=-pi/2; xmax := 3*pi/2;
   ymin := -1.5; ymax := 5;


   vardef f(expr x)= exp(-x)*(-cos(x)+sin(x)+1) enddef;
   vardef g(expr x)=-exp(-x)*cos(x) enddef;
   path C_f, C_g;
   C_f = graph_of_function(f,xmin, xmax, .1);
   C_g = graph_of_function(g, xmin, xmax, .1);

   a := xpart(C_f intersectionpoint C_g);
   b := xpart(reverse C_f intersectionpoint reverse C_g);

   fill (area_between_functions(f, g, a, b, 0.1)) scaled u
withcolor 0.4[white, blue];
   draw C_f scaled u withcolor blue;
   draw C_g scaled u withcolor blue;


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

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: Wiki - test/proposal to further clarify documentation

2024-04-16 Thread Henning Hraban Ramm

Am 14.04.24 um 21:45 schrieb Peter Hopcroft via ntg-context:

It would be great if the main page actually said what Context does.


In my poster (still WIP) I wrote:

start
---

The “infamous” alternative to LaTeX

While most designers use graphical tools, there are still areas where 
code-based typesetting systems are fun, make sense or are even superior. 
While LaTeX is the most known of these, ConTeXt is used by a growing 
minority of ambitioned enthusiasts around the world.


The small but active and creative community of ConTeXt users and 
developers is always driving TeX development over new frontiers:

NTS, MetaFun, Oriental TeX, LuaTeX, mplib, LuaMetaTeX…
They’re also dubbed the incisors (AKA cutting edge) of the dinosaur of 
Open Source.


ConTeXt is aimed at creative users, known for advanced features like 
extensive font control and direct XML processing, with a deep 
integration of Lua and MetaPost.


---

ConTeXt was invented in the 1990s by Hans Hagen and Ton Otten of the 
Dutch company “Pragma Advanced Document Engineering” for typesetting 
schoolbooks. Taco Hoekwater refactored the TeX source code to create 
LuaTeX which was further developed into LuaMetaTeX by Hans Hagen (and 
lately Mikael Sundqvist for refined math typography).


---

“To be fair, switching to the ConTeXt way of thinking and doing things 
was not an overnight process […]. But once I got used to it, I could not 
imagine going back to LaTeX. I’ll go even further and say that, in my 
view, ConTeXt is the future of TeX.

(Prof. Idris Samawi Hamid, 2009)
Source: www.tug.org/interviews/hamid.html

---

“ConTeXt is LaTeX done right. It is simple, flexible and powerful.”
(J. U. Hasecke on Mastodon, 2022)

---

Is ConTeXt for me?

If you want …
* to design your own layout
* best quality math typesetting
* to use Lua functions e.g. for processing data
* deep integration of a graphics language (MetaPost)
* to process XML input
* no package conflicts
* to use OpenType features
* consistent setup commands
* to place stuff on layers
* visual debugging features
* to have a lean, but mighty TeX system
* to typeset much faster than with LaTeX
* high quality Arabic typography
… then ConTeXt is for you!

---
stop

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

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: Fwd: Re: how to apply gradient color to a piece of text?

2024-04-10 Thread Hans Hagen

On 4/10/2024 5:22 AM, seyal zavira wrote:
seams this code means to put a hidden text with same size behind 
metapost shape.
but it does not work properly for me (current version: 2024.04.01 08:59) 
and produce empty page but with searchable hidden text.


as mentioned kind = "outline" will be in the next upload so with the 
current one you need to use the also posted here for ... endfor variant



also when i edit the code and replace metapost part like this:

\startMPcode
      draw lmt_outline [
          kind = "outline",
          text = "\getbuffer[MyText]",
       ]
          withcolor red
       ;
\stopMPcode

it produces a selectable hidden text on top of body and red text that 
drawn by metapost below of that.


How can this problem be solved?

i attached the codes and pdf results.

On Mon, Apr 8, 2024 at 4:37 AM Hans Hagen <mailto:j.ha...@xs4all.nl>> wrote:


On 4/8/2024 8:22 AM, seyal zavira wrote:
 > thank you Harban and Keith McKay.
 >
 >     \startMPpage
 >            picture tt ; tt := lmt_outline [
 >                kind = "path",
 >                text =
"\definedfont[name:texgyrepagellabold*default]foo
 >     f o o",
 >            ] ;
 >
 >            fill
 >               for i within tt : pathpart i && endfor cycle
 >               withshademethod "linear"
 >               withshadedirection down
 >               withshadecolors (red, blue) ;
 >     \stopMPpage
 >
 >     I'll add this:
 >
 >     \startMPpage
 >           draw lmt_outline [
 >               kind = "outline",
 >               text =
"\definedfont[name:texgyrepagellabold*default]foo f
 >     o o",
 >           ]
 >               withshademethod "linear"
 >               withshadedirection down
 >               withshadecolors (red, blue)
 >           ;
 >     \stopMPpage
 >
 >     so a single path option (no picture)
 >
 >     Hans
 >
 >
 > Thank you so much for the sample examples
 > it would be great to also make text select able in output pdf
 > the third example currently does not work. did you mean you will add
 > this feature for next updates?
we're talking outlines so that is paths which implies no search but you
can do this (Keith and/or Hraban will explain and/or wikify it)

\starttext

\startbuffer[MyText]
      \definedfont[name:texgyrepagellabold*default]foo f o o%
\stopbuffer

\startbuffer[MyText]
      \framed[align=normal,frame=off]{\input{tufte}}%
\stopbuffer

\setbox\scratchbox\hbox\bgroup
      \startMPcode
           draw lmt_outline [
               kind = "outline",
               text = "\getbuffer[MyText]",
           ]
               withshademethod "linear"
               withshadedirection down
               withshadecolors (red, blue)
           ;
      \stopMPcode
\egroup

\startoverlay


{\scale[height=\htdp\scratchbox,width=\wd\scratchbox]{\effect[hidden]{\getbuffer[MyText]}}}
      {\box\scratchbox}
\stopoverlay

\stoptext




-
                                            Hans Hagen | PRAGMA ADE
                Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
         tel: 038 477 53 69 | www.pragma-ade.nl
<http://www.pragma-ade.nl> | www.pragma-pod.nl
<http://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 <mailto:ntg-context@ntg.nl> /
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
<https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl>
webpage  : https://www.pragma-ade.nl <https://www.pragma-ade.nl> /
https://context.aanhet.net <https://context.aanhet.net> (mirror)
archive  : https://github.com/contextgarden/context
<https://github.com/contextgarden/context>
wiki     : https://wiki.contextgarden.net
<https://wiki.contextgarden.net>

___


___
If your question is of interest to others 

[NTG-context] Re: Fwd: Re: how to apply gradient color to a piece of text?

2024-04-09 Thread seyal zavira
seams this code means to put a hidden text with same size behind metapost
shape.
but it does not work properly for me (current version: 2024.04.01 08:59)
and produce empty page but with searchable hidden text.
also when i edit the code and replace metapost part like this:

\startMPcode
 draw lmt_outline [
 kind = "outline",
 text = "\getbuffer[MyText]",
  ]
 withcolor red
  ;
\stopMPcode

it produces a selectable hidden text on top of body and red text that drawn
by metapost below of that.

How can this problem be solved?

i attached the codes and pdf results.

On Mon, Apr 8, 2024 at 4:37 AM Hans Hagen  wrote:

> On 4/8/2024 8:22 AM, seyal zavira wrote:
> > thank you Harban and Keith McKay.
> >
> > \startMPpage
> >picture tt ; tt := lmt_outline [
> >kind = "path",
> >text = "\definedfont[name:texgyrepagellabold*default]foo
> > f o o",
> >] ;
> >
> >fill
> >   for i within tt : pathpart i && endfor cycle
> >   withshademethod "linear"
> >   withshadedirection down
> >   withshadecolors (red, blue) ;
> > \stopMPpage
> >
> > I'll add this:
> >
> > \startMPpage
> >   draw lmt_outline [
> >   kind = "outline",
> >   text = "\definedfont[name:texgyrepagellabold*default]foo f
> > o o",
> >   ]
> >   withshademethod "linear"
> >   withshadedirection down
> >   withshadecolors (red, blue)
> >   ;
> > \stopMPpage
> >
> > so a single path option (no picture)
> >
> > Hans
> >
> >
> > Thank you so much for the sample examples
> > it would be great to also make text select able in output pdf
> > the third example currently does not work. did you mean you will add
> > this feature for next updates?
> we're talking outlines so that is paths which implies no search but you
> can do this (Keith and/or Hraban will explain and/or wikify it)
>
> \starttext
>
> \startbuffer[MyText]
>  \definedfont[name:texgyrepagellabold*default]foo f o o%
> \stopbuffer
>
> \startbuffer[MyText]
>  \framed[align=normal,frame=off]{\input{tufte}}%
> \stopbuffer
>
> \setbox\scratchbox\hbox\bgroup
>  \startMPcode
>   draw lmt_outline [
>   kind = "outline",
>   text = "\getbuffer[MyText]",
>   ]
>   withshademethod "linear"
>   withshadedirection down
>   withshadecolors (red, blue)
>   ;
>  \stopMPcode
> \egroup
>
> \startoverlay
>
>
> {\scale[height=\htdp\scratchbox,width=\wd\scratchbox]{\effect[hidden]{\getbuffer[MyText]}}}
>  {\box\scratchbox}
> \stopoverlay
>
> \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 /
> https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
> webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
> archive  : https://github.com/contextgarden/context
> wiki : https://wiki.contextgarden.net
>
> ___
>
\starttext

\startbuffer[MyText]
 \definedfont[name:texgyrepagellabold*default]foo f o o%
\stopbuffer

\startbuffer[MyText]
 \framed[align=normal,frame=off]{a sample text}%
\stopbuffer

\setbox\scratchbox\hbox\bgroup
 \startMPcode
  draw lmt_outline [
  kind = "outline",
  text = "\getbuffer[MyText]",
  ]
  withshademethod "linear"
  withshadedirection down
  withshadecolors (red, blue)
  ;
 \stopMPcode
\egroup

\startoverlay

{\scale[height=\htdp\scratchbox,width=\wd\scratchbox]{\effect[hidden]{\getbuffer[MyText]}}}
 {\box\scratchbox}
\stopoverlay

\stoptext


test1.pdf
Description: Adobe PDF document
\starttext

\startbuffer[MyText]
 \definedfont[name:texgyrepage

[NTG-context] Re: how to apply metapost effects to section title?

2024-04-09 Thread Wolfgang Schuster

seyal.zav...@gmail.com schrieb am 09.04.2024 um 14:53:

i want to produce a gradient header
i tried this code but it does not produce any result:

\startext
\def\Mystyle#1{\startMPcode
   picture tt ; tt := lmt_outline [
   kind = "path",
   text = "#1",
   ] ;
   fill
   for i within tt : pathpart i && endfor cycle
  withshademethod "linear"
  withshadedirection up
  withshadecolors (red, blue) ;
\stopMPcode
}

\definehead[Myhead][section]
\setuphead[Myhead][
   style=\Mystyle,
]
\startMyhead[title=sample] a sample text \stopMyhead
\stoptext


You can't use commands with parameters as argument for the style key.

To format single parts (number or title) of a section title you have to 
apply a command to the "deep...command" key but even then you have to 
make manual changes to the vertical alignment of the text.


 begin example
\starttexdefinition spaces Mystyle #1
  \setbox\scratchboxone\hbox{#1}%
  \setbox\scratchboxtwo\hbox\bgroup
\startMPcode
  picture tt ; tt := lmt_outline [
kind = "path",
text = "#1",
  ];
fill
  for i within tt : pathpart i && endfor cycle
  withshademethod "linear"
  withshadedirection up
  withshadecolors (red, blue) ;
\stopMPcode
  \egroup
  \boxyoffset\scratchboxtwo-\dp\scratchboxone
  \box\scratchboxtwo
\stoptexdefinition

\starttext

\setuphead
  [section]
  [
 deeptextcommand=\Mystyle,
%  deepnumbercommand=\Mystyle,
  ]

\startsection[title=Lorem ipsum]
\samplefile{lorem}
\stopsection

\stoptext
 end example


and the code below works but does not colorize numbers of this heads:
\starttext
 
\def\Mystyle#1{\startMPcode

   picture tt ; tt := lmt_outline [
   kind = "path",
   text = "#1",
   ] ;
   fill
   for i within tt : pathpart i && endfor cycle
  withshademethod "linear"
  withshadedirection up
  withshadecolors (red, blue) ;
\stopMPcode
}
 
\def\startMysection#1{\startsection[title=\Mystyle{#1}]}

\def\stopMysection{\stopsection}
 
\startMysection{hello}

what is best method?
\stopMysection
 
\stoptext


what is your suggestion?


To apply the format the the complete section title you have to create 
your own style and apply it with the "command" key, to get the number 
and title for the current section use the \structurenumber and 
\structuretitle macros.


 begin example
\starttexdefinition spaces protected Mystyle #1#2
  \startMPcode
picture tt ; tt := lmt_outline [
  kind = "path",
  text = "\structurenumber\space\structuretitle",
];
  fill
for i within tt : pathpart i && endfor cycle
withshademethod "linear"
withshadedirection up
withshadecolors (red, blue) ;
  \stopMPcode
\stoptexdefinition

\starttext

\setuphead
  [section]
  [command=\Mystyle]

\startsection[title=Lorem ipsum]
\samplefile{lorem}
\stopsection

\stoptext
 end example

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

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] how to apply metapost effects to section title?

2024-04-09 Thread seyal . zavira
i want to produce a gradient header
i tried this code but it does not produce any result:

\startext
\def\Mystyle#1{\startMPcode
  picture tt ; tt := lmt_outline [
  kind = "path",
  text = "#1",
  ] ;
  fill
  for i within tt : pathpart i && endfor cycle
 withshademethod "linear"
 withshadedirection up
 withshadecolors (red, blue) ;
\stopMPcode
}

\definehead[Myhead][section]
\setuphead[Myhead][
  style=\Mystyle,
]
\startMyhead[title=sample] a sample text \stopMyhead
\stoptext

and the code below works but does not colorize numbers of this heads:
\starttext  



\def\Mystyle#1{\startMPcode 

  picture tt ; tt := lmt_outline [  

  kind = "path",

  text = "#1",  

  ] ;   

  fill  

  for i within tt : pathpart i && endfor cycle  

 withshademethod "linear"   

 withshadedirection up  

 withshadecolors (red, blue) ;  

\stopMPcode 

}   



\def\startMysection#1{\startsection[title=\Mystyle{#1}]}

\def\stopMysection{\stopsection}



\startMysection{hello}  

what is best method?

\stopMysection  



\stoptext

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

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: how to apply gradient color to a piece of text?

2024-04-07 Thread Keith McKay
Have a look at the posts starting on the 2 March 2021 with the subject 
heading "Shaded Large Letters in LMTX". Hans gave a great solution.


Best Wishes

Keith

On 07/04/2024 11:48, seyal.zav...@gmail.com wrote:

hi all,

when i look at luametafun manual there are some intresting examples that can 
apply gradient colors to metapost paths.
how i can apply this cool feature to a piece of text?

i tried the code below but it does not produce any result.

\definecolor[Gleft] [h=9f9393]
\definecolor[Gright] [h=ff1aa4]
\startMPpage
picture Mytext;
Mytext := btex hello etex;

draw lmt_shade [
picture="Mytext",
direction = "right",
domain= { 0, 2 },
colors= { "headerGleft", "headerGright" },
] ;
\stopMPpage
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___

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

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] how to apply gradient color to a piece of text?

2024-04-07 Thread seyal . zavira
hi all,

when i look at luametafun manual there are some intresting examples that can 
apply gradient colors to metapost paths.
how i can apply this cool feature to a piece of text?

i tried the code below but it does not produce any result.

\definecolor[Gleft] [h=9f9393]
\definecolor[Gright] [h=ff1aa4]
\startMPpage
picture Mytext;
Mytext := btex hello etex;

draw lmt_shade [
picture="Mytext",
direction = "right",
domain= { 0, 2 },
colors= { "headerGleft", "headerGright" },
] ;
\stopMPpage
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] context editor support / syntax highlighting for Pulsar

2024-04-01 Thread Henning Hraban Ramm
end
io.savedata(file.addsuffix(filename,"properties"),concat(result))
io.savedata(file.addsuffix(filename,"lua"),serialize(data,true))
else
os.remove(filename)
end
end

function flushers.scite(collected)
local data = { }
-- for interface, whatever in next, collected do
-- data[interface] = whatever.commands
-- end
local function add(target,origin,field)
if origin then
local list = origin[field]
if list then
for i=1,#list do
target[list[i]] = true
end
end
end
end
--
for interface, whatever in next, collected do
local combined = { }
add(combined,whatever,"commands")
add(combined,whatever,"environments")
if interface == "common" then
add(combined,whatever,"textnames")
add(combined,whatever,"mathnames")
end
data[interface] = sortedkeys(combined)
end
--
collect("scite-context-data-interfaces", "context",  data)
collect("scite-context-data-metapost",   "metapost", 
dofile(resolvers.findfile("mult-mps.lua")))
collect("scite-context-data-metafun","metafun",  
dofile(resolvers.findfile("mult-fun.lua")))
collect("scite-context-data-context","context",  
dofile(resolvers.findfile("mult-low.lua")))
collect("scite-context-data-tex","tex",  
dofile(resolvers.findfile("mult-prm.lua")))
end

function flushers.jedit(collected)
for interface, whatever in next, collected do
local commands = whatever.commands
local environments = whatever.environments
local result, r = { }, 0
r = r + 1 ; result[r] = ""
r = r + 1 ; result[r] = "\n"
r = r + 1 ; result[r] = ""
r = r + 1 ; result[r] = "\t"
r = r + 1 ; result[r] = "\t\t"
for i=1,#commands do
r = r + 1 ; result[r] = 
format("\t\t\t%s",commands[i])
end
r = r + 1 ; result[r] = "\t\t"
r = r + 1 ; result[r] = "\t"
r = r + 1 ; result[r] = ""
io.savedata(format("context-jedit-%s.xml",interface), 
concat(result),"\n")
end
end

function flushers.bbedit(collected)
for interface, whatever in next, collected do
local commands = whatever.commands
local environments = whatever.environments
local result, r = { }, 0
r = r + 1 ; result[r] = ""
r = r + 1 ; result[r] = "BBLMKeywordList"
r = r + 1 ; result[r] = ""
for i=1,#commands do
r = r + 1 ; result[r] = 
format("\t\\%s",commands[i])
end
r = r + 1 ; result[r] = ""
io.savedata(format("context-bbedit-%s.xml",interface), 
concat(result),"\n")
end
end

function flushers.pulsar(collected)
for interface, whatever in next, collected do
local commands = whatever.commands
local environments = whatever.environments
local result, r = { }, 0
r = r + 1 ; result[r] = "'.text.tex.context':\n"
for i=1,#commands do
r = r + 1 ; result[r] = format("\t'\\%s':\n",commands[i])
r = r + 1 ; result[r] = format("\t\tprefix: '%s'\n",commands[i])
-- can we have some information?
--r = r + 1 ; result[r] = format("\t\tdescription: 'level: 
primitive; interface: i-tex.xml'",'')
-- no URL if command starts with "stop"
r = r + 1 ; result[r] = format("\t\tdescriptionMoreURL: 
'https://wiki.contextgarden.net/Command/%s'\n",commands[i])
end
io.savedata(format("language-context-%s.cson",interface), 
concat(result),"\n")
end
end

-- The Vim export is maintained by Nicola Vitacolonna:

local function vimcollect(filename,class,data)
if data then
local result, r = { }, 0
local endline = " contained\n"
if find(class,"^meta") then
endline = "\n"
end
r = r + 1 ; result[r] = "vim9script\n\n"
r = r + 1 ; result[r] = "# Vim syntax file\n"
r = r + 1 ; result[r] = "# Language: ConTeXt\n"
r = r + 1 ; result[r] = format("# Automatically generated by 
mtx-interface (%s)\n\n", os.date())
local n = 5 -- number of keywords per row
for name, list in sortedhash(data) do
local i = 1
while i <= #list do
r = r + 1 ; result[r] = format("syn keyword %s%s", class, 
(gsub(name

[NTG-context] Re: upload

2024-04-01 Thread Otared Kavian
Hi Hans and Mikael,Thanks for the new module math-goodriddance ! Indeed there are many mathematicians who are going to use the \goodriddancemath command, and no doubt they are going to thank you, even if they are very shy to come out.Moreover this command can be used by people who want to transform the output PDF into an audio file, because for instance the following \usemodule[math-goodriddance]\goodriddancemath\starttext\startformula\int_{0}^{\pi} \sin(x)\dd x = 2.\stopformula\stoptextgives 
		
	
	
		
			
integral from 0 to 휋 , of sin of 푥 d 푥 equals 2 

			
		as one can see in the attached output which is very useful for the blind using an audio software.Best regards: OK

no-math.pdf
Description: Adobe PDF document
On 1 Apr 2024, at 16:31, Hans Hagen <j.ha...@xs4all.nl> wrote:Hi,There is a new lmtx upload.-- The svg inclusion via metapost has been upgraded and cleanup a bit, using some more recent metapost features. There are some new (not yet all documented metapost) features.-- In the process, support for LCH colors has been added, which is documented in the (eg luametafun manual).-- The math manual is not yet there because we were distracted by improving support for envelopes (penbased outlines) in metafun. This is still work in progress, some is present and discussed in the manual, and we'll come back to that sometime next month. Given the next item, we also might need to change some in the manual (different focus).-- Because we have users who have to conform to the European Accessibility Act we have been wondering how to deal with that and at Mikaels place there are two demands: distinctive colors and tagging and especially math (somehow validators love to check that). Colors never were an issue as they can be controlled, and tagging math neither, especially because nothing was/is done with it anyway, but ... we are happy that we found a reasonable (more modern and future proof) way out.As explained / shown in the attached document we're basically forced to choose a different approach with math (a pity as we worked hard to get the rendering right but the attached file works fine in the viewers that we tested).-- We like to hear from users what other demands wrt accessibility there are. We're not interested in the (commercial) big money aspects (of pdf and tagging) nor in the politics behind it (changes over time). What are the demands, so that we can see how to make it work or just work around it (as it's kind of boring to cook uyp complex features	, esp compared to playing with metapost).-- Furthermore .. the usual bits and pieces as discussed on the list and otherwise.-- If you have troubles (crash) you need to wipe the cache due to a change in lua bytecode storage (no easy way to catch it).Hans & Mikael-  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 / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nlwebpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)archive  : https://github.com/contextgarden/contextwiki : https://wiki.contextgarden.net___
Otared Kaviane-mail: ota...@gmail.comPhone: +33 6 88 26 70 95

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

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: upload

2024-04-01 Thread Mikael Sundqvist
Hi,

On Mon, Apr 1, 2024 at 9:36 AM Hans Hagen  wrote:
>
> Hi,
>
> There is a new lmtx upload.
>
> -- The svg inclusion via metapost has been upgraded and cleanup a bit,
> using some more recent metapost features. There are some new (not yet
> all documented metapost) features.
>
> -- In the process, support for LCH colors has been added, which is
> documented in the (eg luametafun manual).
>
> -- The math manual is not yet there because we were distracted by
> improving support for envelopes (penbased outlines) in metafun. This is
> still work in progress, some is present and discussed in the manual, and
> we'll come back to that sometime next month. Given the next item, we
> also might need to change some in the manual (different focus).
>
> -- Because we have users who have to conform to the European
> Accessibility Act we have been wondering how to deal with that and at
> Mikaels place there are two demands: distinctive colors and tagging and
> especially math (somehow validators love to check that). Colors never
> were an issue as they can be controlled, and tagging math neither,
> especially because nothing was/is done with it anyway, but ... we are
> happy that we found a reasonable (more modern and future proof) way out.
>
> As explained / shown in the attached document we're basically forced to
> choose a different approach with math (a pity as we worked hard to get
> the rendering right but the attached file works fine in the viewers that
> we tested).
>
> -- We like to hear from users what other demands wrt accessibility there
> are. We're not interested in the (commercial) big money aspects (of pdf
> and tagging) nor in the politics behind it (changes over time). What are
> the demands, so that we can see how to make it work or just work around
> it (as it's kind of boring to cook uyp complex features , esp compared
> to playing with metapost).
>
> -- Furthermore .. the usual bits and pieces as discussed on the list and
> otherwise.
>
> -- If you have troubles (crash) you need to wipe the cache due to a
> change in lua bytecode storage (no easy way to catch it).
>
> Hans & Mikael

In addition to what Hans wrote, I need to write and apologize. About
two years ago I was working on a big math project and needed SyncTeX
(code <-> okular) to work with it to get a smooth workflow. After
fighting it for several weeks, mailing Hans back and forth, without
any real support from Hans since "he was not using SyncTeX", I sent a
false patch to him that I claimed worked. It must have gotten in
without even being tested(!). Since then SyncTeX support for ConTeXt
has been broken.

Strengthened about how easy it was to add code to this project, and
still frustrated about the project (that is still not finished), I
started "collaborating" with Hans, mainly on math. During these years,
I have been baffled about how easy it has been to add malicious code,
he just swallows everything. I only needed to find out what Hans
really uses himself (a few tables, he likes colors, and he has a weak
point when it comes to "nice" metapost images), and then to add
patches for other stuff. For math, in particular, he seems to have no
understanding (sorry Hans). I am worried about the Dutch school
system.

Nevertheless, I have, during this time, more and more enjoyed our
discussions, and so I started to feel bad about my "patches", and
sorry for Hans. Thus, I have lately reverted, part by part, the bad
code. Only a few of them are left (but don't tell Hans!). I also got a
feeling that Wolfgang, checking all the code, since long did see this
through.

Thus, in the latest upload, for example, you might get SyncTeX working
again, but you might need to add \setupsynctex[state=repeat]. No
guarantees.

Again, my sincere apologies to all ConTeXters out there who have not
gotten the result they expect and deserve. I assume that Hans will
kick me out when the last patch is sent, so I will delay it as much as
possible...

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

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] upload

2024-04-01 Thread Hans Hagen

Hi,

There is a new lmtx upload.

-- The svg inclusion via metapost has been upgraded and cleanup a bit, 
using some more recent metapost features. There are some new (not yet 
all documented metapost) features.


-- In the process, support for LCH colors has been added, which is 
documented in the (eg luametafun manual).


-- The math manual is not yet there because we were distracted by 
improving support for envelopes (penbased outlines) in metafun. This is 
still work in progress, some is present and discussed in the manual, and 
we'll come back to that sometime next month. Given the next item, we 
also might need to change some in the manual (different focus).


-- Because we have users who have to conform to the European 
Accessibility Act we have been wondering how to deal with that and at 
Mikaels place there are two demands: distinctive colors and tagging and 
especially math (somehow validators love to check that). Colors never 
were an issue as they can be controlled, and tagging math neither, 
especially because nothing was/is done with it anyway, but ... we are 
happy that we found a reasonable (more modern and future proof) way out.


As explained / shown in the attached document we're basically forced to 
choose a different approach with math (a pity as we worked hard to get 
the rendering right but the attached file works fine in the viewers that 
we tested).


-- We like to hear from users what other demands wrt accessibility there 
are. We're not interested in the (commercial) big money aspects (of pdf 
and tagging) nor in the politics behind it (changes over time). What are 
the demands, so that we can see how to make it work or just work around 
it (as it's kind of boring to cook uyp complex features	, esp compared 
to playing with metapost).


-- Furthermore .. the usual bits and pieces as discussed on the list and 
otherwise.


-- If you have troubles (crash) you need to wipe the cache due to a 
change in lua bytecode storage (no easy way to catch it).


Hans & Mikael

-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
   tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-

math-riddance.pdf
Description: Adobe PDF document
% language=us

% todo: no comma

\usemodule[scite]
\usemodule[article-basic]
\usemodule[abbreviations-logos]
\usemodule[math-goodriddance]

\setuplayout[tight]

\starttext

\subject{Good riddance}

We're done with math. After years of active development, Mikael and Hans have
decided to quit working on math, and concentrate on \METAPOST\ and handing over
to the next generation instead. We lost our user to the way more popular
alternative (frozen in stone standards). Also, we had it with suboptimal math
fonts, Unicode math not getting improved, MathML constantly being changed,
browsers dealing with math differently every few years, math archives getting
polluted with tons of useless tagged math.

There are other motivations, like the European union imposing strict rules with
respect to accessibility in educational content management systems, and Dutch
schools trying to get rid of math in favor of simple calculus, if at all. This 
is
why the next iteration of the engine will no longer have a math engine:
MathLessTeX. Of course, in the beginning \MLTX\ will be compatible with \LMTX,
because we owe that to the users and we need to prototype the new engine anyway.

In order to get an idea of how we will get rid of the disturbing formulas, you
can load the module:

\starttyping
\usemodule[math-goodriddance]
\stoptyping

Until becoming the default setting, the command \typ {\goodriddancemath} will
bring you into \MLTX\ mode while \typ {\badriddancemath} will bring you back to
the obsolete \LMTX\ mode. Like:

\startbuffer
\usemodule[math-goodriddance] \goodriddancemath

Who wants to solve the equation \m {x + 1 = 4} or deal with the function \m {x 
\mapsto
\root [3] {x}}, when we have AI around the corner to help us out with simple 
and silly
things like the Pythagorean theorem: \m {a^2 + b^2 = c^2}, or even with more 
advanced
math like geometric series: \m {\sum_{k = 0}^{+\infty} x^k = 1/(1 - x)}?

We will not support complicated nonsense stuff like:

\startplaceformula
\startformula
F__{1}{2}(a,b;b;z) = (1 - z)^{-a}
\stopformula
\stopplaceformula

When developing this Hans' Swedish improved a lot. {\language[sv] Den lilla del 
av
befolkningen som handlar på IKEA och tittar på fåniga krimserier förstår kanske 
detta:
\im {\sqrt {x + 1} = \sin(4 + y)}!}
\stopbuffer

\typebuffer[option=TEX]

Which gives us the beautifully typeset:

\startcolor[darkblue] \getbuffer \stopcolor

We hope that the highly respected Swedish Academy will consider our prose in
their upcoming evaluations. Our first submission to the leading \TEX\ journal 
was
how

[NTG-context] Re: how to include an an svg file?

2024-03-16 Thread Jean-Pierre Delange

Dear CTX wizards,

The commands given by Hans don't work properly in my case (with CTX on 
Windows 11). I am probably ignorant of how to implement \startMPpage. 
I'm not a "MetaPost lover", but I'd like to understand something; 
especially as I know how to make simple frames to include summaries.


In any case, the MWE below correctly displays the "smile" images (in 
*.pdf format) and incorrectly displays the smile.svg image). On the 
other hand, the \startMPpage script given by Hans only produces a white 
square. The *.log is attached.


The MWE :

\starttext

\startchapter[title={MetaPost}]


First : a draw sample with a simple command %\externalfigure


\externalfigure[smile.pdf]


% Hans comments on Metapost


Now gives the attached but it took me a while to figure out what works. 
An inkscape export adds for instance something (globally applied) that 
is not in the svg file (which actually derived from tiger.svg as 
mentioned in the file).



To be honest this is a horrible file and a good example of making things 
more complex than needed (probably common in wysiwyg applications), 
although we already had the machinery in the mp/pdf converter.



The biggest issue here is that one has to put some constrants in place 
order to make it work in e.g. sumatra (mypdf) and acrobat (which here 
actually does weird erratic things when I play with another test).



As with much complex svg, browsers also differ in interpretation o fsome 
features so it's hard to figure out what to do when there are 
conflicting demands. (Pointing to something that works tomorrow doesn't 
mean it worked when we tried to implement something yesterday.)



For Hraban - who mentioned it - i also added support for group opacity 
and transformed shades.



Hans Hagen


% If we use another call to the same smile drawing (but in *.svg format)

% the svg file is given by Inkscape (as the smile.pdf, exported through 
Inkscape)



\startMPcode

draw lmt_svg [ filename = "smile.svg"]

\stopMPcode



\stopchapter


\startchapter[title={Hans tricky drawing}]


Now, see the results of Hans has given to \quote{metapost lovers}, here 
is some of the trickery used :



\startMPpage[offset=1ts]


draw image (

fill (unitsquare xscaled 10cm yscaled 4cm)

withcolor svgcolor(0.5,0,0)

;


registerluminositygroup ("test") (

fill (unitsquare scaled 2cm) shifted (1cm,1cm)

withshademethod "circular"

withshadecolors (.6,.1)

) ;


applyluminositygroup ("test") (

fill (unitsquare scaled 2cm) shifted (1cm,1cm)

withshademethod "circular"

) ;


draw luminositygroup (

fill (unitsquare scaled 2cm) shifted (4cm,1cm)

withshademethod "circular"

withshadecolors (.6,.1)

) (

fill (unitsquare scaled 2cm) shifted (4cm,1cm)

withshademethod "circular"

) ;


draw luminosityshade (

(unitsquare scaled 2cm) shifted (7cm,1cm)

) (

withshademethod "circular"

withshadecolors (.6,.1)

) (

withshademethod "circular"

) ;

) ;


\stopMPpage

\stopchapter


\stoptext


Le 15/03/2024 à 20:39, Hans Hagen via ntg-context a écrit :

On 3/13/2024 9:16 AM, Henning Hraban Ramm wrote:

Am 12.03.24 um 23:59 schrieb seyal zavira:
You are correct. when i convert this svg to pdf via inkscape it 
works like a charm.


But what is standard way of including an svg file with context if we 
want to inkscape render the images?


\externalfigure[smile]

without any other settings, but inkscape must be callable on the 
command line (which doesn’t work for me on MacOS any more, must 
investigate…).

    \startMPcode
    draw lmt_svg [ filename = "smile.svg"]
    \stopMPcode

Now gives the attached but it took me a while to figure out what 
works. An inkscape export adds for instance something (globally 
applied) that is not in the svg file (which actually derived from 
tiger.svg as mentioned in the file).


To be honest this is a horrible file and a good example of making 
things more complex than needed (probably common in wysiwyg 
applications), although we already had the machinery in the mp/pdf 
converter.


The biggest issue here is that one has to put some constrants in place 
order to make it work in e.g. sumatra (mypdf) and acrobat (which here 
actually does weird erratic things when I play with another test).


As with much complex svg, browsers also differ in interpretation o 
fsome features so it's hard to figure out what to do when there are 
conflicting demands. (Pointing to something that works tomorrow 
doesn't mean it worked when we tried to implement something yesterday.)


For Hraben - who mentioned it - i also added support for group opacity 
and transformed shades.


In the process I tried a few inkscape options (pdf export) but some 
produce faulty files (with missing stuff) so i guess we have a complex 
situation in general. That said, as long as one sticks to reliable and 
clean code (plain svg) it should mostly work out.


Text is

[NTG-context] Re: how to include an an svg file?

2024-03-15 Thread seyal zavira
Thanks you and harban for all your thorough explanation.

On Fri, 15 Mar 2024, 23:11 Hans Hagen via ntg-context, 
wrote:

> On 3/13/2024 9:16 AM, Henning Hraban Ramm wrote:
> > Am 12.03.24 um 23:59 schrieb seyal zavira:
> >> You are correct. when i convert this svg to pdf via inkscape it works
> >> like a charm.
> >>
> >> But what is standard way of including an svg file with context if we
> >> want to inkscape render the images?
> >
> > \externalfigure[smile]
> >
> > without any other settings, but inkscape must be callable on the command
> > line (which doesn’t work for me on MacOS any more, must investigate…).
>  \startMPcode
>  draw lmt_svg [ filename = "smile.svg"]
>  \stopMPcode
>
> Now gives the attached but it took me a while to figure out what works.
> An inkscape export adds for instance something (globally applied) that
> is not in the svg file (which actually derived from tiger.svg as
> mentioned in the file).
>
> To be honest this is a horrible file and a good example of making things
> more complex than needed (probably common in wysiwyg applications),
> although we already had the machinery in the mp/pdf converter.
>
> The biggest issue here is that one has to put some constrants in place
> order to make it work in e.g. sumatra (mypdf) and acrobat (which here
> actually does weird erratic things when I play with another test).
>
> As with much complex svg, browsers also differ in interpretation o fsome
> features so it's hard to figure out what to do when there are
> conflicting demands. (Pointing to something that works tomorrow doesn't
> mean it worked when we tried to implement something yesterday.)
>
> For Hraben - who mentioned it - i also added support for group opacity
> and transformed shades.
>
> In the process I tried a few inkscape options (pdf export) but some
> produce faulty files (with missing stuff) so i guess we have a complex
> situation in general. That said, as long as one sticks to reliable and
> clean code (plain svg) it should mostly work out.
>
> Text is another matter because svg dropped glyph support so now
> everything has to go through font features which in turn means that if
> one uses svg as output format one has to specify every character with
> possible abuse of a substitution feature that accesses it. So that is no
> longer a real interesting option, unless of course one exports all text
> as curves, just to be sure.
>
> (I will extend general text suport but it will always be suboptimal but
> then, svg is not a long term archival format anyway.)
>
> No upload yet as i also want to do some cleanup,
>
> ps. For metapost lovers, here is some of the trickery used:
>
> \startMPpage[offset=1ts]
>
>  draw image (
>  fill (unitsquare xscaled 10cm yscaled 4cm)
>  withcolor svgcolor(0.5,0,0)
>  ;
>
>  registerluminositygroup ("test") (
>  fill (unitsquare scaled 2cm) shifted (1cm,1cm)
>  withshademethod "circular"
>  withshadecolors (.6,.1)
>  ) ;
>
>  applyluminositygroup ("test") (
>  fill (unitsquare scaled 2cm) shifted (1cm,1cm)
>  withshademethod "circular"
>  ) ;
>
>  draw luminositygroup (
>  fill (unitsquare scaled 2cm) shifted (4cm,1cm)
>  withshademethod "circular"
>  withshadecolors (.6,.1)
>  ) (
>  fill (unitsquare scaled 2cm) shifted (4cm,1cm)
>  withshademethod "circular"
>  ) ;
>
>  draw luminosityshade (
>  (unitsquare scaled 2cm) shifted (7cm,1cm)
>  ) (
>  withshademethod "circular"
>  withshadecolors (.6,.1)
>  ) (
>  withshademethod "circular"
>  ) ;
>  ) ;
>
> \stopMPpage
>
> Not that intuitive and a bit ugly deep down but it works (there was no
> need to extend mp btw as we already have graphic grouping in the engine).
>
> 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
> th

[NTG-context] Re: how to include an an svg file?

2024-03-15 Thread Hans Hagen via ntg-context

On 3/13/2024 9:16 AM, Henning Hraban Ramm wrote:

Am 12.03.24 um 23:59 schrieb seyal zavira:
You are correct. when i convert this svg to pdf via inkscape it works 
like a charm.


But what is standard way of including an svg file with context if we 
want to inkscape render the images?


\externalfigure[smile]

without any other settings, but inkscape must be callable on the command 
line (which doesn’t work for me on MacOS any more, must investigate…).

\startMPcode
draw lmt_svg [ filename = "smile.svg"]
\stopMPcode

Now gives the attached but it took me a while to figure out what works. 
An inkscape export adds for instance something (globally applied) that 
is not in the svg file (which actually derived from tiger.svg as 
mentioned in the file).


To be honest this is a horrible file and a good example of making things 
more complex than needed (probably common in wysiwyg applications), 
although we already had the machinery in the mp/pdf converter.


The biggest issue here is that one has to put some constrants in place 
order to make it work in e.g. sumatra (mypdf) and acrobat (which here 
actually does weird erratic things when I play with another test).


As with much complex svg, browsers also differ in interpretation o fsome 
features so it's hard to figure out what to do when there are 
conflicting demands. (Pointing to something that works tomorrow doesn't 
mean it worked when we tried to implement something yesterday.)


For Hraben - who mentioned it - i also added support for group opacity 
and transformed shades.


In the process I tried a few inkscape options (pdf export) but some 
produce faulty files (with missing stuff) so i guess we have a complex 
situation in general. That said, as long as one sticks to reliable and 
clean code (plain svg) it should mostly work out.


Text is another matter because svg dropped glyph support so now 
everything has to go through font features which in turn means that if 
one uses svg as output format one has to specify every character with 
possible abuse of a substitution feature that accesses it. So that is no 
longer a real interesting option, unless of course one exports all text 
as curves, just to be sure.


(I will extend general text suport but it will always be suboptimal but 
then, svg is not a long term archival format anyway.)


No upload yet as i also want to do some cleanup,

ps. For metapost lovers, here is some of the trickery used:

\startMPpage[offset=1ts]

draw image (
fill (unitsquare xscaled 10cm yscaled 4cm)
withcolor svgcolor(0.5,0,0)
;

registerluminositygroup ("test") (
fill (unitsquare scaled 2cm) shifted (1cm,1cm)
withshademethod "circular"
withshadecolors (.6,.1)
) ;

applyluminositygroup ("test") (
fill (unitsquare scaled 2cm) shifted (1cm,1cm)
withshademethod "circular"
) ;

draw luminositygroup (
fill (unitsquare scaled 2cm) shifted (4cm,1cm)
withshademethod "circular"
withshadecolors (.6,.1)
) (
fill (unitsquare scaled 2cm) shifted (4cm,1cm)
withshademethod "circular"
) ;

draw luminosityshade (
(unitsquare scaled 2cm) shifted (7cm,1cm)
) (
withshademethod "circular"
withshadecolors (.6,.1)
) (
withshademethod "circular"
) ;
) ;

\stopMPpage

Not that intuitive and a bit ugly deep down but it works (there was no 
need to extend mp btw as we already have graphic grouping in the engine).


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
-


smile-test.pdf
Description: Adobe PDF document


luminosity.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 / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: how to include an an svg file?

2024-03-13 Thread Jean-Pierre Delange

Hi Hraban & Seyal

I can confirm that converting the *.svg file into a *.pdf file displays 
the colour shades correctly ...

(I used Gimp to export the smile.svg file to a smile03.pdf file).

The MWE below works correctly, even if you have to make finer 
adjustments to place the figure in a precise position on the page. As 
I'm in the process of enriching and clarifying a few pages of the 
ConTeXt wiki and the French wikibook, I'm interested in the details 
concerning the position of figures, images and photos etc. So please let 
me know (in private mail) how you make your documents (a MWE will do).


\starttext

\input tufte


\externalfigure[smile03.pdf][conversion=mp]

\stoptext



It seems to me that Pablo has been struggling with the fine graining of 
PDF files in recent months, but I think it was more about the 
information contained in the PDF output than the processing of PDF 
images in *.tex file output.



JP


Le 13/03/2024 à 09:16, Henning Hraban Ramm a écrit :

Am 12.03.24 um 23:59 schrieb seyal zavira:
You are correct. when i convert this svg to pdf via inkscape it works 
like a charm.


But what is standard way of including an svg file with context if we 
want to inkscape render the images?


\externalfigure[smile]

without any other settings, but inkscape must be callable on the 
command line (which doesn’t work for me on MacOS any more, must 
investigate…).


Hraban
___ 

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


maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net 
(mirror)

archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___ 


ctx-test-metapost-svg.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 / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: how to include an an svg file?

2024-03-12 Thread Jean-Pierre Delange
Yes, the code given by Seyal gives only the circle vith eyes and mouth 
without colors (on my computer). But, It seems that one have to deal 
with a more complex lines of code. If I'm not mistaken, MetaPost alone 
natively supports only the 3 colours red, green and blue. To support 
CMYK colour gradients, MetaPost needs to work with Metafun (see here : 
https://wiki.contextgarden.net/Color_in_MetaPost).


Perhaps an image in *.png format is required. But I can't give any 
advice, as I'm not an experienced MetaPost/Metafun user.


see this code below and the result as attached file :

\starttext

\input tufte


\externalfigure[smile.svg][conversion=mp]

\stoptext


Best//JP


Le 12/03/2024 à 15:01, Henning Hraban Ramm a écrit :

Am 12.03.24 um 14:53 schrieb seyal zavira:

 > when i want to put some SVGs in my document the svg does not
    render properly here is the code:
 >
 > \starttext
 > \startMPcode
 > draw lmt_svg [
 > filename = "smile.svg"]
 > \stopMPcode
 > \stoptext


I can confirm the problem also with the regular image call

\externalfigure[smile.svg][conversion=mp]

Hraban
___ 

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


maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net 
(mirror)

archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___ 


ctx-test-metapost-svg.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 / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: Creating a module for calligraphy practice templates

2024-03-12 Thread Henning Hraban Ramm

Am 12.03.24 um 08:57 schrieb Andres Conrado Montoya:

Hello, list!

I've been working on a module to typeset calligraphy practice templates 
using ConTeXt and MetaPost. You are welcome to check it out on github: 
https://github.com/conradolandia/pauta 
<https://github.com/conradolandia/pauta>


Hi Andrés,

this looks interesting (even if I don’t do calligraphy any more).

Sorry, I can’t help you with your questions.

The structure of the module looks good and should work well with the 
module system.


Hraban

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

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Creating a module for calligraphy practice templates

2024-03-12 Thread Andres Conrado Montoya
Hello, list!

I've been working on a module to typeset calligraphy practice templates
using ConTeXt and MetaPost. You are welcome to check it out on github:
https://github.com/conradolandia/pauta
I'm not including a MWE because the repository has all the current code. I
hope this is fine. I did not want to clutter the list with too much text.
The module is only a single file (t-pauta.mkxl) and some examples of use
and documentation that are still somewhat unfinished, but I've tried to
document the source code as much as I could. If you need clarification
about anything, please let me know.

(At the root of the repository, there is a file build.lua, that is not
really part of the project, just a custom tool I use to process the files,
a sort of minimal build system. You can ignore it.)

I welcome any kind of suggestions and dire warnings. I've tried to read the
wiki and the manuals carefully and made as many tests as possible, and in
general it works fine, but I have ADHD and things frequently get over
my head. There are still some things that don't work as they should, and
things that need improvement:

1. I use top/bottom areas to display some info. These areas are not being
handled properly so far. For example, if I place a chapter before the Pauta
macro invocation, there will be data on the top and bottom areas in the
last page of the chapter. I've tried using \page and clearing the areas,
which feels like cheating, but still does not work well. Any ideas on how
to better handle this are more than welcome.

2. I'm using what I found at
https://wiki.contextgarden.net/System_Macros/Handling_Arguments and
\getparameters to handle the arguments for my Pauta macro, but today I
found out about \processaction at
https://wiki.contextgarden.net/Module_Parameters and I'm not really sure if
I should change my module to work with this instead of \getparameters. In
general, after checking the source code of several modules, I'm not really
sure how much I have to follow the guidelines at
https://wiki.contextgarden.net/Module_Parameters or if those are the most
current recommendations.

3. I'm including in my module the code of the file hatching.mp that can be
found at
https://ctan.org/tex-archive/graphics/metapost/contrib/macros/hatching. I
did this for portability reasons, since it's less than 70 lines and has not
been updated in 20 years. But if it's better to have this in a separate
file, please let me know. Also, if a better method to create pattern filled
paths is available, please let me know, I confess I didn't look too much
into it yet. This has solved my requirement so far.

4. I want to be as close as possible to the new LMTX syntax and way of
doing things. so If you think I'm doing something in anachronistic ways,
please let me know.

In general, if someone wants to check it out and provide feedback so I can
improve it, with the objective of eventually being shared on
modules.contextgarden.net, will be much appreciated.

Thank you for your time, and have a great week!

-- 
Andrés Conrado Montoya
Andi Kú
andresconr...@gmail.com
http://sesentaycuatro.com
http://messier87.com
http://chiquitico.org

Los fines no justifican los medios, porque la medida verdadera de nuestro
carácter está dada por los medios que estamos dispuestos a utilizar, no por
los fines que proclamamos.


“You develop an instant global consciousness, a people orientation, an
intense dissatisfaction with the state of the world, and a compulsion to do
something about it. From out there on the moon, international politics look
so petty. You want to grab a politician by the scruff of the neck and drag
him a quarter of a million miles out and say, ‘Look at that, you son of a
bitch.’” — Apollo 14 astronaut Edgar Mitchell
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: FreeBSD 13.2

2024-02-25 Thread Henning Hraban Ramm

Am 25.02.24 um 20:24 schrieb Roger Mason:

Hello Hraban,

Henning Hraban Ramm  writes:


Am 25.02.24 um 17:08 schrieb Roger Mason:



Do I need mtxrun?  If so, where are the sources and how do I build
it?


Yes, you need it, but it’s just an alias to luametatex:

~/context/tex/texmf-osx-64/bin $ ll
total 7704
-rw-r--r--@ 1 hraban  staff   6,0K 14 Dez 19:11 .DS_Store
lrwxr-xr-x  1 hraban  staff10B 22 Feb 18:47 context@ -> luametatex
-rw-r--r--  1 hraban  staff   1,3K 10 Aug  2023 context.lua
-rwxr-xr-x  1 hraban  staff   2,9M 22 Feb 18:47 luametatex*
lrwxr-xr-x  1 hraban  staff10B 22 Feb 18:47 mtxrun@ -> luametatex
-rw-r--r--  1 hraban  staff   685K 22 Feb 18:47 mtxrun.lua

The mtxrun in ~/context/bin is only used during installation.


What else do I need in ~/context/tex?  Currently I have

.
├── texmf-context
│   └── web2c
│   └── contextcnf.lua
└── texmf-freebsd-amd64
 └── bin
 ├── context -> luametatex
 ├── context.lua
 ├── luametatex
 ├── mtxrun -> luametatex
 └── mtxrun.lua


I guess you’re lacking the main distribution package.

My installation (tree -dL 4, partly shortened):

.
├── bin (installation only)
└── tex
├── texmf-cache (necessary, but auto-created?)
│   ├── luametatex-cache
│   │   └── context
│   └── luatex-cache
│   └── context
├── texmf-context (main tree)
│   ├── colors
│   │   └── icc
│   ├── context
│   │   └── data
│   ├── doc
│   │   ├── context
│   │   └── fonts
│   ├── fonts// (etc.)
│   ├── metapost
│   │   └── context
│   ├── scripts
│   │   └── context
│   ├── source
│   │   └── luametatex
│   ├── tex
│   │   ├── context
│   │   └── generic
│   └── web2c
├── texmf-fonts (not necessary)
├── texmf-local (not necessary)
│   └── doc
│   └── context
├── texmf-modules (not necessary)
│   ├── doc// (etc.)
│   ├── fonts// (etc.)
│   ├── metapost
│   │   └── context
│   ├── scripts
│   │   ├── context
│   │   └── pgfplots
│   ├── source
│   │   ├── context
│   │   └── luatex
│   ├── tex
│   │   ├── context
│   │   ├── generic
│   │   └── luatex
│   └── tpm
├── texmf-osx-64
│   └── bin
└── texmf-project (not necessary)

HTH

Hraban

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

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: MetaPost lines in tables?

2024-02-22 Thread Henning Hraban Ramm

Am 22.02.24 um 18:35 schrieb Hans Hagen via ntg-context:

On 2/21/2024 7:47 PM, Henning Hraban Ramm wrote:

(I’m sure I already used that somewhere… Must document…)
ok, new feature dedicated to Hraban ... who then of course has to 
document it.


This is nice.
Thank you, will do.

(Actually I’m not much interested in dashed borders but to have lines 
affected by my sketchy style - courtesy of Aditya et al., see below)


Taco, will the syntax pages in the wiki update automatically to a newer 
version?



"""
\startuseMPgraphic{mp:sketchy}
input mp-sketch.mp;
sketchypaths;

sketch_amount := 1 + (uniformdeviate 2);
sketch_passes := 3;
sketch_segments := 2 + (uniformdeviate 3);
sketch_length := OverlayWidth / 3;

draw topboundary withpen pensquare withcolor lightgray;
naturalizepaths;
\stopuseMPgraphic

\defineoverlay[sketchylines][\useMPgraphic{mp:sketchy}]

\setupTABLE[r][first][style=bold]
\setupTABLE[r][each][
topoffset=1em,bottomoffset=0.5em,
background=sketchylines,
% would be nice if the background wouldn’t start at each column
]
\setupTABLE[c][each][frame=off]
\bTABLE[]
\bTR
\bTD{Stadt}\eTD
\bTD{Land}\eTD
\bTD{Fluss}\eTD
\eTR
\dorecurse{10}{
\bTR
\bTD\strut \eTD\bTD \eTD\bTD \eTD
\eTR
}
\eTABLE
"""


Hraban%D \module
%D   [   file=mp-sketch.mp
%Dversion=2021.05.13
%D  title=\CONTEXT\ \METAPOST\ graphics,
%D   subtitle=Sketch drawing,
%D author=Aditya Mahajan,
%D   date=\currentdate,
%D  copyright={Aditya Mahajan}]

%D This metapost module is inspired by a TeX.SE question:
%D http://tex.stackexchange.com/q/39296/323
%D
%D I thought that it would be fun to implement a similar feature in MetaPost.
%D
%D To use this package in MetaPost:
%D
%D \starttyping
%Dinput mp-sketch;
%D
%Dbeginfig(1)
%D  sketchypaths; % Make draw and fill sketchy
%D  ...
%D  naturalizepaths; % Restore the value of draw and fill
%D  ...
%Dendfig
%D \stoptyping
%D
%D The code is heavily inspired by Hans Hagen's Metafun macros.
%D
%D The macro \type{sketchypaths} is modeled after \type{visualizepaths} from
%D \filename{mp-tool}.

def sketchypaths =
let draw = sketchdraw ;
let fill = sketchfill ;
enddef ;

%D Check if \filename{mp-tool} is loaded
if not known context_tool :
  let normaldraw = draw;
  let normalfill = fill;

  def naturalizepaths =
  let fill = normalfill ;
  let draw = normaldraw ;
  enddef ;
fi

%D The variable \type{sketch_amount} determines the amount of randomness in the
%D drawing
numeric sketch_amount; sketch_amount := 0.75bp;

%D The variable \type{sketch_passes} determines the number of times the path
%D is drawn
numeric sketch_passes; sketch_passes := 1;

%D Based on \type{randomized}. Assumes p is path:
numeric sketch_segments; sketch_segments := 20;

%D Length (time) of line segments:
numeric sketch_length; sketch_length := 5mm;

primarydef p sketchrandomized s = (
if path p :
for t = 0 step 1/sketch_segments until 1-1/sketch_segments :
((point   (t*arclength(p)) on p) 
randomshifted s) .. controls
((postcontrol (t*arclength(p)) on p) 
randomshifted s) and
((precontrol  ((t+1/sketch_segments)*arclength(p)) on p) 
randomshifted s) ..
endfor
% TODO: beide Ansätze kombinieren. Eckpunkte erhalten!

%for t = 0 step sketch_length until arclength p:
%  (point (arctime t of p) of p) randomshifted s ..
%endfor
if cycle p : % funktioniert nicht
  cycle
else :
  ((point   (arclength(p)) on p) randomshifted 
s)
  %(point (arctime t of p) of p) randomshifted s
fi
else :
p
fi
) enddef ;



%D The macro \type{sketchdraw} draws the randomized path. The
%D \type{expr} ... \type{text} trick is copied from the definition of
%D \type{drawarrow}
def sketchdraw expr p =
   do_sketchdraw(p)
enddef;

def do_sketchdraw(expr p) text t =
  if (path p) :
  for i = 1 upto max(1,sketch_passes) :
normaldraw p
   sketchrandomized sketch_amount
   withtransparency ("multiply", 1/max(1,sketch_passes))
   t ;
  endfor;
  else :
  normaldraw p t;
  fi
enddef;

%D The macro \type{sketchfill} randomizes the path before filling it.
def sketchfill expr p =
  do_sketchfill(p)
enddef ;

def do_sketchfill(expr p) text t =
  if (path p) :
  for i = 1 upto max(1,sketch_passes) :
normalfill p
   sketchrandomized sketch_amount
   withtransparency ("multiply", 1/max(1,sketch_passes))
   t ;
  endfor;
  else :
  normalfill p t;
  fi
enddef;

picture NoisePattern;
NoisePattern := image(
  pickup pencircle xyscaled 0.5bp;
  numeric pmax ; pmax := 7 ;
  numeric x ; numeric y ;
for i = 1 upto pmax:
for j = 1 upto pmax:
  

[NTG-context] Re: MetaPost lines in tables?

2024-02-22 Thread Hans Hagen via ntg-context

On 2/21/2024 7:47 PM, Henning Hraban Ramm wrote:

Am 21.02.24 um 19:43 schrieb Wolfgang Schuster:
… but it would be visible on a colored background. I’m sure you can 
show me a better way…


\startuseMPgraphic{dottedborder}
   draw bottomboundary OverlayBox withpen pencircle scaled 2 dashed 
withdots withcolor "red";

   setbounds currentpicture to OverlayBox;
\stopuseMPgraphic


Thank you!

(I’m sure I already used that somewhere… Must document…)
ok, new feature dedicated to Hraban ... who then of courese has to 
document it.


\starttext

\starttabulate
\FL[1,2] % linefactor (old) dashfactor (new)
\NC test \NC test and test and test and done \NC \NR
\ML[1,1]
\NC test \NC test and test and test and done \NC \NR
\NC test \NC test and test and test and done \NC \NR
\NC test \NC test and test and test and done \NC \NR
\LL[1,10]
\stoptabulate

\framed
  [align=middle,topframe=dash,frame=off]
  {\samplefile{tufte}}

\framed
  [align=middle,
   frame=dash,
   dashstep=.01hs,
   rulethickness=1pt]
  {\samplefile{tufte}}

\framed
  [align=middle,
   frame=dash,
   dashstep=10pt,
   rulethickness=2pt,
   background=color,
   backgroundcolor=gray]
  {\samplefile{tufte}}

\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 / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: MetaPost lines in tables?

2024-02-21 Thread Henning Hraban Ramm

Am 21.02.24 um 19:43 schrieb Wolfgang Schuster:
… but it would be visible on a colored background. I’m sure you can 
show me a better way…


\startuseMPgraphic{dottedborder}
   draw bottomboundary OverlayBox withpen pencircle scaled 2 dashed 
withdots withcolor "red";

   setbounds currentpicture to OverlayBox;
\stopuseMPgraphic


Thank you!

(I’m sure I already used that somewhere… Must document…)

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

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: MetaPost lines in tables?

2024-02-21 Thread Wolfgang Schuster

Henning Hraban Ramm schrieb am 21.02.2024 um 19:04:

Am 19.02.24 um 23:15 schrieb Wolfgang Schuster:

Henning Hraban Ramm schrieb am 19.02.2024 um 22:39:

I guess I asked this a while ago, but I can’t find an answer:
Is it possible to replace the lines of a TABLE with my own MetaPost 
graphics?


ATM I’m trying to place my MP lines behind a frame-less TABLE; it 
will probably work, but it’s a crutch…


The example below draws a custom border for the whole cell but you're 
free to draw only certain sides (leftboundary etc. helps) but don't 
forget to set the boundary box for the graphic (OverlayBox is the size 
of the cell).


 begin example
\startuseMPgraphic{dottedborder}
   draw OverlayBox withpen pencircle scaled 2 dashed withdots 
withcolor "red";

\stopuseMPgraphic

\defineoverlay[dottedborder][\useMPgraphic{dottedborder}]

\starttext

\bTABLE[frame=off,background=dottedborder]


Thank you!

Since I needed only horizontal lines, I forced the height with an 
“invisible“ line:


\startuseMPgraphic{dottedborder}
    draw (0,0)--(0,OverlayHeight) withpen pencircle scaled 0.001 
withcolor white;
    draw (0,0)--(OverlayWidth,0) withpen pencircle scaled 2 dashed 
withdots withcolor "red";

\stopuseMPgraphic

… but it would be visible on a colored background. I’m sure you can show 
me a better way…


\startuseMPgraphic{dottedborder}
  draw bottomboundary OverlayBox withpen pencircle scaled 2 dashed 
withdots withcolor "red";

  setbounds currentpicture to OverlayBox;
\stopuseMPgraphic

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

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: MetaPost lines in tables?

2024-02-21 Thread Henning Hraban Ramm

Am 19.02.24 um 23:15 schrieb Wolfgang Schuster:

Henning Hraban Ramm schrieb am 19.02.2024 um 22:39:

I guess I asked this a while ago, but I can’t find an answer:
Is it possible to replace the lines of a TABLE with my own MetaPost 
graphics?


ATM I’m trying to place my MP lines behind a frame-less TABLE; it will 
probably work, but it’s a crutch…


The example below draws a custom border for the whole cell but you're 
free to draw only certain sides (leftboundary etc. helps) but don't 
forget to set the boundary box for the graphic (OverlayBox is the size 
of the cell).


 begin example
\startuseMPgraphic{dottedborder}
   draw OverlayBox withpen pencircle scaled 2 dashed withdots withcolor 
"red";

\stopuseMPgraphic

\defineoverlay[dottedborder][\useMPgraphic{dottedborder}]

\starttext

\bTABLE[frame=off,background=dottedborder]


Thank you!

Since I needed only horizontal lines, I forced the height with an 
“invisible“ line:


\startuseMPgraphic{dottedborder}
   draw (0,0)--(0,OverlayHeight) withpen pencircle scaled 0.001 
withcolor white;
   draw (0,0)--(OverlayWidth,0) withpen pencircle scaled 2 dashed 
withdots withcolor "red";

\stopuseMPgraphic

… but it would be visible on a colored background. I’m sure you can show 
me a better way…


My real life example (p.2 in https://yemaya.fiee.net/s/DEEHs5m49yftiqW) 
involves sketchy lines, and there it’s a bit annoying that the row is 
not its own frame that could get a continuous background… Well, it’s 
good enough, I’ll settle for it.


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

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: MetaPost lines in tables?

2024-02-19 Thread Wolfgang Schuster

Henning Hraban Ramm schrieb am 19.02.2024 um 22:39:

I guess I asked this a while ago, but I can’t find an answer:
Is it possible to replace the lines of a TABLE with my own MetaPost 
graphics?


ATM I’m trying to place my MP lines behind a frame-less TABLE; it will 
probably work, but it’s a crutch…


The example below draws a custom border for the whole cell but you're 
free to draw only certain sides (leftboundary etc. helps) but don't 
forget to set the boundary box for the graphic (OverlayBox is the size 
of the cell).


 begin example
\startuseMPgraphic{dottedborder}
  draw OverlayBox withpen pencircle scaled 2 dashed withdots withcolor 
"red";

\stopuseMPgraphic

\defineoverlay[dottedborder][\useMPgraphic{dottedborder}]

\starttext

\bTABLE[frame=off,background=dottedborder]
  \bTR
\bTD Hello Table! \eTD
  \eTR
\eTABLE

\stoptext
 end example

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

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] MetaPost lines in tables?

2024-02-19 Thread Henning Hraban Ramm

I guess I asked this a while ago, but I can’t find an answer:
Is it possible to replace the lines of a TABLE with my own MetaPost 
graphics?


ATM I’m trying to place my MP lines behind a frame-less TABLE; it will 
probably work, but it’s a crutch…


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

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: Fwd: Re: Working with layer sets with Metapost

2024-02-19 Thread Emanuel Han via ntg-context
Thanks Mikael. This helped indeed.
I updated my example on the Metapost page in the wiki accordingly.

The`pagestate=start` functionality is not documented in the wiki. It's not 
clear for which context commands it can or should be used. Who is willing to 
help out here?
Best regards
Emanuel
On Feb. 19 2024, at 2:39 pm, Mikael Sundqvist  wrote:
> Hi,
>
> Try
> \startTEXpage[pagestate=start]
> /Mikael
> On Mon, Feb 19, 2024 at 2:31 PM Emanuel Han via ntg-context
>  wrote:
> >
> >  I just made a strange observation in the output pdf of the attached 
> > layer_set.tex, which is that when opening it with a pdf viewer like skim or 
> > macos preview and showing miniatures, all pages except the last one show 
> > page number 1 (the last showing page number 2).
> >
> > Which was not the case with the output pdf of the attached 
> > multipage_metapost_mwe-very_simple.tex.
> >
> > How can I change my code to have proper consecutive page numbering in a pdf 
> > viewer?
> >
> > On Feb. 17 2024, at 11:03 am, Emanuel Han via ntg-context 
> >  wrote:
> >
> > I think I could solve all the problems. Attached the finalized working 
> > example. I created the 
> > https://wiki.contextgarden.net/MetaPost#Layer_sets_as_individual_pages 
> > entry with it. Feel free to modify.
> >
> > Cheers
> > Emanuel
> >
> > On Feb. 16 2024, at 7:56 am, Mikael Sundqvist  wrote:
> >
> > Hi,
> >
> > not sure I get what you are missing. But you can try
> >
> > setbounds currentpicture to (fullsquare scaled 200) ;
> >
> > in base. And then do
> >
> > \dorecurse{5}{
> > \startTEXpage[offset=1DK]
> > \useMPgraphic{layerset#1}
> > \stopTEXpage
> > }
> >
> > if that is the looping you are after.
> >
> > /Mikael
> >
> > On Fri, Feb 16, 2024 at 6:54 AM Emanuel Han via ntg-context
> >  wrote:
> > >
> > > Resp. the solution should be such that each generated PDF page has the 
> > > same dimension, the same background colour and a page number and the 
> > > metapost content on each page has the same scaling factor.
> > >
> > > On Feb. 15 2024, at 11:10 pm, Emanuel Han via ntg-context 
> > >  wrote:
> > >
> > > Dear Mikael,
> > >
> > > I actually need to keep the \dorecurse mechanism of the mwe (from line 44 
> > > on), because I need the "setbounds currentpicture to TheFrame" and also 
> > > because I need page numbering inside the MPpage, as done with draw 
> > > textext(decimal(currentime)).
> > >
> > > So, how can I use the \useMPgraphic{layerset1} etc. inside the 
> > > \dorecurse, assuming I name my layersets "layerset1", "layerset2", 
> > > "layerset3" etc.?
> > >
> > > Emanuel
> > >
> > > On Feb. 15 2024, at 10:07 pm, Emanuel Han via ntg-context 
> > >  wrote:
> > >
> > > Dear Mikael,
> > > thanks a lot!
> > > this seems to be the solution! And it looks beatiful enough to me 
> > > I'll try to port all my layers to this new method and see if I run into 
> > > new problems again 
> > >
> > > Emanuel
> > >
> > >
> > > On Feb. 15 2024, at 8:19 am, Mikael Sundqvist  wrote:
> > >
> > > Hi
> > >
> > > On Thu, Feb 15, 2024 at 1:03 AM Emanuel Han via ntg-context
> > >  wrote:
> > > >
> > > > Dear list,
> > > >
> > > > the attached .tex file is the minimal working example we discussed 
> > > > today in the online meeting.
> > > >
> > > > I realized that the approach of looping through k of p[k] is not 
> > > > fitting my needs, because it's not flexible enough.
> > > >
> > > > I need another approach, one which works with layer sets.
> > > >
> > > > I would stop using p as an array, because with the layer sets approach 
> > > > we don't have a fixed order of the layers.
> > > >
> > > > So the definition of the layers would be something like
> > > >
> > > > picture layerA;
> > > > layerA:=image(
> > > > label("Word 1", z1);
> > > > );
> > > >
> > > > picture layerW;
> > > > layerW:=image(
> > > > label("Mot 2", z2);
> > > > );
> > > >
> > > > picture layerM;
> > > > layerM:=image(
> > > > label("Parola 3"

[NTG-context] Re: Fwd: Re: Working with layer sets with Metapost

2024-02-19 Thread Mikael Sundqvist
Hi,

Try

\startTEXpage[pagestate=start]

/Mikael

On Mon, Feb 19, 2024 at 2:31 PM Emanuel Han via ntg-context
 wrote:
>
>  I just made a strange observation in the output pdf of the attached 
> layer_set.tex, which is that when opening it with a pdf viewer like skim or 
> macos preview and showing miniatures, all pages except the last one show page 
> number 1 (the last showing page number 2).
>
> Which was not the case with the output pdf of the attached 
> multipage_metapost_mwe-very_simple.tex.
>
> How can I change my code to have proper consecutive page numbering in a pdf 
> viewer?
>
> On Feb. 17 2024, at 11:03 am, Emanuel Han via ntg-context 
>  wrote:
>
> I think I could solve all the problems. Attached the finalized working 
> example. I created the 
> https://wiki.contextgarden.net/MetaPost#Layer_sets_as_individual_pages entry 
> with it. Feel free to modify.
>
> Cheers
> Emanuel
>
> On Feb. 16 2024, at 7:56 am, Mikael Sundqvist  wrote:
>
> Hi,
>
> not sure I get what you are missing. But you can try
>
> setbounds currentpicture to (fullsquare scaled 200) ;
>
> in base. And then do
>
> \dorecurse{5}{
> \startTEXpage[offset=1DK]
> \useMPgraphic{layerset#1}
> \stopTEXpage
> }
>
> if that is the looping you are after.
>
> /Mikael
>
> On Fri, Feb 16, 2024 at 6:54 AM Emanuel Han via ntg-context
>  wrote:
> >
> > Resp. the solution should be such that each generated PDF page has the same 
> > dimension, the same background colour and a page number and the metapost 
> > content on each page has the same scaling factor.
> >
> > On Feb. 15 2024, at 11:10 pm, Emanuel Han via ntg-context 
> >  wrote:
> >
> > Dear Mikael,
> >
> > I actually need to keep the \dorecurse mechanism of the mwe (from line 44 
> > on), because I need the "setbounds currentpicture to TheFrame" and also 
> > because I need page numbering inside the MPpage, as done with draw 
> > textext(decimal(currentime)).
> >
> > So, how can I use the \useMPgraphic{layerset1} etc. inside the \dorecurse, 
> > assuming I name my layersets "layerset1", "layerset2", "layerset3" etc.?
> >
> > Emanuel
> >
> > On Feb. 15 2024, at 10:07 pm, Emanuel Han via ntg-context 
> >  wrote:
> >
> > Dear Mikael,
> > thanks a lot!
> > this seems to be the solution! And it looks beatiful enough to me 
> > I'll try to port all my layers to this new method and see if I run into new 
> > problems again 
> >
> > Emanuel
> >
> >
> > On Feb. 15 2024, at 8:19 am, Mikael Sundqvist  wrote:
> >
> > Hi
> >
> > On Thu, Feb 15, 2024 at 1:03 AM Emanuel Han via ntg-context
> >  wrote:
> > >
> > > Dear list,
> > >
> > > the attached .tex file is the minimal working example we discussed today 
> > > in the online meeting.
> > >
> > > I realized that the approach of looping through k of p[k] is not fitting 
> > > my needs, because it's not flexible enough.
> > >
> > > I need another approach, one which works with layer sets.
> > >
> > > I would stop using p as an array, because with the layer sets approach we 
> > > don't have a fixed order of the layers.
> > >
> > > So the definition of the layers would be something like
> > >
> > > picture layerA;
> > > layerA:=image(
> > > label("Word 1", z1);
> > > );
> > >
> > > picture layerW;
> > > layerW:=image(
> > > label("Mot 2", z2);
> > > );
> > >
> > > picture layerM;
> > > layerM:=image(
> > > label("Parola 3", z3);
> > > );
> > >
> > > picture layerC;
> > > layerC:=image(
> > > label("Wort 4", z3+z1);
> > > );
> > >
> > > picture layerY;
> > > layerY:=image(
> > > label("Nummer 5", z2+z3);
> > > );
> > >
> > > picture layerU;
> > > layerU:=image(
> > > label("number 6", z2+z1);
> > > );
> > >
> > > After that, I would define layer sets and layer subsets. This will be 
> > > done manually for each layer set and each layer subset.
> > > I don't know the proper syntax to do that. Let's assume we could use a 
> > > variable type called "myset".
> > >
> > > myset layersubsetGamma;
> > > layersubsetGamma:={layerU,layerM};
> > >
> > > In my logic, the layers will be drawn i

[NTG-context] Fwd: Re: Working with layer sets with Metapost

2024-02-19 Thread Emanuel Han via ntg-context
 I just made a strange observation in the output pdf of the attached layer_set.tex, which is that when opening it with a pdf viewer like skim or macos preview and showing miniatures, all pages except the last one show page number 1 (the last showing page number 2). Which was not the case with the output pdf of the attached multipage_metapost_mwe-very_simple.tex. How can I change my code to have proper consecutive page numbering in a pdf viewer?On Feb. 17 2024, at 11:03 am, Emanuel Han via ntg-context  wrote:I think I could solve all the problems. Attached the finalized working example. I created the https://wiki.contextgarden.net/MetaPost#Layer_sets_as_individual_pages entry with it. Feel free to modify.CheersEmanuelOn Feb. 16 2024, at 7:56 am, Mikael Sundqvist  wrote:Hi,not sure I get what you are missing. But you can trysetbounds currentpicture to (fullsquare scaled 200) ;in base. And then do\dorecurse{5}{\startTEXpage[offset=1DK]\useMPgraphic{layerset#1}\stopTEXpage}if that is the looping you are after./MikaelOn Fri, Feb 16, 2024 at 6:54 AM Emanuel Han via ntg-context wrote:>> Resp. the solution should be such that each generated PDF page has the same dimension, the same background colour and a page number and the metapost content on each page has the same scaling factor.>> On Feb. 15 2024, at 11:10 pm, Emanuel Han via ntg-context  wrote:>> Dear Mikael,>> I actually need to keep the \dorecurse mechanism of the mwe (from line 44 on), because I need the "setbounds currentpicture to TheFrame" and also because I need page numbering inside the MPpage, as done with draw textext(decimal(currentime)).>> So, how can I use the \useMPgraphic{layerset1} etc. inside the \dorecurse, assuming I name my layersets "layerset1", "layerset2", "layerset3" etc.?>> Emanuel>> On Feb. 15 2024, at 10:07 pm, Emanuel Han via ntg-context  wrote:>> Dear Mikael,> thanks a lot!> this seems to be the solution! And it looks beatiful enough to me > I'll try to port all my layers to this new method and see if I run into new problems again >> Emanuel>>> On Feb. 15 2024, at 8:19 am, Mikael Sundqvist  wrote:>> Hi>> On Thu, Feb 15, 2024 at 1:03 AM Emanuel Han via ntg-context>  wrote:> >> > Dear list,> >> > the attached .tex file is the minimal working example we discussed today in the online meeting.> >> > I realized that the approach of looping through k of p[k] is not fitting my needs, because it's not flexible enough.> >> > I need another approach, one which works with layer sets.> >> > I would stop using p as an array, because with the layer sets approach we don't have a fixed order of the layers.> >> > So the definition of the layers would be something like> >> > picture layerA;> > layerA:=image(> > label("Word 1", z1);> > );> >> > picture layerW;> > layerW:=image(> > label("Mot 2", z2);> > );> >> > picture layerM;> > layerM:=image(> > label("Parola 3", z3);> > );> >> > picture layerC;> > layerC:=image(> > label("Wort 4", z3+z1);> > );> >> > picture layerY;> > layerY:=image(> > label("Nummer 5", z2+z3);> > );> >> > picture layerU;> > layerU:=image(> > label("number 6", z2+z1);> > );> >> > After that, I would define layer sets and layer subsets. This will be done manually for each layer set and each layer subset.> > I don't know the proper syntax to do that. Let's assume we could use a variable type called "myset".> >> > myset layersubsetGamma;> > layersubsetGamma:={layerU,layerM};> >> > In my logic, the layers will be drawn in the order of their appearance within the {}. In the example, drawn content of layerM might cover drawn content of layerU.> >> > Contrary to a layer subset, each layer set will result in a PDF page, and thus the layer sets are related to each other by an inner order. That's why I would use an array variable here with [].> >> > I don't know how to append a set. In the following example, I assumed there would be a function myappend(, )> >> > myset layerset[];> > layerset1 := {layerW,layerA};> > layerset2 := myappend{layerset1, layerY};> > layerset3 := myappend{layerset2, layersubsetGamma};> > layerset4 := myappend{layerset2, layerU};> > layerset5 := myappend{layerset4, layersubsetGamma};> >> > Finally, I would need each layerset[k] typeset on its own pdf page. And of course on each page k, only the layers which appear in the definition of the layerset[k] should be drawn on top of each other in the order as they appear in that definition.> >>

[NTG-context] Re: manuals

2024-02-18 Thread Jean-Pierre Delange

Hello everyone!
 As an eternal newbie (with a memory like a goldfish), I started by 
building my own documentation from the web pages constructed by Bertrand 
Masson (prehistory archaeologist in Northern France) "les fiches à 
Bébert" (obsolete version here: http://bertrandmasson.free.fr/; new 
recommended version here: 
http://lesfichesabebert.fr/TeX/context/context-intro.html). As 
mentionned by Alain Delmotte.
Bertrand Masson always keeps his site up to date, as he gives references 
to the documentation compiled by Garulfo (Joaquín Ataz López ), 
available in several languages, which I personally found well-done, 
useful and welcome. It's interesting to note with a rather positive 
smile that documentations, even if they're never really up to date in 
the details of ConTeXt's evolution, copy each other: that's what I did 
to write the beginning of a Wikibook in French 
(https://fr.wikibooks.org/wiki/ConTeXt/Qu%27est-ce_que_ConTeXt_%3F). I 
took things written by Bertrand Masson and was partially taken over by 
Garulfo and so on.
Fortunately, the ConTeXT discussion list offers MWEs: all you have to do 
is to test them and save these examples on your system in the CTX-TESTS 
document folder. The next step is to classify these examples under the 
appropriate headings, then insert them into a coding system for a 
complex document that always calls for requests for explanations from 
discussion list participants.


This question of documentation seems to me to be an age-old snake, not 
only on a technical subject which can be complex, as ConTeXt can be, but 
also concerning other types of documentation. For my part, although I 
haven't yet exhausted all the available documentation resources, whether 
internal to the distribution, or online like the ConTeXt Garden wiki, I 
think (but this has been better expressed here by others than me) that a 
real documentation refresh could be carried out collectively, with the 
great ambition of keeping obsolete documentation in an archive, while 
proposing a wiki with the date of update visible, in correlation with 
the PDF version. I have no idea how this documentation update could be 
achieved, but the fact is that it would be desirable to devote a section 
to the purely technical and basic aspects of CTX installation and font 
availability on Windows, Mac OS, Linux, BSD, etc., with MWEs and 
examples a little more detailed. Once this documentation has been passed 
as an introductory part (itself containing chapters explaining how this 
page of documentation was put together, with notes in the margins, 
etc.), this book could introduce MKIV, LuaTeX, MetaPost and so on, but 
with a clear distinction between the objectives sought: writing 
documentation with figures, writing a thesis in mathematics and physics, 
how to construct figures, or a bibliography. Not to mention the handling 
of photographs in an aesthetically demanding layout; all this with the 
possibility of showing complete or partial examples of work produced...


In a nutshell: even if I give the impression that I'm asking you to 
reinvent the wheel, in reality it's a question of collating relevant 
existing information in a way that is intelligible and clear to the 
neophyte, but that also meets the demands of experienced users, who 
don't all use ConTeXt for the same reasons. Don't get me wrong: I'm not 
telling you what to do, I'm just giving you my opinion. Basically, I'm 
saying: documentation exists, but it has to be reliable, up to date, 
easy to find and enable you to make progress in difficult situations. As 
I said, I found Garulfo's work very welcome. It's not obsolete and 
doesn't need replacing. But perhaps it could be amended on certain 
points and completed and made available both in PDF and online in the 
ConTeXt Garden wiki pages?


So, if by hypothesis the relevant documentation exists, here and there, 
but it's in the middle of pages that are in the past, it can be 
considered a daunting task to go looking for information that you 
realize is no longer up to date, because experience shows that it's no 
longer reliable. If confusion reigns, those seeking to apply what 
they've read risk turning away from ConTeXt, or asking the same 
questions over and over again.


So there's plenty of food for thought to be had when it comes to methods 
for overhauling existing documentation. It's not a question of thinking 
long and hard about the availability of this documentation (on line or 
as a PDF?), but rather of knowing whether to build an encyclopedia, or a 
series of manuals, each of which is intended to circumscribe as closely 
as possible the problems encountered when attempting this or that form 
of page layout.


I remember being astonished to discover, when I first started learning 
ConTeXt, all the vocabulary that existed around page layout (in French: 
Grand fond, petit fond, blanc de tête, blanc de pied, etc.), vocabulary 
that we ignore when we come from Word office autom

[NTG-context] Re: Memory consumption in new upload

2024-02-17 Thread Hans Hagen

On 2/17/2024 10:50 PM, Shiv Shankar Dayal wrote:
I assume you would have created typescripts for those fonts. Can you 
please add them to

ConTeXt distribution, at least for the popular fonts?


Many of those are covered by typescripts. Those that are not, are on my 
machine because we needed them (often long ago) for a project (these are 
commercial fonts, in most cases typeone and of such a collection 
actually a few were used then). There are also some commercial fonts 
that I got for free. Then there are fonts that I have to check because 
users had an issue (public ones, of different quality and useability). 
Of those 'trying to cover all of unicode with  different fonts of the 
same design' I tested subsets. And of course the fonts that come with 
the operating system (basically all fonts that context can access during 
a run).


We're not going to make typescripts for every combination as in practice 
for most documents one needs a single setup and therefore only a handful 
of lines of code (and likely use some typescript file for a math font). 
There's also the selectfont mechanism that uses heuristics to do the 
same. There are plenty of examples in the distribution and for a 
specific style that demands certain fonts one can also put the 
definitions in the style.


On Sun, Feb 18, 2024 at 3:12 AM Shiv Shankar Dayal 
mailto:shivshankar.da...@gmail.com>> wrote:


The only change I made was that I started using a 9pt modern font
than a 10 pt modern font.

My document decreased from 580+ pages to 500 pages after that.

About your document, I assume you had a lot of Graphics because text
only 180MB is too high.
I have only few diagrams and my file size is only 3MB.

On Sun, Feb 18, 2024 at 2:13 AM Hans Hagen mailto:j.ha...@xs4all.nl>> wrote:

On 2/17/2024 6:17 PM, Shiv Shankar Dayal wrote:
 > Thanks for new upload. I see that memory consumption is much
less than
 > previous version. So
 > once again, thanks a lot.
 >
 > I am curious about what has changed in recent upload, that
memory
 > consumption is about 60% of earlier versions.
it's hard to tell what exact consumpiton is becaue for instance
when lua
creates tables, they grow by factors two when then have to
(maybe 5.5 is
a bit less consuming)

on the one hand luametatex is more efficient than luatex due to
all kind
of ímprovements' but some nodes are larger so that takes more
memory,
which is only noticed when one has lots of text on a page (or keeps
boxes stuff around)

anyway, not that much changed since the previous upload, so
maybe you
just stay below a threshold

I recently generated a 180MB document with 2500 fonts + metapost
outlines of them and that could bump mem usage (with empty
cache) to 30
GB (less after fonts were cached) but normally we stay around
125 MB for
a document. Anyway, tex mem consumption can often be neglected
compared
to other applications.

Hans


-
                                            Hans Hagen | PRAGMA ADE
                Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
         tel: 038 477 53 69 | www.pragma-ade.nl
<http://www.pragma-ade.nl> | www.pragma-pod.nl
<http://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 <mailto:ntg-context@ntg.nl> /
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
<https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl>
webpage  : https://www.pragma-ade.nl <https://www.pragma-ade.nl>
/ https://context.aanhet.net <https://context.aanhet.net> (mirror)
archive  : https://github.com/contextgarden/context
<https://github.com/contextgarden/context>
wiki     : https://wiki.contextgarden.net
<https://wiki.contextgarden.net>

___



-- 
Respect,

Shiv Shankar Dayal



--
Respect,
Shiv Shankar Dayal

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

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : http

[NTG-context] Re: Memory consumption in new upload

2024-02-17 Thread Shiv Shankar Dayal
I assume you would have created typescripts for those fonts. Can you please
add them to
ConTeXt distribution, at least for the popular fonts?

On Sun, Feb 18, 2024 at 3:12 AM Shiv Shankar Dayal <
shivshankar.da...@gmail.com> wrote:

> The only change I made was that I started using a 9pt modern font than a
> 10 pt modern font.
>
> My document decreased from 580+ pages to 500 pages after that.
>
> About your document, I assume you had a lot of Graphics because text only
> 180MB is too high.
> I have only few diagrams and my file size is only 3MB.
>
> On Sun, Feb 18, 2024 at 2:13 AM Hans Hagen  wrote:
>
>> On 2/17/2024 6:17 PM, Shiv Shankar Dayal wrote:
>> > Thanks for new upload. I see that memory consumption is much less than
>> > previous version. So
>> > once again, thanks a lot.
>> >
>> > I am curious about what has changed in recent upload, that memory
>> > consumption is about 60% of earlier versions.
>> it's hard to tell what exact consumpiton is becaue for instance when lua
>> creates tables, they grow by factors two when then have to (maybe 5.5 is
>> a bit less consuming)
>>
>> on the one hand luametatex is more efficient than luatex due to all kind
>> of ímprovements' but some nodes are larger so that takes more memory,
>> which is only noticed when one has lots of text on a page (or keeps
>> boxes stuff around)
>>
>> anyway, not that much changed since the previous upload, so maybe you
>> just stay below a threshold
>>
>> I recently generated a 180MB document with 2500 fonts + metapost
>> outlines of them and that could bump mem usage (with empty cache) to 30
>> GB (less after fonts were cached) but normally we stay around 125 MB for
>> a document. Anyway, tex mem consumption can often be neglected compared
>> to other applications.
>>
>> 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 /
>> https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
>> webpage  : https://www.pragma-ade.nl / https://context.aanhet.net
>> (mirror)
>> archive  : https://github.com/contextgarden/context
>> wiki : https://wiki.contextgarden.net
>>
>> ___
>>
>
>
> --
> Respect,
> Shiv Shankar Dayal
>


-- 
Respect,
Shiv Shankar Dayal
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: Memory consumption in new upload

2024-02-17 Thread Shiv Shankar Dayal
The only change I made was that I started using a 9pt modern font than a 10
pt modern font.

My document decreased from 580+ pages to 500 pages after that.

About your document, I assume you had a lot of Graphics because text only
180MB is too high.
I have only few diagrams and my file size is only 3MB.

On Sun, Feb 18, 2024 at 2:13 AM Hans Hagen  wrote:

> On 2/17/2024 6:17 PM, Shiv Shankar Dayal wrote:
> > Thanks for new upload. I see that memory consumption is much less than
> > previous version. So
> > once again, thanks a lot.
> >
> > I am curious about what has changed in recent upload, that memory
> > consumption is about 60% of earlier versions.
> it's hard to tell what exact consumpiton is becaue for instance when lua
> creates tables, they grow by factors two when then have to (maybe 5.5 is
> a bit less consuming)
>
> on the one hand luametatex is more efficient than luatex due to all kind
> of ímprovements' but some nodes are larger so that takes more memory,
> which is only noticed when one has lots of text on a page (or keeps
> boxes stuff around)
>
> anyway, not that much changed since the previous upload, so maybe you
> just stay below a threshold
>
> I recently generated a 180MB document with 2500 fonts + metapost
> outlines of them and that could bump mem usage (with empty cache) to 30
> GB (less after fonts were cached) but normally we stay around 125 MB for
> a document. Anyway, tex mem consumption can often be neglected compared
> to other applications.
>
> 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 /
> https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
> webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
> archive  : https://github.com/contextgarden/context
> wiki : https://wiki.contextgarden.net
>
> ___
>


-- 
Respect,
Shiv Shankar Dayal
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: Memory consumption in new upload

2024-02-17 Thread Hans Hagen

On 2/17/2024 6:17 PM, Shiv Shankar Dayal wrote:
Thanks for new upload. I see that memory consumption is much less than 
previous version. So

once again, thanks a lot.

I am curious about what has changed in recent upload, that memory 
consumption is about 60% of earlier versions.
it's hard to tell what exact consumpiton is becaue for instance when lua 
creates tables, they grow by factors two when then have to (maybe 5.5 is 
a bit less consuming)


on the one hand luametatex is more efficient than luatex due to all kind 
of ímprovements' but some nodes are larger so that takes more memory, 
which is only noticed when one has lots of text on a page (or keeps 
boxes stuff around)


anyway, not that much changed since the previous upload, so maybe you 
just stay below a threshold


I recently generated a 180MB document with 2500 fonts + metapost 
outlines of them and that could bump mem usage (with empty cache) to 30 
GB (less after fonts were cached) but normally we stay around 125 MB for 
a document. Anyway, tex mem consumption can often be neglected compared 
to other applications.


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 / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: Working with layer sets with Metapost

2024-02-17 Thread Emanuel Han via ntg-context
I think I could solve all the problems. Attached the finalized working example. 
I created the 
https://wiki.contextgarden.net/MetaPost#Layer_sets_as_individual_pages entry 
with it. Feel free to modify.

Cheers
Emanuel

On Feb. 16 2024, at 7:56 am, Mikael Sundqvist  wrote:
> Hi,
>
> not sure I get what you are missing. But you can try
> setbounds currentpicture to (fullsquare scaled 200) ;
> in base. And then do
> \dorecurse{5}{
> \startTEXpage[offset=1DK]
> \useMPgraphic{layerset#1}
> \stopTEXpage
> }
>
> if that is the looping you are after.
> /Mikael
> On Fri, Feb 16, 2024 at 6:54 AM Emanuel Han via ntg-context
>  wrote:
> >
> > Resp. the solution should be such that each generated PDF page has the same 
> > dimension, the same background colour and a page number and the metapost 
> > content on each page has the same scaling factor.
> >
> > On Feb. 15 2024, at 11:10 pm, Emanuel Han via ntg-context 
> >  wrote:
> >
> > Dear Mikael,
> >
> > I actually need to keep the \dorecurse mechanism of the mwe (from line 44 
> > on), because I need the "setbounds currentpicture to TheFrame" and also 
> > because I need page numbering inside the MPpage, as done with draw 
> > textext(decimal(currentime)).
> >
> > So, how can I use the \useMPgraphic{layerset1} etc. inside the \dorecurse, 
> > assuming I name my layersets "layerset1", "layerset2", "layerset3" etc.?
> >
> > Emanuel
> >
> > On Feb. 15 2024, at 10:07 pm, Emanuel Han via ntg-context 
> >  wrote:
> >
> > Dear Mikael,
> > thanks a lot!
> > this seems to be the solution! And it looks beatiful enough to me 
> > I'll try to port all my layers to this new method and see if I run into new 
> > problems again 
> >
> > Emanuel
> >
> >
> > On Feb. 15 2024, at 8:19 am, Mikael Sundqvist  wrote:
> >
> > Hi
> >
> > On Thu, Feb 15, 2024 at 1:03 AM Emanuel Han via ntg-context
> >  wrote:
> > >
> > > Dear list,
> > >
> > > the attached .tex file is the minimal working example we discussed today 
> > > in the online meeting.
> > >
> > > I realized that the approach of looping through k of p[k] is not fitting 
> > > my needs, because it's not flexible enough.
> > >
> > > I need another approach, one which works with layer sets.
> > >
> > > I would stop using p as an array, because with the layer sets approach we 
> > > don't have a fixed order of the layers.
> > >
> > > So the definition of the layers would be something like
> > >
> > > picture layerA;
> > > layerA:=image(
> > > label("Word 1", z1);
> > > );
> > >
> > > picture layerW;
> > > layerW:=image(
> > > label("Mot 2", z2);
> > > );
> > >
> > > picture layerM;
> > > layerM:=image(
> > > label("Parola 3", z3);
> > > );
> > >
> > > picture layerC;
> > > layerC:=image(
> > > label("Wort 4", z3+z1);
> > > );
> > >
> > > picture layerY;
> > > layerY:=image(
> > > label("Nummer 5", z2+z3);
> > > );
> > >
> > > picture layerU;
> > > layerU:=image(
> > > label("number 6", z2+z1);
> > > );
> > >
> > > After that, I would define layer sets and layer subsets. This will be 
> > > done manually for each layer set and each layer subset.
> > > I don't know the proper syntax to do that. Let's assume we could use a 
> > > variable type called "myset".
> > >
> > > myset layersubsetGamma;
> > > layersubsetGamma:={layerU,layerM};
> > >
> > > In my logic, the layers will be drawn in the order of their appearance 
> > > within the {}. In the example, drawn content of layerM might cover drawn 
> > > content of layerU.
> > >
> > > Contrary to a layer subset, each layer set will result in a PDF page, and 
> > > thus the layer sets are related to each other by an inner order. That's 
> > > why I would use an array variable here with [].
> > >
> > > I don't know how to append a set. In the following example, I assumed 
> > > there would be a function myappend(,  > > initial set should be appended with>)
> > >
> > > myset layerset[];
> > > layerset1 := {layerW,layerA};
> > > layerset2 := myappend{layerset1, layerY};
> > > layerset3 := myapp

[NTG-context] Re: Working with layer sets with Metapost

2024-02-15 Thread Mikael Sundqvist
Hi,

not sure I get what you are missing. But you can try

setbounds currentpicture to (fullsquare scaled 200) ;

in base. And then do

\dorecurse{5}{
\startTEXpage[offset=1DK]
\useMPgraphic{layerset#1}
\stopTEXpage
}

if that is the looping you are after.

/Mikael

On Fri, Feb 16, 2024 at 6:54 AM Emanuel Han via ntg-context
 wrote:
>
> Resp. the solution should be such that each generated PDF page has the same 
> dimension, the same background colour and a page number and the metapost 
> content on each page has the same scaling factor.
>
> On Feb. 15 2024, at 11:10 pm, Emanuel Han via ntg-context 
>  wrote:
>
> Dear Mikael,
>
> I actually need to keep the \dorecurse mechanism of the mwe (from line 44 
> on), because I need the "setbounds currentpicture to TheFrame" and also 
> because I need page numbering inside the MPpage, as done with draw 
> textext(decimal(currentime)).
>
> So, how can I use the \useMPgraphic{layerset1} etc. inside the \dorecurse, 
> assuming I name my layersets "layerset1", "layerset2", "layerset3" etc.?
>
> Emanuel
>
> On Feb. 15 2024, at 10:07 pm, Emanuel Han via ntg-context 
>  wrote:
>
> Dear Mikael,
> thanks a lot!
> this seems to be the solution! And it looks beatiful enough to me 
> I'll try to port all my layers to this new method and see if I run into new 
> problems again 
>
> Emanuel
>
>
> On Feb. 15 2024, at 8:19 am, Mikael Sundqvist  wrote:
>
> Hi
>
> On Thu, Feb 15, 2024 at 1:03 AM Emanuel Han via ntg-context
>  wrote:
> >
> > Dear list,
> >
> > the attached .tex file is the minimal working example we discussed today in 
> > the online meeting.
> >
> > I realized that the approach of looping through k of p[k] is not fitting my 
> > needs, because it's not flexible enough.
> >
> > I need another approach, one which works with layer sets.
> >
> > I would stop using p as an array, because with the layer sets approach we 
> > don't have a fixed order of the layers.
> >
> > So the definition of the layers would be something like
> >
> > picture layerA;
> > layerA:=image(
> > label("Word 1", z1);
> > );
> >
> > picture layerW;
> > layerW:=image(
> > label("Mot 2", z2);
> > );
> >
> > picture layerM;
> > layerM:=image(
> > label("Parola 3", z3);
> > );
> >
> > picture layerC;
> > layerC:=image(
> > label("Wort 4", z3+z1);
> > );
> >
> > picture layerY;
> > layerY:=image(
> > label("Nummer 5", z2+z3);
> > );
> >
> > picture layerU;
> > layerU:=image(
> > label("number 6", z2+z1);
> > );
> >
> > After that, I would define layer sets and layer subsets. This will be done 
> > manually for each layer set and each layer subset.
> > I don't know the proper syntax to do that. Let's assume we could use a 
> > variable type called "myset".
> >
> > myset layersubsetGamma;
> > layersubsetGamma:={layerU,layerM};
> >
> > In my logic, the layers will be drawn in the order of their appearance 
> > within the {}. In the example, drawn content of layerM might cover drawn 
> > content of layerU.
> >
> > Contrary to a layer subset, each layer set will result in a PDF page, and 
> > thus the layer sets are related to each other by an inner order. That's why 
> > I would use an array variable here with [].
> >
> > I don't know how to append a set. In the following example, I assumed there 
> > would be a function myappend(,  > set should be appended with>)
> >
> > myset layerset[];
> > layerset1 := {layerW,layerA};
> > layerset2 := myappend{layerset1, layerY};
> > layerset3 := myappend{layerset2, layersubsetGamma};
> > layerset4 := myappend{layerset2, layerU};
> > layerset5 := myappend{layerset4, layersubsetGamma};
> >
> > Finally, I would need each layerset[k] typeset on its own pdf page. And of 
> > course on each page k, only the layers which appear in the definition of 
> > the layerset[k] should be drawn on top of each other in the order as they 
> > appear in that definition.
> >
> > I'm very curious to hear your suggestions.
> >
>
> Not beautiful, perhaps, but maybe something like this could work? I
> think there is no way out of doing some manual work to tell what you
> want included on each page.
>
> \startuseMPgraphic{base}
> z1 = origin ;
> z2 = (10,50) ;
> z3 = (40,30) ;
>
> picture layerA;
> layerA:=image(
> label("Word 1", z1);

[NTG-context] Re: Working with layer sets with Metapost

2024-02-15 Thread Emanuel Han via ntg-context
Resp. the solution should be such that each generated PDF page has the same 
dimension, the same background colour and a page number and the metapost 
content on each page has the same scaling factor.

On Feb. 15 2024, at 11:10 pm, Emanuel Han via ntg-context  
wrote:
> Dear Mikael,
>
> I actually need to keep the \dorecurse mechanism of the mwe (from line 44 
> on), because I need the "setbounds currentpicture to TheFrame" and also 
> because I need page numbering inside the MPpage, as done with draw 
> textext(decimal(currentime)).
> So, how can I use the \useMPgraphic{layerset1} etc. inside the \dorecurse, 
> assuming I name my layersets "layerset1", "layerset2", "layerset3" etc.?
> Emanuel
> On Feb. 15 2024, at 10:07 pm, Emanuel Han via ntg-context 
>  wrote:
> > Dear Mikael,
> > thanks a lot!
> > this seems to be the solution! And it looks beatiful enough to me 
> > I'll try to port all my layers to this new method and see if I run into new 
> > problems again 
> >
> > Emanuel
> >
> > On Feb. 15 2024, at 8:19 am, Mikael Sundqvist  wrote:
> > > Hi
> > >
> > > On Thu, Feb 15, 2024 at 1:03 AM Emanuel Han via ntg-context
> > >  wrote:
> > > >
> > > > Dear list,
> > > >
> > > > the attached .tex file is the minimal working example we discussed 
> > > > today in the online meeting.
> > > >
> > > > I realized that the approach of looping through k of p[k] is not 
> > > > fitting my needs, because it's not flexible enough.
> > > >
> > > > I need another approach, one which works with layer sets.
> > > >
> > > > I would stop using p as an array, because with the layer sets approach 
> > > > we don't have a fixed order of the layers.
> > > >
> > > > So the definition of the layers would be something like
> > > >
> > > > picture layerA;
> > > > layerA:=image(
> > > > label("Word 1", z1);
> > > > );
> > > >
> > > > picture layerW;
> > > > layerW:=image(
> > > > label("Mot 2", z2);
> > > > );
> > > >
> > > > picture layerM;
> > > > layerM:=image(
> > > > label("Parola 3", z3);
> > > > );
> > > >
> > > > picture layerC;
> > > > layerC:=image(
> > > > label("Wort 4", z3+z1);
> > > > );
> > > >
> > > > picture layerY;
> > > > layerY:=image(
> > > > label("Nummer 5", z2+z3);
> > > > );
> > > >
> > > > picture layerU;
> > > > layerU:=image(
> > > > label("number 6", z2+z1);
> > > > );
> > > >
> > > > After that, I would define layer sets and layer subsets. This will be 
> > > > done manually for each layer set and each layer subset.
> > > > I don't know the proper syntax to do that. Let's assume we could use a 
> > > > variable type called "myset".
> > > >
> > > > myset layersubsetGamma;
> > > > layersubsetGamma:={layerU,layerM};
> > > >
> > > > In my logic, the layers will be drawn in the order of their appearance 
> > > > within the {}. In the example, drawn content of layerM might cover 
> > > > drawn content of layerU.
> > > >
> > > > Contrary to a layer subset, each layer set will result in a PDF page, 
> > > > and thus the layer sets are related to each other by an inner order. 
> > > > That's why I would use an array variable here with [].
> > > >
> > > > I don't know how to append a set. In the following example, I assumed 
> > > > there would be a function myappend(,  > > > initial set should be appended with>)
> > > >
> > > > myset layerset[];
> > > > layerset1 := {layerW,layerA};
> > > > layerset2 := myappend{layerset1, layerY};
> > > > layerset3 := myappend{layerset2, layersubsetGamma};
> > > > layerset4 := myappend{layerset2, layerU};
> > > > layerset5 := myappend{layerset4, layersubsetGamma};
> > > >
> > > > Finally, I would need each layerset[k] typeset on its own pdf page. And 
> > > > of course on each page k, only the layers which appear in the 
> > > > definition of the layerset[k] should be drawn on top of each other in 
> > > > the order as they appear in 

[NTG-context] Re: Working with layer sets with Metapost

2024-02-15 Thread Emanuel Han via ntg-context
Dear Mikael,

I actually need to keep the \dorecurse mechanism of the mwe (from line 44 on), 
because I need the "setbounds currentpicture to TheFrame" and also because I 
need page numbering inside the MPpage, as done with draw 
textext(decimal(currentime)).
So, how can I use the \useMPgraphic{layerset1} etc. inside the \dorecurse, 
assuming I name my layersets "layerset1", "layerset2", "layerset3" etc.?
Emanuel
On Feb. 15 2024, at 10:07 pm, Emanuel Han via ntg-context  
wrote:
> Dear Mikael,
> thanks a lot!
> this seems to be the solution! And it looks beatiful enough to me 
> I'll try to port all my layers to this new method and see if I run into new 
> problems again 
>
> Emanuel
>
> On Feb. 15 2024, at 8:19 am, Mikael Sundqvist  wrote:
> > Hi
> >
> > On Thu, Feb 15, 2024 at 1:03 AM Emanuel Han via ntg-context
> >  wrote:
> > >
> > > Dear list,
> > >
> > > the attached .tex file is the minimal working example we discussed today 
> > > in the online meeting.
> > >
> > > I realized that the approach of looping through k of p[k] is not fitting 
> > > my needs, because it's not flexible enough.
> > >
> > > I need another approach, one which works with layer sets.
> > >
> > > I would stop using p as an array, because with the layer sets approach we 
> > > don't have a fixed order of the layers.
> > >
> > > So the definition of the layers would be something like
> > >
> > > picture layerA;
> > > layerA:=image(
> > > label("Word 1", z1);
> > > );
> > >
> > > picture layerW;
> > > layerW:=image(
> > > label("Mot 2", z2);
> > > );
> > >
> > > picture layerM;
> > > layerM:=image(
> > > label("Parola 3", z3);
> > > );
> > >
> > > picture layerC;
> > > layerC:=image(
> > > label("Wort 4", z3+z1);
> > > );
> > >
> > > picture layerY;
> > > layerY:=image(
> > > label("Nummer 5", z2+z3);
> > > );
> > >
> > > picture layerU;
> > > layerU:=image(
> > > label("number 6", z2+z1);
> > > );
> > >
> > > After that, I would define layer sets and layer subsets. This will be 
> > > done manually for each layer set and each layer subset.
> > > I don't know the proper syntax to do that. Let's assume we could use a 
> > > variable type called "myset".
> > >
> > > myset layersubsetGamma;
> > > layersubsetGamma:={layerU,layerM};
> > >
> > > In my logic, the layers will be drawn in the order of their appearance 
> > > within the {}. In the example, drawn content of layerM might cover drawn 
> > > content of layerU.
> > >
> > > Contrary to a layer subset, each layer set will result in a PDF page, and 
> > > thus the layer sets are related to each other by an inner order. That's 
> > > why I would use an array variable here with [].
> > >
> > > I don't know how to append a set. In the following example, I assumed 
> > > there would be a function myappend(,  > > initial set should be appended with>)
> > >
> > > myset layerset[];
> > > layerset1 := {layerW,layerA};
> > > layerset2 := myappend{layerset1, layerY};
> > > layerset3 := myappend{layerset2, layersubsetGamma};
> > > layerset4 := myappend{layerset2, layerU};
> > > layerset5 := myappend{layerset4, layersubsetGamma};
> > >
> > > Finally, I would need each layerset[k] typeset on its own pdf page. And 
> > > of course on each page k, only the layers which appear in the definition 
> > > of the layerset[k] should be drawn on top of each other in the order as 
> > > they appear in that definition.
> > >
> > > I'm very curious to hear your suggestions.
> > >
> >
> > Not beautiful, perhaps, but maybe something like this could work? I
> > think there is no way out of doing some manual work to tell what you
> > want included on each page.
> >
> > \startuseMPgraphic{base}
> > z1 = origin ;
> > z2 = (10,50) ;
> > z3 = (40,30) ;
> >
> > picture layerA;
> > layerA:=image(
> > label("Word 1", z1);
> > );
> >
> > picture layerW;
> > layerW:=image(
> > label("Mot 2", z2);
> > );
> >
> > picture layerM;
> > layerM:=image(
> > label("Parola 3", z3);
> > );
> >
> > picture layerC;
> > layerC:=image(
> > label("Wort 4", z3+z1);
> > );
> >
> > picture layerY;
> > layerY:=image(
> > label("Nummer 5", z2+z3);
> > );
> >
> > picture layerU;
> > layerU:=image(
> > label("number 6", z2+z1);
> > );
> > \stopuseMPgraphic
> >
> > \startuseMPgraphic{Gamma}
> > draw layerU ;
> > draw layerM ;
> > \stopuseMPgraphic
> >
> > \startuseMPgraphic{layerset1}
> > \includeMPgraphic{base}
> > draw layerW ;
> > draw layerA ;
> > \stopuseMPgraphic
> >
> > \startuseMPgraphic{layerset2}
> > \includeMPgraphic{layerset1} ;
> > draw layerY ;
> > \stopuseMPgraphic
> >
> > \startuseMPgraphic{layerset3}
> > \includeMPgraphic{layerset2} ;
> > \includeMPgraphic{Gamma} ;
> > \stopuseMPgraphic
> >
> >
> > \startuseMPgraphic{layerset4}
> > \includeMPgraphic{layerset2} ;
> > draw layerU ;
> > \stopuseMPgraphic
> >
> > \startuseMPgraphic{layerset5}
> > \includeMPgraphic{layerset4} ;
> > \includeMPgraphic{Gamma} ;
> > \stopuseMPgraphic
> >
> > \starttext
> > \startTEXpage[offset=1DK]
> > \useMPgraphic{layerset1}
> > \stopTEXpage
> >
> 

[NTG-context] Re: Working with layer sets with Metapost

2024-02-15 Thread Emanuel Han via ntg-context
Dear Mikael,
thanks a lot!
this seems to be the solution! And it looks beatiful enough to me 
I'll try to port all my layers to this new method and see if I run into new 
problems again 

Emanuel

On Feb. 15 2024, at 8:19 am, Mikael Sundqvist  wrote:
> Hi
>
> On Thu, Feb 15, 2024 at 1:03 AM Emanuel Han via ntg-context
>  wrote:
> >
> > Dear list,
> >
> > the attached .tex file is the minimal working example we discussed today in 
> > the online meeting.
> >
> > I realized that the approach of looping through k of p[k] is not fitting my 
> > needs, because it's not flexible enough.
> >
> > I need another approach, one which works with layer sets.
> >
> > I would stop using p as an array, because with the layer sets approach we 
> > don't have a fixed order of the layers.
> >
> > So the definition of the layers would be something like
> >
> > picture layerA;
> > layerA:=image(
> > label("Word 1", z1);
> > );
> >
> > picture layerW;
> > layerW:=image(
> > label("Mot 2", z2);
> > );
> >
> > picture layerM;
> > layerM:=image(
> > label("Parola 3", z3);
> > );
> >
> > picture layerC;
> > layerC:=image(
> > label("Wort 4", z3+z1);
> > );
> >
> > picture layerY;
> > layerY:=image(
> > label("Nummer 5", z2+z3);
> > );
> >
> > picture layerU;
> > layerU:=image(
> > label("number 6", z2+z1);
> > );
> >
> > After that, I would define layer sets and layer subsets. This will be done 
> > manually for each layer set and each layer subset.
> > I don't know the proper syntax to do that. Let's assume we could use a 
> > variable type called "myset".
> >
> > myset layersubsetGamma;
> > layersubsetGamma:={layerU,layerM};
> >
> > In my logic, the layers will be drawn in the order of their appearance 
> > within the {}. In the example, drawn content of layerM might cover drawn 
> > content of layerU.
> >
> > Contrary to a layer subset, each layer set will result in a PDF page, and 
> > thus the layer sets are related to each other by an inner order. That's why 
> > I would use an array variable here with [].
> >
> > I don't know how to append a set. In the following example, I assumed there 
> > would be a function myappend(,  > set should be appended with>)
> >
> > myset layerset[];
> > layerset1 := {layerW,layerA};
> > layerset2 := myappend{layerset1, layerY};
> > layerset3 := myappend{layerset2, layersubsetGamma};
> > layerset4 := myappend{layerset2, layerU};
> > layerset5 := myappend{layerset4, layersubsetGamma};
> >
> > Finally, I would need each layerset[k] typeset on its own pdf page. And of 
> > course on each page k, only the layers which appear in the definition of 
> > the layerset[k] should be drawn on top of each other in the order as they 
> > appear in that definition.
> >
> > I'm very curious to hear your suggestions.
> >
>
> Not beautiful, perhaps, but maybe something like this could work? I
> think there is no way out of doing some manual work to tell what you
> want included on each page.
>
> \startuseMPgraphic{base}
> z1 = origin ;
> z2 = (10,50) ;
> z3 = (40,30) ;
>
> picture layerA;
> layerA:=image(
> label("Word 1", z1);
> );
>
> picture layerW;
> layerW:=image(
> label("Mot 2", z2);
> );
>
> picture layerM;
> layerM:=image(
> label("Parola 3", z3);
> );
>
> picture layerC;
> layerC:=image(
> label("Wort 4", z3+z1);
> );
>
> picture layerY;
> layerY:=image(
> label("Nummer 5", z2+z3);
> );
>
> picture layerU;
> layerU:=image(
> label("number 6", z2+z1);
> );
> \stopuseMPgraphic
>
> \startuseMPgraphic{Gamma}
> draw layerU ;
> draw layerM ;
> \stopuseMPgraphic
>
> \startuseMPgraphic{layerset1}
> \includeMPgraphic{base}
> draw layerW ;
> draw layerA ;
> \stopuseMPgraphic
>
> \startuseMPgraphic{layerset2}
> \includeMPgraphic{layerset1} ;
> draw layerY ;
> \stopuseMPgraphic
>
> \startuseMPgraphic{layerset3}
> \includeMPgraphic{layerset2} ;
> \includeMPgraphic{Gamma} ;
> \stopuseMPgraphic
>
>
> \startuseMPgraphic{layerset4}
> \includeMPgraphic{layerset2} ;
> draw layerU ;
> \stopuseMPgraphic
>
> \startuseMPgraphic{layerset5}
> \includeMPgraphic{layerset4} ;
> \includeMPgraphic{Gamma} ;
> \stopuseMPgraphic
>
> \starttext
> \startTEXpage[offset=1DK]
> \useMPgraphic{layerset1}
> \stopTEXpage
>
> \startTEXpage[offset=1DK]
> \useMPgraphic{layerset2}
> \stopTEXpage
>
> \startTEXpage[offset=1DK]
> \useMPgraphic{layerset3}
> \stopTEXpage
>
> \startTEXpage[offset=1DK]
> \useMPgraphic{layerset4}
> \stopTEXpage
>
> \startTEXpage[offset=1DK]
> \useMPgraphic{layerset5}
> \stopTEXpage
>
> \stoptext
> /Mikael
> ___
> If your question is of interest to others as well, please add an entry to the 
> Wiki!
>
> maillist : ntg-context@ntg.nl / 
> https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
> webpage : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
> archive : https://github.com/contextgarden/context
> wiki : https://wiki.contextgarden.net
> 

[NTG-context] Re: An announcement of my new book.

2024-02-15 Thread Henning Hraban Ramm
Don’t forget the articles from the context journal: 
https://articles.contextgarden.net/

(2022 is still missing)

Esp. Taco’s about MetaPost are very interesting and maybe that’s some 
low level stuff you’re missing.


You don’t need to look at Hans’ contributions – everything that’s still 
valid is in the distribution.


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

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: Working with layer sets with Metapost

2024-02-14 Thread Mikael Sundqvist
Hi

On Thu, Feb 15, 2024 at 1:03 AM Emanuel Han via ntg-context
 wrote:
>
> Dear list,
>
> the attached .tex file is the minimal working example we discussed today in 
> the online meeting.
>
> I realized that the approach of looping through k of p[k] is not fitting my 
> needs, because it's not flexible enough.
>
> I need another approach, one which works with layer sets.
>
> I would stop using p as an array, because with the layer sets approach we 
> don't have a fixed order of the layers.
>
> So the definition of the layers would be something like
>
> picture layerA;
> layerA:=image(
> label("Word 1", z1);
> );
>
> picture layerW;
> layerW:=image(
> label("Mot 2", z2);
> );
>
> picture layerM;
> layerM:=image(
> label("Parola 3", z3);
> );
>
> picture layerC;
> layerC:=image(
> label("Wort 4", z3+z1);
> );
>
> picture layerY;
> layerY:=image(
> label("Nummer 5", z2+z3);
> );
>
> picture layerU;
> layerU:=image(
> label("number 6", z2+z1);
> );
>
> After that, I would define layer sets and layer subsets. This will be done 
> manually for each layer set and each layer subset.
> I don't know the proper syntax to do that. Let's assume we could use a 
> variable type called "myset".
>
> myset layersubsetGamma;
> layersubsetGamma:={layerU,layerM};
>
> In my logic, the layers will be drawn in the order of their appearance within 
> the {}. In the example, drawn content of layerM might cover drawn content of 
> layerU.
>
> Contrary to a layer subset, each layer set will result in a PDF page, and 
> thus the layer sets are related to each other by an inner order. That's why I 
> would use an array variable here with [].
>
> I don't know how to append a set. In the following example, I assumed there 
> would be a function myappend(,  should be appended with>)
>
> myset layerset[];
> layerset1 := {layerW,layerA};
> layerset2 := myappend{layerset1, layerY};
> layerset3 := myappend{layerset2, layersubsetGamma};
> layerset4 := myappend{layerset2, layerU};
> layerset5 := myappend{layerset4, layersubsetGamma};
>
> Finally, I would need each layerset[k] typeset on its own pdf page. And of 
> course on each page k, only the layers which appear in the definition of the 
> layerset[k] should be drawn on top of each other in the order as they appear 
> in that definition.
>
> I'm very curious to hear your suggestions.
>

Not beautiful, perhaps, but maybe something like this could work? I
think there is no way out of doing some manual work to tell what you
want included on each page.

\startuseMPgraphic{base}
z1 = origin ;
z2 = (10,50) ;
z3 = (40,30) ;

picture layerA;
layerA:=image(
label("Word 1", z1);
);

picture layerW;
layerW:=image(
label("Mot 2", z2);
);

picture layerM;
layerM:=image(
label("Parola 3", z3);
);

picture layerC;
layerC:=image(
label("Wort 4", z3+z1);
);

picture layerY;
layerY:=image(
label("Nummer 5", z2+z3);
);

picture layerU;
layerU:=image(
label("number 6", z2+z1);
);
\stopuseMPgraphic

\startuseMPgraphic{Gamma}
draw layerU ;
draw layerM ;
\stopuseMPgraphic

\startuseMPgraphic{layerset1}
\includeMPgraphic{base}
draw layerW ;
draw layerA ;
\stopuseMPgraphic

\startuseMPgraphic{layerset2}
\includeMPgraphic{layerset1} ;
draw layerY ;
\stopuseMPgraphic

\startuseMPgraphic{layerset3}
\includeMPgraphic{layerset2} ;
\includeMPgraphic{Gamma} ;
\stopuseMPgraphic


\startuseMPgraphic{layerset4}
\includeMPgraphic{layerset2} ;
draw layerU ;
\stopuseMPgraphic

\startuseMPgraphic{layerset5}
\includeMPgraphic{layerset4} ;
\includeMPgraphic{Gamma} ;
\stopuseMPgraphic

\starttext

\startTEXpage[offset=1DK]
\useMPgraphic{layerset1}
\stopTEXpage

\startTEXpage[offset=1DK]
\useMPgraphic{layerset2}
\stopTEXpage

\startTEXpage[offset=1DK]
\useMPgraphic{layerset3}
\stopTEXpage

\startTEXpage[offset=1DK]
\useMPgraphic{layerset4}
\stopTEXpage

\startTEXpage[offset=1DK]
\useMPgraphic{layerset5}
\stopTEXpage

\stoptext

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

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Working with layer sets with Metapost

2024-02-14 Thread Emanuel Han via ntg-context
Dear list,

the attached .tex file is the minimal working example we discussed today in the 
online meeting.
I realized that the approach of looping through k of p[k] is not fitting my 
needs, because it's not flexible enough.
I need another approach, one which works with layer sets.
I would stop using p as an array, because with the layer sets approach we don't 
have a fixed order of the layers.
So the definition of the layers would be something like
picture layerA;
layerA:=image(
label("Word 1", z1);
);

picture layerW;
layerW:=image(
label("Mot 2", z2);
);

picture layerM;
layerM:=image(
label("Parola 3", z3);
);

picture layerC;
layerC:=image(
label("Wort 4", z3+z1);
);

picture layerY;
layerY:=image(
label("Nummer 5", z2+z3);
);

picture layerU;
layerU:=image(
label("number 6", z2+z1);
);

After that, I would define layer sets and layer subsets. This will be done 
manually for each layer set and each layer subset.
I don't know the proper syntax to do that. Let's assume we could use a variable 
type called "myset".

myset layersubsetGamma;
layersubsetGamma:={layerU,layerM};

In my logic, the layers will be drawn in the order of their appearance within 
the {}. In the example, drawn content of layerM might cover drawn content of 
layerU.
Contrary to a layer subset, each layer set will result in a PDF page, and thus 
the layer sets are related to each other by an inner order. That's why I would 
use an array variable here with [].
I don't know how to append a set. In the following example, I assumed there 
would be a function myappend(, )
myset layerset[];
layerset1 := {layerW,layerA};
layerset2 := myappend{layerset1, layerY};
layerset3 := myappend{layerset2, layersubsetGamma};
layerset4 := myappend{layerset2, layerU};
layerset5 := myappend{layerset4, layersubsetGamma};

Finally, I would need each layerset[k] typeset on its own pdf page. And of 
course on each page k, only the layers which appear in the definition of the 
layerset[k] should be drawn on top of each other in the order as they appear in 
that definition.
I'm very curious to hear your suggestions.
Thanks
Emanuel



multipage_metapost_mwe-very_simple.tex
Description: TeX document
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] upload

2024-02-14 Thread Hans Hagen

Hi,

as we're around texlive code freeze time we're also in upload mode

- i uploaded a new lmtx
- i also added linux and windows 32 bin (as it seems to have users)

- we're now using lua 5.5 which has one restriction (was already 
announced a while ago):


for i=1,10 in t do

i = 2 * i

end

should now be:

for i=1,10 in t do

local i = 2 * i

end

as one cannot change the (local constant) i which actually is not that 
different from what metapost does. The good news is that voilating this 
is reported when a lua file is loaded so one can't get it unexspectedly.


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 / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: Caching Metafun images and VIM Syntax highlighted code

2024-01-24 Thread Shiv Shankar Dayal
Dear Hans, Aditya,

Thanks for clarifying. In any case, I will process chapter-by-chapter,
so runtime should be manageable.

On Wed, Jan 24, 2024 at 10:32 PM Hans Hagen  wrote:

> On 1/24/2024 5:50 PM, Aditya Mahajan wrote:
> > On Wed, 24 Jan 2024, Shiv Shankar Dayal wrote:
> >
> >> Perhaps Aditya Mahajan can tell me how can I cache code snippets.
> Invoking
> >> VIM will have heavy penalty on highlighting the code otherwise.
> >
> > Have you tried the vim module:
> >
> > https://github.com/adityam/filter/blob/dev/vim-README.md
> >
> > Caching is enabled out of the box, so you don't need to configure
> anything.
> >
> >> Other than that, how can I cache Metafun images so that they are not
> >> recomputed on every processing of file.
> >
> > There used to a command for caching metafun images in MkII, but I don't
> know if that is really needed in LMTX. In most cases, metapost processing
> does not have a significant processing delay.
> if images are the same one can use the reuseMPgraphic or uniqueMPgraphic
> features .. plenty of examples can be found, but as Aditya poined out mp
> is quite fast (but reuse saves on file size)
>
> 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 /
> https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
> webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
> archive  : https://github.com/contextgarden/context
> wiki : https://wiki.contextgarden.net
>
> ___
>


-- 
Respect,
Shiv Shankar Dayal
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: Caching Metafun images and VIM Syntax highlighted code

2024-01-24 Thread Hans Hagen

On 1/24/2024 5:50 PM, Aditya Mahajan wrote:

On Wed, 24 Jan 2024, Shiv Shankar Dayal wrote:


Perhaps Aditya Mahajan can tell me how can I cache code snippets. Invoking
VIM will have heavy penalty on highlighting the code otherwise.


Have you tried the vim module:

https://github.com/adityam/filter/blob/dev/vim-README.md

Caching is enabled out of the box, so you don't need to configure anything.


Other than that, how can I cache Metafun images so that they are not
recomputed on every processing of file.


There used to a command for caching metafun images in MkII, but I don't know if 
that is really needed in LMTX. In most cases, metapost processing does not have 
a significant processing delay.
if images are the same one can use the reuseMPgraphic or uniqueMPgraphic 
features .. plenty of examples can be found, but as Aditya poined out mp 
is quite fast (but reuse saves on file size)


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 / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: Caching Metafun images and VIM Syntax highlighted code

2024-01-24 Thread Aditya Mahajan
On Wed, 24 Jan 2024, Shiv Shankar Dayal wrote:

> Perhaps Aditya Mahajan can tell me how can I cache code snippets. Invoking
> VIM will have heavy penalty on highlighting the code otherwise.

Have you tried the vim module:

https://github.com/adityam/filter/blob/dev/vim-README.md

Caching is enabled out of the box, so you don't need to configure anything.

> Other than that, how can I cache Metafun images so that they are not
> recomputed on every processing of file.

There used to a command for caching metafun images in MkII, but I don't know if 
that is really needed in LMTX. In most cases, metapost processing does not have 
a significant processing delay. 

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

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: Why LuaMetaTex is so slow?

2024-01-18 Thread Hans Hagen

On 1/18/2024 7:56 PM, Shiv Shankar Dayal wrote:




In comparison to LaTeX with LuaHBTeX, ConTeXt with LuaMetaTeX is
lightning fast.

pdfTeX is 8bit, and Knuth’s plain TeX is very low level – for a fairer
comparison, try the TeXbook on LuaMetaTeX (I don’t know if “plain”
works
though).

I understand that why it is slow, but the problem is that the difference 
is too high.

My book has lots of math, so perhaps that is the reason.

You can run the texbook with \tracingall and see what actually happens.

The texbook uses plain tex (very lightweight) with a dedicated style 
(also lightweight). On the contrary context uses layers of abstraction, 
a more complex font, math, structure, page etc etc etc sytstem.


In fact, plain tex had to be as it is because otherwise it would take 
ages to process teh texbook. On a pc one could see the page numbers 
crawl so in the end wr're quite okay nowadays.


If you run context with \tracingall you'll see that more goes on.

For me 40 pps sounds not that bad. If you use only text you can get to 
500 pps but that's not realistic. Maybe your style is suboptimal.


Also, open type fonts, opentype math, unicode, color, etc etc comes at a 
price. And, compared to pdftex, in most cases luametatex is faster on 
documents of average complexity. If you also use xml and/or metapost you 
migh tbe dragged down to a few pages per second while lmtx doesn't 
suffer much.


Anyway, if you think it can be made faster you can always post code to 
this list that identifies bottlenecks.


Of course we'll never be as fast as (pure) plain tex (no layers added) 
or latex (which often is advocated as faster than context).


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 / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] OT: special ToC

2024-01-15 Thread Henning Hraban Ramm


I came across a table of contents style that’s hardly possible with TeX:

https://historians.social/@dbellingradt/111760591144801241
(image is too big for the ML)


(Yes of course you can do it with manual references and MetaPost lines…)


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

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: Do we have a geometry library for Metafun?

2024-01-13 Thread Shiv Shankar Dayal
Can we please add
https://github.com/jemmybutton/byrne-euclid/blob/master/byrne.mp to Wiki
because files have a tendency to disappear?
Similarly, can we please add
https://github.com/thruston/Drawing-with-Metapost/blob/main/Drawing-with-Metapost.pdf
file to Wiki?
-- 
Respect,
Shiv Shankar Dayal
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: Do we have a geometry library for Metafun?

2024-01-13 Thread Shiv Shankar Dayal
The fiziko library by the same author is also very interesting:
> https://github.com/jemmybutton/fiziko
> Since it has some pseudo-3D features, maybe you can learn from it.
>

Thanks for all this info. I will look into this and perhaps come up with a
Metapost file, and then we can possibly add that in Wiki.
I do not know Lua, and I am too old to learn another programming language.
These days, I program only in Rust/Javascript.

-- 
Respect,
Shiv Shankar Dayal
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: Do we have a geometry library for Metafun?

2024-01-13 Thread Henning Hraban Ramm

Am 13.01.24 um 15:54 schrieb Gavin via ntg-context:

One pretty MetaPost drawing option is the byrne package by Sergey Slyusarev, 
which he used (with ConTeXt) to reproduce Oliver Byrne’s 1847 quirky edition on 
the first six books of Euclid’s “Elements”. All of the drawing is in MetaPost, 
and would work with MetaFun (I think). The LaTeX package is in TeX Live, and 
the ConTeXt version is at https://github.com/jemmybutton/byrne-euclid/.


The fiziko library by the same author is also very interesting:
https://github.com/jemmybutton/fiziko
Since it has some pseudo-3D features, maybe you can learn from it.

Hraban

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

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: Do we have a geometry library for Metafun?

2024-01-13 Thread Gavin via ntg-context
Hi Shiv,

The author of tikz-euclide has another package, tikz-elements, which looks like 
it could be used to do all of these calculations for MetaFun.

The tikz-elements package, in spite of its name, appears to contain exactly one 
line of TikZ code. This line is in the very simple style file, 
tkz-elements.sty. Everything else is written in Lua. I think we could write a 
simple ConTeXt environment file that would replace tkz-elements.sty, making all 
of the tikz-elements package available for MetaFun rather than TikZ.

This would not give you the pretty drawing features of tikz-euclide, since 
those features really are written in TikZ. I do not know of a MetaPost package 
that does the same thing, but there might be one.

One pretty MetaPost drawing option is the byrne package by Sergey Slyusarev, 
which he used (with ConTeXt) to reproduce Oliver Byrne’s 1847 quirky edition on 
the first six books of Euclid’s “Elements”. All of the drawing is in MetaPost, 
and would work with MetaFun (I think). The LaTeX package is in TeX Live, and 
the ConTeXt version is at https://github.com/jemmybutton/byrne-euclid/.

Gavin


> On Jan 12, 2024, at 6:27 PM, Shiv Shankar Dayal  
> wrote:
> 
> 
> No library that I know of, but drawing tangents (and therefore, 
> perpendiculars) is straight-forward:
> 
>https://tex.stackexchange.com/a/108060/323
> 
> Circumcircle, orthocenter, etc... are you thinking of triangles or general 
> polynomails?
> 
> Triangles. I understand that most of it is very easy, but still a library 
> will help new users.
> Tikz has Tikz-Euclide and Asymptote has a Geometry package. A similar library 
> for Metafun
> will be very useful.
>  -- 
> Respect,
> Shiv Shankar Dayal
> ___
> If your question is of interest to others as well, please add an entry to the 
> Wiki!
> 
> maillist : ntg-context@ntg.nl / 
> https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
> webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
> archive  : https://github.com/contextgarden/context
> wiki : https://wiki.contextgarden.net
> ___

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

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: Do we have a geometry library for Metafun?

2024-01-12 Thread Shiv Shankar Dayal
Dear Gavin,

I have managed to create an implementation for these operations which I
think I can convert into functions and put in startMPinclusions and then
use them from. there.

On Fri, Jan 12, 2024 at 9:42 PM Gavin via ntg-context 
wrote:

> Hi Shiv,
>
> > Do we have a geometry library for common operations like finding
> tangents, perpendiculars, circumcircle, orthocenters and such?
>
> I don’t think we have anything like that specifically in the MetaFun
> world, but if there is a MetaPost package you like, you can use it with
> MetaFun. For example, the TeX Live installation includes both ConTeXt and
> 3dgeom.mp, so you should be able to use the 3dgeom package in MetaFun
> simply with "input 3dgeom" in your MetaPost code. (I did a quick check,
> successfully drawing a drawing a cube with 3dgeom. I have not tested it
> beyond than that.)
>
> If there isn’t a MetaPost package for what you want, Lua may be useful for
> doing the calculations.
>
> Gavin
>
> ___
> If your question is of interest to others as well, please add an entry to
> the Wiki!
>
> maillist : ntg-context@ntg.nl /
> https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
> webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
> archive  : https://github.com/contextgarden/context
> wiki : https://wiki.contextgarden.net
>
> ___
>


-- 
Respect,
Shiv Shankar Dayal
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: Do we have a geometry library for Metafun?

2024-01-12 Thread Gavin via ntg-context
Hi Shiv,

> Do we have a geometry library for common operations like finding tangents, 
> perpendiculars, circumcircle, orthocenters and such?

I don’t think we have anything like that specifically in the MetaFun world, but 
if there is a MetaPost package you like, you can use it with MetaFun. For 
example, the TeX Live installation includes both ConTeXt and 3dgeom.mp, so you 
should be able to use the 3dgeom package in MetaFun simply with "input 3dgeom" 
in your MetaPost code. (I did a quick check, successfully drawing a drawing a 
cube with 3dgeom. I have not tested it beyond than that.)

If there isn’t a MetaPost package for what you want, Lua may be useful for 
doing the calculations.

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

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: LMTX schema for poster

2024-01-11 Thread Henning Hraban Ramm

Am 11.01.24 um 22:04 schrieb Bruce Horrocks:


1. "ConTeXt" should be the biggest word - or as an obvious title for the 
poster, away from the actual drawing.


This will be only a part of the poster. I imagine a 3x3 grid with a 
title above and some information (website etc.) below.

The 9 elements of the grid will be
- such a diagram that explains the building blocks / general workflow
– the diagram of the layout areas
– the project structure (environment, product, component)
– some examples of code and results
I wanted to use the “christmas card” squares for borders around and 
inbetween.



2. Don't add the "MkXL" bit - it's a distracting detail that no one needs to know at this 
stage. Also it looks like "Mk 40" in Roman numerals, or extra large.


ok. But “extra large” is intentional, I guess.


3. I though Hans had stopped using the TeX style capitalisation now i.e. just 
"Context"?


Hans uses different versions.
We use “context group”, but I keep ConTeXt; esp. in the context of LaTeX 
(DANTE booth!), I’d like to stress that it’s still TeX.



4. It's not clear whether the intersecting boxes are simply decorative or meant 
to present some sort of logical structure. I'm happy for it to be decorative, 
in which case fewer labels might be better.


ConTeXt “wraps” the LuaMetaTeX binary, since it handles the input as 
well as the output. I wasn’t sure how to show what controls what.



5. Similar to the box structure comment is that it's not clear which words I 
should be looking at. Ask yourself: what word(s) do I want the viewer to 
remember when they walk away?

6. Consider swapping the TeX and MetaPost circles so that Lua, MetaPost and TeX are read 
left to right as they appear in the acronym LMTX. Perhaps invert the "triangle" 
so that there are two circles at the top.


My first idea was to show that TeX and MP are under Lua control, but 
Hans disagreed. So while the 3 subsystems interact, I wanted to keep TeX 
on top.



7. It doesn't really tell the viewer that Context is a typesetting system - it 
looks like it is a system for producing XMLs and PDFs. (Which is what it is 
but... much more)


I’ll show some typography on the poster, and there will be books around.


8. Don't forget space for a URL and/or a QR code to the Contextgarden website.


See above.


Sorry if the above sounds harsh - not meant to be - just brain storming.


No problem, thank you!


I have a suggestion though. Use the Christmas card code / memory game code to 
produce patterns to use as the dots in the QR code? If the QR is large enough 
for people to distinguish the individual dots then it would provide a talking 
point? Or maybe have a copy of the card game to hand and challenge them to find 
a randomly drawn card in the QR code?


I don’t think I understand your intention. I wouldn’t construct a QR 
code out of other stuff, it would become too big.


Hraban

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

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: LMTX schema for poster

2024-01-11 Thread Bruce Horrocks


> On 11 Jan 2024, at 19:15, vm via ntg-context  wrote:
> 
> 
> 
> On 11/01/2024 19:52, Henning Hraban Ramm wrote:
>> Here’s a preliminary schema of LMTX. What do you think?
> 
> as is, it is difficult to understand where to look.
> what does is describe?
> 
> e.g. what is the distinction between the 'source' (lua tex) and the 
> 'resources' (fonts icc lib) and the 'frontend' (tex xml png ...mp)
> (no lua?)

Agreed.

In no particular order:

1. "ConTeXt" should be the biggest word - or as an obvious title for the 
poster, away from the actual drawing.

2. Don't add the "MkXL" bit - it's a distracting detail that no one needs to 
know at this stage. Also it looks like "Mk 40" in Roman numerals, or extra 
large.

3. I though Hans had stopped using the TeX style capitalisation now i.e. just 
"Context"?

4. It's not clear whether the intersecting boxes are simply decorative or meant 
to present some sort of logical structure. I'm happy for it to be decorative, 
in which case fewer labels might be better.

5. Similar to the box structure comment is that it's not clear which words I 
should be looking at. Ask yourself: what word(s) do I want the viewer to 
remember when they walk away?

6. Consider swapping the TeX and MetaPost circles so that Lua, MetaPost and TeX 
are read left to right as they appear in the acronym LMTX. Perhaps invert the 
"triangle" so that there are two circles at the top.

7. It doesn't really tell the viewer that Context is a typesetting system - it 
looks like it is a system for producing XMLs and PDFs. (Which is what it is 
but... much more)

8. Don't forget space for a URL and/or a QR code to the Contextgarden website.

Sorry if the above sounds harsh - not meant to be - just brain storming.

I have a suggestion though. Use the Christmas card code / memory game code to 
produce patterns to use as the dots in the QR code? If the QR is large enough 
for people to distinguish the individual dots then it would provide a talking 
point? Or maybe have a copy of the card game to hand and challenge them to find 
a randomly drawn card in the QR code?

—
Bruce Horrocks
Hampshire, UK

—
Bruce Horrocks
Hampshire, UK

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

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: LMTX schema for poster

2024-01-11 Thread Henning Hraban Ramm

Here’s a preliminary schema of LMTX. What do you think?

Is there something important missing?
Maybe add mtxrun, hyphenation patterns, modules. Move the images to the 
resources?
Maybe I should replace the “files” within MkXL with the parts like 
parser, par builder and whatever?

I don’t want to complicate it needlessly.

I’ll redraw it in MetaPost (with proper typography) if I’m sure enough.

Hraban

LMTX-Schema.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 / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: Metapost docs

2024-01-11 Thread Hans Hagen

On 1/11/2024 4:54 PM, Shiv Shankar Dayal wrote:

Dear Gavin,

I am aware of these resources. My question is about docs of those 
Metapost libs which are in the distribution in Metapost directory.
If something is not in the metafun, luametafun or another manual, then 
you should not use it as it's likely some low level helper then.


Hans


-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
   tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-

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

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: Metapost docs

2024-01-11 Thread Shiv Shankar Dayal
Dear Gavin,

I am aware of these resources. My question is about docs of those Metapost
libs which are in the distribution in Metapost directory.

On Thu, Jan 11, 2024 at 9:12 PM Gavin via ntg-context 
wrote:

> Hi Shiv,
>
> I am working with MetaPost in ConTeXt. Here are the resources I use,
> roughly in the order I search when trying to solve a problem.
>
> - MetaFun Manual (http://www.pragma-ade.nl/general/manuals/metafun-p.pdf)
> This is most comprehensive and helpful source.
> - MetaPost Manual (http://mirrors.ctan.org/systems/doc/metapost/mpman.pdf)
> This is not specific to ConTeXt, but it is very useful.
> - The MetaFun page on the ConTeXt wiki (
> https://wiki.contextgarden.net/MetaFun_-_MetaPost_in_ConTeXt) Other pages
> in the wiki’s graphics area are also helpful. (
> https://wiki.contextgarden.net/Graphics) Searching the wiki for specific
> documentation on things like chemical structures is a little hit-or-miss,
> but often quite useful.
> -The mailing list. I have the most luck with very specific questions that
> include a minimal working example. It should include the appropriate
> \starttext…\stoptext or \startMPpage…\stopMPpage, so that it can be typeset
> as-is.
>
> If you want to do 3D, you may want to get Lua involved for calculations. I
> use
>
> - Programming in LuaTeX page on the wiki (
> https://wiki.contextgarden.net/Programming_in_LuaTeX)
> - Programming in Lua, 4th ed.
> by Roberto Ierusalimschy (https://www.amazon.com/gp/product/8590379868)
>
> If you provide an example of what you hope to accomplish with MetaPost, we
> might have more specific recommendations. Below are two graphs that I made
> in TikZ, which I hope to convert to MetaPost (actually LMTX). These are
> from my chapter on elliptical orbits.
>
> I hope that helps you get started.
>
> Gavin
>
>
> ___
> If your question is of interest to others as well, please add an entry to
> the Wiki!
>
> maillist : ntg-context@ntg.nl /
> https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
> webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
> archive  : https://github.com/contextgarden/context
> wiki : https://wiki.contextgarden.net
>
> ___
>


-- 
Respect,
Shiv Shankar Dayal
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: Metapost docs

2024-01-11 Thread Gavin via ntg-context
Hi Shiv,

I am working with MetaPost in ConTeXt. Here are the resources I use, roughly in 
the order I search when trying to solve a problem.

- MetaFun Manual (http://www.pragma-ade.nl/general/manuals/metafun-p.pdf) This 
is most comprehensive and helpful source.
- MetaPost Manual (http://mirrors.ctan.org/systems/doc/metapost/mpman.pdf) This 
is not specific to ConTeXt, but it is very useful.
- The MetaFun page on the ConTeXt wiki 
(https://wiki.contextgarden.net/MetaFun_-_MetaPost_in_ConTeXt) Other pages in 
the wiki’s graphics area are also helpful. 
(https://wiki.contextgarden.net/Graphics) Searching the wiki for specific 
documentation on things like chemical structures is a little hit-or-miss, but 
often quite useful.
-The mailing list. I have the most luck with very specific questions that 
include a minimal working example. It should include the appropriate 
\starttext…\stoptext or \startMPpage…\stopMPpage, so that it can be typeset 
as-is.

If you want to do 3D, you may want to get Lua involved for calculations. I use

- Programming in LuaTeX page on the wiki 
(https://wiki.contextgarden.net/Programming_in_LuaTeX)
- Programming in Lua, 4th ed. 
by Roberto Ierusalimschy (https://www.amazon.com/gp/product/8590379868)

If you provide an example of what you hope to accomplish with MetaPost, we 
might have more specific recommendations. Below are two graphs that I made in 
TikZ, which I hope to convert to MetaPost (actually LMTX). These are from my 
chapter on elliptical orbits.

I hope that helps you get started.

Gavin



chapter07-t-b-8c929184fdcc9da93d1ffe5262fc9842.pdf
Description: Adobe PDF document


chapter07-t-b-613fffa20a4b3581222e7b521bef3ace.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 / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: Metapost docs

2024-01-10 Thread shivshankar . dayal
I have files in my installation like 'mp-form.mkiv, mp-chem.mkiv' and so on.

-- Respect,
Shiv Shankar Dayal
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: Status of Asymptote

2024-01-10 Thread shivshankar . dayal
Thanks for all the help. I have decided to use Metapost as it is tightly 
integrated with Asymptote and I find it fun.

-- Respect,
Shiv Shankar Dayal
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: Chemnitz, Leipzig, Call for Poster

2024-01-10 Thread Henning Hraban Ramm

Am 10.01.24 um 08:00 schrieb juh via ntg-context:

Am Sun, Jan 07, 2024 at 09:59:14AM +0100 schrieb Henning Hraban Ramm:

I’d like to have a poster that shows off ConTeXt/MetaFun features.
Do you have suggestions or (even better) would you like to create it?
It would be nice to have for further events (last year I presented ConTeXt
at FrOSCon and CCCamp and lacked a poster).


I just submitted a talk about how we use Markdown, Pandoc and ConTeXt at
Hostsharing eG, so maybe we'll meet in Chemnitz.


Great! Then I can leave out this workflow and refer to your talk.


A poster would be nice. ConTeXt/MetaFun are overwhelmingly flexible and 
powerful. It is hard to come up with a good idea. Who is targeted?


At an open source fair or hacker meeting, the target groups seem to be
– IT people who use TeX to create PDFs of software documentation
– students/academics who use TeX for scientific work
– people who look for open source solutions to all kind of tasks (e.g. 
at FrOSCon I had a long conversation about creating genealogy trees, 
since GRAMPS’ are ugly)


There are also authors/selfpublishers/micropublishers, but these I meet 
at book fairs, not at open source conferences. For people who don’t know 
they might be happy with a “programming system” we’d need a different 
poster. (The LaTeX-based SPBuchsatz targets this clientele.)


I want to show a few interesting things that are possible with 
ConTeXt/MetaPost and a few basics how it works.


I guess I’ll use the “christmas card memory” patterns as a background 
(thanks, Hans!).


I tried to sketch the relationship of Lua/TeX/MetaPost in LuaMetaTeX and 
ConTeXt LMTX around it, with different inputs and PDF/XML output – don’t 
know yet how to make this easily understandable…



ConTeXt is interesting for people that want to

integrate a typesetting system in a publishing environment, because
ConTeXt does not stand in your way as LaTeX often do and has many
programming features (lua, xml ...) or

typeset very customized layouts.

These two target groups are very different. Integratable building blocks
for a complex publishing system or programmable layout machine – sorry, I am 
just
brainstorming, but I like the idea of a poster.


Well, I’m using ConTeXt to produce PDFs for very different books, 
magazines, invoices/letters, presentations, jam labels, t-shirt designs…


Not any more for interactive forms or shipping documents, because the 
projects have run out. And my online crossword puzzle generator (with 
ConTeXt and LaTeX output) doesn’t work anymore…


We know ConTeXt/MetaPost is used for stock reports (hi Ramkumar), 
calendars (hi Willi), more books and magazines, textbooks and other 
educational material (e.g. math4all), energy reports (French power 
plants and Hans’ heating), planning model railways & typesetting 
stitching patterns (hi Taco), art (e.g. Eçir Baff), …


In short: There aren’t only two groups, I guess.

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

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Lua and inject.path to make a disconnected MetaPost path?

2024-01-08 Thread Gavin via ntg-context
Hello LuaMetaFun Fans,

Can I use mp.inject.path in Lua to create a disconnected path in MetaPost?

This is for my module that draws globes. I currently do something like this for 
drawing the continents. (This MWE has two triangular continents.)

\startluacode
  continents = {}
  continents[1] = {{0,0}, {-1,-1}, {-1,0}, cycle = true }
  continents[2] = {{0,1}, {1,0}, {1,-1}, cycle = true }
  function mp.getglobepath(continentnum)
mp.inject.path(continents[continentnum])
  end
\stopluacode

\startMPpage
  path p[], q ;
  p1 = (lua.mp.getglobepath(1) scaled 1cm) ;
  p2 = (lua.mp.getglobepath(2) scaled 1cm) ;
  q = p1 && p2 && cycle ;
  draw p1 withpen pencircle scaled 2pt withcolor .7 ;
  draw p2 withpen pencircle scaled 2pt withcolor .7 ;
  fill q withcolor 0.9 ;
  draw q withcolor red ;
\stopMPpage

The path q has both of the continents, disconnected.

I’d like to produce the two continents in Lua and pass them to MetaPost as a 
single disconnected path, using something like this: 

\startluacode
  continents = {
{0,0}, {-1,-1}, {-1,0}, — Change this to make a disconnected path!
{0,1}, {1,0}, {1,-1},
cycle = true }
  function mp.getglobepath()
mp.inject.path(continents)
  end
\stopluacode

\startMPpage
  path p ;
  p = (lua.mp.getglobepath() scaled 1cm) ;
  fill p withcolor 0.9 ;
  draw p withcolor red ;
\stopMPpage

If I can make the path p disconnected, this would allow me to make exactly the 
path I want in Lua, before passing it to MetaPost, rather than passing lots of 
paths and connecting them in MetaPost with the mysterious (to me) && or &&&&.

Thanks!
Gavin


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

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: Metapost docs

2024-01-08 Thread Hans Hagen via ntg-context

On 1/8/2024 1:50 AM, Shiv Shankar Dayal wrote:
I see many libraries for Metapost in Context source. Where are these 
documented? I see Metafun manual as well, but I do not find all the 
included libraries described.


i'm not sure what you mean with library ... can you give an example?

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 / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Metapost docs

2024-01-07 Thread Shiv Shankar Dayal
I see many libraries for Metapost in Context source. Where are these
documented? I see Metafun manual as well, but I do not find all the
included libraries described.

-- 
Respect,
Shiv Shankar Dayal
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: Metapost: draw only subpath; changing thickness of line

2024-01-06 Thread Emanuel Han via ntg-context
Hi Taco,

thanks for your help. This works for me!
On Jan. 5 2024, at 2:13 pm, Taco Hoekwater  wrote:
> Hi,
>
> Here is 'a' way to draw the subpath, at least. I do not have time to come up 
> with a nice “thicker in the middle” solution.
> Best wishes,
> Taco
>
>
> \startMPcode
> numeric u; u=1cm;
> %equiangular spiral
> numeric a, k ;
> a = 2.3; %scaling factor
> k = 8.61722335;
> path S;
> S = right for t=1 upto 360: .. a ** (t/50.2) * dir (-k*t) endfor;
> draw S;
>
> z1 = 8 dir -14;
> path A; A = origin -- z1 scaled 0.7u ;% draw A;
> pair AEndPoint; AEndPoint = point 1 of A;
> pair gong[], times; numeric n; n = 0;
> numeric gongtimes[]; % new
> for i = 1 upto length(A):
> for j = 1 upto length(S):
> times := subpath (i-1,i) of A intersectiontimes subpath (j-1,j) of S;
> if xpart times > -1:
> gong[incr n] = 1[point xpart times of subpath (i-1,i) of A,
> point ypart times of subpath (j-1,j) of S];
> gongtimes[n] = j-1 + ypart times; % new
> fi
> endfor
> endfor
>
> % new
> path H; H = subpath(gongtimes[6],gongtimes[7]) of S;
> lH = length(H);
> for i = 1 upto 100:
> draw (subpath((i-1)/100*lH, i/100* lH) of H) withcolor red withpen (pencircle 
> scaled(abs(abs(i-50)-50)/10)) ;
> endfor;
>
> \stopMPcode
>
> > On 5 Jan 2024, at 09:56, Emanuel Han via ntg-context  
> > wrote:
> >
> > Hi all,
> >
> > I have this MWE. Now I want to draw only the subpath of S between gong6 and 
> > gong7 with a red line which is narrower at the two ends and thicker in the 
> > middle part. How to achieve this?
> >
> > Thanks!
> > Emanuel
> >
> > \setuppapersize[A4,landscape]
> >
> > \starttext
> >
> > \startMPcode
> > numeric u; u=1cm;
> > %equiangular spiral
> > numeric a, k ;
> > a = 2.3; %scaling factor
> > k = 8.61722335;
> > path S;
> > S = right for t=1 upto 360: .. a ** (t/50.2) * dir (-k*t) endfor;
> > draw S;
> >
> > z1 = 8 dir -14;
> > path A; A = origin -- z1 scaled 0.7u ; draw A;
> > pair AEndPoint; AEndPoint = point 1 of A;
> > pair gong[], times; numeric n; n = 0;
> > for i = 1 upto length(A):
> > for j = 1 upto length(S):
> > times := subpath (i-1,i) of A intersectiontimes subpath (j-1,j) of S;
> > if xpart times > -1:
> > gong[incr n] = 1/2[point xpart times of subpath (i-1,i) of A,
> > point ypart times of subpath (j-1,j) of S];
> > fi
> > endfor
> > endfor
> >
> > dotlabel.rt ("$gong6$", gong6);
> > dotlabel.rt ("$gong7$", gong7);
> >
> > %Now I want to draw only the subpath of S between gong6 and gong7 with a 
> > red line which is narrower at the two ends and thicker in the middle part
> >
> > \stopMPcode
> >
> > \stoptext
> > ___
> > If your question is of interest to others as well, please add an entry to 
> > the Wiki!
> >
> > maillist : ntg-context@ntg.nl / 
> > https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
> > webpage : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
> > archive : https://github.com/contextgarden/context
> > wiki : https://wiki.contextgarden.net
> > ___
>
> —
> Taco Hoekwater E: t...@bittext.nl
> genderfluid (all pronouns)
>

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

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: multipage metapost output from ConTeXt

2024-01-06 Thread Emanuel Han via ntg-context
023 at 12:58 PM fv leung  wrote:
> > >
> > > You didn't specify the color of path A in p2 and p4. So it's drawn in 
> > > black.
> > > The other issue, I can't help.
> > >
> > > Emanuel Han via ntg-context  於 2023年12月2日 週六 下午7:23寫道:
> > >>
> > >> So is there a way to circumvent these issues? Or an explanation for this 
> > >> behavior, so that I can try to find a solution by myself?
> > >>
> > >> Thanks
> > >> Emanuel
> > >>
> > >> On Nov. 29 2023, at 12:25 pm, Emanuel Han via ntg-context 
> > >>  wrote:
> > >>
> > >> Dear Aditya and Fabrice,
> > >> thanks for your responses.
> > >>
> > >> I included some of Fabrice's code into mine for testing purpose, and 
> > >> indeed the multipage works now.
> > >> What is bizarre is that issues appear now that didn't appear before:
> > >>
> > >> Path A is drawn with color red on page 1, and in color black on all 
> > >> following pages, while it should stay red.
> > >> textext(, ) is overwriting  with 
> > >> "T="(currentime) which has been used previously in textext() 
> > >> before the for k=1 endfor loop. This overwriting happens only for the 
> > >> first textext() which occurs inside the for k=1 endfor loop. All other 
> > >> textext() inside the for k=1 endfor loop are not drawn at all. If the 
> > >> line « draw textext("T="(currentime)) scaled 2 shifted(0,2in) 
> > >> withcolor magenta ; » is commented out, the first textext() inside the 
> > >> for k=1 endfor loop is not drawn neither. It must be an issue with 
> > >> textext(), because when I replace textext() by lmt_outline[], the text 
> > >> is drawn.
> > >>
> > >> Adjusted mwe:
> > >>
> > >> \enableregime[utf] % enable unicoded input
> > >>
> > >> \definefontfamily [RomanFont] [rm] [calluna]
> > >>
> > >> \definefontfamily [KoreanFont] [rm] [applemyungjo]
> > >>
> > >> \definefontfamily [JapaneseFont] [rm] [hannotatesc]
> > >>
> > >> \definefontfeature
> > >> [fea]
> > >> [mode=node,language=dflt,script=arab,
> > >> init=yes,
> > >> medi=yes,
> > >> fina=yes,
> > >> isol=yes,
> > >> calt=yes,
> > >> rlig=yes,
> > >> tlig=yes,
> > >> trep=yes,
> > >> curs=yes,
> > >> kern=yes,
> > >> mark=yes
> > >> ]
> > >>
> > >> \starttypescript [serif] [notonaskharabic]
> > >> \definefontsynonym [notonaskharabic-Light] [name:notonaskharabic] 
> > >> [features=fea]
> > >> \definefontsynonym [notonaskharabic-Bold] [name:notonaskharabic] 
> > >> [features=fea]
> > >> \definefontsynonym [notonaskharabic-Italic] [name:notonaskharabic] 
> > >> [features=fea]
> > >> \definefontsynonym [notonaskharabic-Bold-Italic] [name:notonaskharabic] 
> > >> [features=fea]
> > >> \stoptypescript
> > >>
> > >> \starttypescript [serif] [notonaskharabic]
> > >> \usetypescript[serif][fallback]
> > >> \definefontsynonym [Serif] [notonaskharabic-Light] [features=fea]
> > >> \definefontsynonym [SerifItalic] [notonaskharabic-Italic] [features=fea]
> > >> \definefontsynonym [SerifBold] [notonaskharabic-Bold] [features=fea]
> > >> \definefontsynonym [SerifBoldItalic] [notonaskharabic-Bold-Italic] 
> > >> [features=fea]
> > >> \stoptypescript
> > >>
> > >> \starttypescript [notonaskharabic]
> > >> \definetypeface [notonaskharabic] [rm] [serif] [notonaskharabic] 
> > >> [default]
> > >> \stoptypescript
> > >>
> > >> \usetypescript[notonaskharabic]
> > >>
> > >> \setupbodyfont [RomanFont]
> > >>
> > >> \usecolors[crayola]
> > >>
> > >> \startMPinclusions
> > >>
> > >> picture p[];
> > >> path TheFrame ;
> > >> TheFrame := fullsquare scaled 5in ;
> > >>
> > >> z0 = (0,0);
> > >> z1 = (60,40);
> > >> z2 = (40,90);
> > >> z3 = (10,70);
> > >> z4 = (30,50);
> > >> z5 = (90,70);
> > >> z6 = (-10,70);
> > >>
> > >> path A; A = z0..z1..z2..z3..z4 ;
> > >> pair AStartPoint; AStartPoi

[NTG-context] Re: Metapost: draw only subpath; changing thickness of line

2024-01-05 Thread Taco Hoekwater
Hi,

Here is 'a' way to draw the subpath, at least. I do not have time to come up 
with a nice “thicker in the middle” solution.

Best wishes,
Taco


\startMPcode
numeric u; u=1cm;
%equiangular spiral
numeric a, k ;
a = 2.3; %scaling factor
k = 8.61722335;
path S;
S = right for t=1 upto 360: .. a ** (t/50.2) * dir (-k*t) endfor;
draw S;

z1 = 8 dir -14;
path A; A = origin -- z1 scaled 0.7u ;%  draw A;
pair AEndPoint; AEndPoint = point 1 of A;
pair gong[], times; numeric n; n = 0;
numeric gongtimes[]; % new
for i = 1 upto length(A):
 for j = 1 upto length(S):
   times := subpath (i-1,i) of A intersectiontimes subpath (j-1,j) of S;
   if xpart times > -1:
 gong[incr n] = 1[point xpart times of subpath (i-1,i) of A,
 point ypart times of subpath (j-1,j) of S];
 gongtimes[n] = j-1 + ypart times;  % new
  fi
 endfor
endfor

% new
path H; H = subpath(gongtimes[6],gongtimes[7]) of S;
lH = length(H);
for i = 1 upto 100:
draw (subpath((i-1)/100*lH, i/100* lH) of H) withcolor red  withpen 
(pencircle scaled(abs(abs(i-50)-50)/10)) ;
endfor;

\stopMPcode


> On 5 Jan 2024, at 09:56, Emanuel Han via ntg-context  
> wrote:
> 
> Hi all, 
> 
> I have this MWE. Now I want to draw only the subpath of S between gong6 and 
> gong7 with a red line which is narrower at the two ends and thicker in the 
> middle part. How to achieve this?
> 
> Thanks!
> Emanuel
> 
> \setuppapersize[A4,landscape]
> 
> \starttext
> 
> \startMPcode
> numeric u; u=1cm;
> %equiangular spiral
> numeric a, k ; 
> a = 2.3; %scaling factor
> k = 8.61722335; 
> path S; 
> S = right for t=1 upto 360: .. a ** (t/50.2) * dir (-k*t) endfor;
> draw S;
> 
> z1 = 8 dir -14;
> path A; A = origin -- z1 scaled 0.7u ; draw A;
> pair AEndPoint; AEndPoint = point 1 of A;
> pair gong[], times; numeric n; n = 0;
> for i = 1 upto length(A):
>  for j = 1 upto length(S):
>times := subpath (i-1,i) of A intersectiontimes subpath (j-1,j) of S;
>if xpart times > -1:
>  gong[incr n] = 1/2[point xpart times of subpath (i-1,i) of A,
>  point ypart times of subpath (j-1,j) of S];
>   fi 
>  endfor
> endfor
> 
> dotlabel.rt ("$gong6$", gong6);
> dotlabel.rt ("$gong7$", gong7);
> 
> %Now I want to draw only the subpath of S between gong6 and gong7 with a red 
> line which is narrower at the two ends and thicker in the middle part
> 
> \stopMPcode
> 
> \stoptext
> ___
> If your question is of interest to others as well, please add an entry to the 
> Wiki!
> 
> maillist : ntg-context@ntg.nl / 
> https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
> webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
> archive  : https://github.com/contextgarden/context
> wiki : https://wiki.contextgarden.net
> ___

— 
Taco Hoekwater  E: t...@bittext.nl
genderfluid (all pronouns)


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

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Metapost: draw only subpath; changing thickness of line

2024-01-05 Thread Emanuel Han via ntg-context
Hi all,

I have this MWE. Now I want to draw only the subpath of S between gong6 and 
gong7 with a red line which is narrower at the two ends and thicker in the 
middle part. How to achieve this?
Thanks!
Emanuel

\setuppapersize[A4,landscape]
\starttext
\startMPcode
numeric u; u=1cm;
%equiangular spiral
numeric a, k ;
a = 2.3; %scaling factor
k = 8.61722335;
path S;
S = right for t=1 upto 360: .. a ** (t/50.2) * dir (-k*t) endfor;
draw S;

z1 = 8 dir -14;
path A; A = origin -- z1 scaled 0.7u ; draw A;
pair AEndPoint; AEndPoint = point 1 of A;
pair gong[], times; numeric n; n = 0;
for i = 1 upto length(A):
for j = 1 upto length(S):
times := subpath (i-1,i) of A intersectiontimes subpath (j-1,j) of S;
if xpart times > -1:
gong[incr n] = 1/2[point xpart times of subpath (i-1,i) of A,
point ypart times of subpath (j-1,j) of S];
fi
endfor
endfor

dotlabel.rt ("$gong6$", gong6);
dotlabel.rt ("$gong7$", gong7);

%Now I want to draw only the subpath of S between gong6 and gong7 with a red 
line which is narrower at the two ends and thicker in the middle part
\stopMPcode
\stoptext___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: Status of Asymptote

2024-01-03 Thread Jeroen
Below is how I have used Asymptote in the past with the Context filter 
module:


download portable ghostsctipt
create dir c:\context\ghostscript and install from 
https://portableapps.com/apps/utilities/ghostscript_portable


download non-portable asymptote
create dir c:\context\asymptote and install from 
http://asymptote.sourceforge.net/


create file c:\context\asy.bat with context
ASYMPTOTE_GS=C:context/ghostscript/bin/gswin64.exe
C:/context/asymptote/asy.exe %*

test with:

\usemodule[filter]

\defineexternalfilter[ASY]
   [filter={/context/asy.bat -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
   size(10cm);
   import graph;
   real f(real x) {return sin(x);}
   draw(graph(f,-3,3,300),blue);
 \stopASY
   \stopplacefigure
\stoptext


OR alternatively:


\usemodule[filter]

\defineexternalfilter[ASY]
   [filter={/context/asy.bat -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
   unitsize(1cm);
   draw((-.1,0) -- (2,0), arrow=Arrow(TeXHead));
   draw((0,-.1) -- (0,2), arrow=Arrow(TeXHead));
   draw((0,0) .. (1,1) .. (2,sqrt(2)));
 \stopASY
   \stopplacefigure
\stoptext

Op 31/12/2023 om 00:33 schreef Aditya Mahajan:

On Sun, 31 Dec 2023, Shiv Shankar Dayal wrote:


It would be nice to either support Metapost 3D or Asymptote. Right now I
generate images separately and embed them in PDF using externalfigure command 
which works but I have to maintain all the graphics separately.

It is possible to obtain simple integration for asymptote using the filter 
module:

   https://github.com/adityam/filter

Using that you could define an asymptote environment so that:

\startbuffer[asymptote-preamble]

\stopbuffer

\starttext

\startasymptote
% Asymptote figure
\stopasymptote

\stoptext

saves the content of the asymptote-preamble and the figure in a separate file, 
runs asymptote to generate a PDF figure and includes the figure. The results 
are cached so the asymptote is re-run only if the content of the figure 
environment changes.

A drawback of this approach is that the labels are generated by asymptote. That 
means that the font, colors, and any macros needed for the figures need to be 
redefined at both context and 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 / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___

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

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: 2024

2024-01-02 Thread Willi Egger
Wow Hans!

As Fabrice mentioned, this is really like kind of a language and messaging from 
an ancient time… The shapes are genius.

I believe playing this game with open cards is already a challenge to find the 
matching pairs. I just imagine how difficult it would be to play it as an old 
fashioned memory with the pictures covered… At least one would have to reduce 
the number of pairs significantly…

Great thing, thank you so much!

Willi



> On 1 Jan 2024, at 13:28, Hans Hagen  wrote:
> 
> Hi,
> 
> As a side effect (spin off) of this years xmas card we have a new years 
> gimmick:
> 
>   https://www.pragma-ade.nl/2023
> 
> Of course it screams metapost but tex and lua are also involved. See it as 
> compensation for the lack of an end-of-year update. The last page of the 
> result has a bit of explanation.
> 
> 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 / 
> https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
> webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
> archive  : https://github.com/contextgarden/context
> wiki : https://wiki.contextgarden.net
> ___

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

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: 2024

2024-01-02 Thread Fabrice L
Dear Hans,

> Le 2 janv. 2024 à 05:35, Hans Hagen via ntg-context  a 
> écrit :
> 
> On 1/1/2024 3:33 PM, vm via ntg-context wrote:
>> On 01/01/2024 13:28, Hans Hagen wrote:
>>> Of course it screams metapost but tex and lua are also involved. See it as 
>>> compensation for the lack of an end-of-year update. The last page of the 
>>> result has a bit of explanation.
>> Beautiful indeed !
>> (And thank you for all the good work)
>> Is the puzzle generator somewhere hidden to be found within the context 
>> module tree?
> It's not that much code but I need to add a keyword interface. It's also 
> something we might play with a little at this years meeting so ...
> 
> (I added a gray scale option for tyhose without color printer.)
> 
> Here's a big one (the xmas card):
> 
> http://www.pragma-ade.nl/ctx-group-2023.pdf
> 
> Hans

This is very beautiful, and inspiring ! 
Seems like a coded message from the past, or the future ! 
Fabrice. 

> 
> -
>  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 / 
> https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
> webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
> archive  : https://github.com/contextgarden/context
> wiki : https://wiki.contextgarden.net
> ___

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

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: 2024

2024-01-02 Thread Hans Hagen via ntg-context

On 1/1/2024 3:33 PM, vm via ntg-context wrote:



On 01/01/2024 13:28, Hans Hagen wrote:
Of course it screams metapost but tex and lua are also involved. See 
it as compensation for the lack of an end-of-year update. The last 
page of the result has a bit of explanation.


Beautiful indeed !
(And thank you for all the good work)
Is the puzzle generator somewhere hidden to be found within the context 
module tree?
It's not that much code but I need to add a keyword interface. It's also 
something we might play with a little at this years meeting so ...


(I added a gray scale option for tyhose without color printer.)

Here's a big one (the xmas card):

http://www.pragma-ade.nl/ctx-group-2023.pdf

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 / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: 2024

2024-01-01 Thread vm via ntg-context




On 01/01/2024 13:28, Hans Hagen wrote:
Of course it screams metapost but tex and lua are also involved. See it 
as compensation for the lack of an end-of-year update. The last page of 
the result has a bit of explanation.


Beautiful indeed !
(And thank you for all the good work)
Is the puzzle generator somewhere hidden to be found within the context 
module tree?


.Floris

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

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] 2024

2024-01-01 Thread Hans Hagen

Hi,

As a side effect (spin off) of this years xmas card we have a new years 
gimmick:


   https://www.pragma-ade.nl/2023

Of course it screams metapost but tex and lua are also involved. See it 
as compensation for the lack of an end-of-year update. The last page of 
the result has a bit of explanation.


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 / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: Status of Asymptote

2023-12-30 Thread Aditya Mahajan
On Sun, 31 Dec 2023, Shiv Shankar Dayal wrote:

> It would be nice to either support Metapost 3D or Asymptote. Right now I
> generate images separately and embed them in PDF using externalfigure command 
> which works but I have to maintain all the graphics separately.

It is possible to obtain simple integration for asymptote using the filter 
module:

  https://github.com/adityam/filter

Using that you could define an asymptote environment so that:

\startbuffer[asymptote-preamble]

\stopbuffer

\starttext

\startasymptote
% Asymptote figure
\stopasymptote

\stoptext

saves the content of the asymptote-preamble and the figure in a separate file, 
runs asymptote to generate a PDF figure and includes the figure. The results 
are cached so the asymptote is re-run only if the content of the figure 
environment changes. 

A drawback of this approach is that the labels are generated by asymptote. That 
means that the font, colors, and any macros needed for the figures need to be 
redefined at both context and 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 / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: Status of Asymptote

2023-12-30 Thread Hans Hagen

On 12/30/2023 8:04 PM, Shiv Shankar Dayal wrote:

Hi all,

It would be nice to either support Metapost 3D or Asymptote. Right now I 
generate images separately and embed them in PDF using externalfigure 
command which works but I have to maintain all the graphics separately.
next year we will pick up 3 (2.5, projections) in mp (either native or 
in macros) ... there will be no support for asymptote beyond what we 
have now


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 / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: Status of Asymptote

2023-12-30 Thread Alan Braslau via ntg-context

On 30/12/23 30/12/23, 12:04, Shiv Shankar Dayal wrote:


It would be nice to either support Metapost 3D


Very simple MP pseudo 3D is included in
tex/texmf-context/metapost/context/base/mpiv/mp-tres.mpiv

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

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: Status of Asymptote

2023-12-30 Thread Gavin via ntg-context
Hi Shiv and Fabrice,

> On Dec 30, 2023, Shiv Shankar Dayal wrote:
> It would be nice to either support Metapost 3D or Asymptote.

> On Dec 6, 2021, Fabrice L wrote:
> I would be very interested to see an example of a Metafun drawing made with 
> the help of LuaTeX to speed up some calculations.

I made a module that draws 3D globes with MetaPost and Lua. This was my first 
step toward drawing general projections. If anyone would like to join this 
project, I’d love some help. The globes module is only about 300 lines of code, 
and most of the challenge was hiding paths and parts of paths that are on the 
back side of the globe. Anybody could get up to speed pretty quickly. (I am 
completely new to both MetaPost and Lua, so I tried to be very clear in my 
coding.)

My goal is a drawing process which starts with Lua tables containing data in 
arbitrary coordinates. The data could be any number of dimensions, and need not 
be rectangular. (For the globes the data is latitude and longitude points on 
the countries' boundaries.) The tables could be from an outside source (like 
the geographic data) or it could be calculated in Lua (for graphing functions 
or doing simulations).

Lua does all of the calculations to project this data down to two dimensional, 
rectangular coordinates. Lua then passes these two dimensional points, or paths 
made from them, to MetaPost. MetaPost uses the points and paths to draw dots, 
curves and areas, to place labels, etc. The only transformation performed by 
MetaPost is the final scaling for drawing everything on the page.

You can find the globe module on GitHub:

https://github.com/GavinPolhemus/luageo

I am relatively new to Git as well, so have patience if you start commenting or 
contributing there. I’ll learn fastest if there are collaborators!

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

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: Status of Asymptote

2023-12-30 Thread Shiv Shankar Dayal

Hi all,

It would be nice to either support Metapost 3D or Asymptote. Right now I 
generate images separately and embed them in PDF using externalfigure 
command which works but I have to maintain all the graphics separately.


Respect,

Shiv

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

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: Seeking advice for module that draws globes

2023-12-17 Thread Hans Hagen via ntg-context

On 12/17/2023 11:22 PM, Gavin via ntg-context wrote:

Hello ConTeXters,

I wrote a little ConTeXt module for drawing globes. I would love some advice on 
how to improve it and share it. The code is quite short (about 250 lines). Most 
of the work is done by Lua, which reads the data files and calculates paths. 
These paths are passed to MetaFun, which draws the globe.


Just some quiks remarks ...

- you use the right strategy (tex/lua/mp)

- in mp you can do this

vardef theglobe(expr lat, lon) =
for i = 1 upto lua.mp.makeglobe(lat, lon):
(lua.mp.getglobepath(i)) &&&&
endfor
cycle
enddef ;

and then:

\startMPpage
GlobeDiameter = 10cm ;
fill fullcircle
scaled GlobeDiameter
withcolor .9white ;
path p ; p := theglobe(23, 0)
scaled .5GlobeDiameter
;
draw p
withpen pencircle scaled .2mm
withcolor blue
withtransparency (1,.5) ;
fill p
withcolor red
withtransparency (1,.5) ;
draw fullcircle
scaled GlobeDiameter
withcolor black ;
\stopMPpage

i use transparency to demo that a single path has advantages; you'll 
also notice that the runtime is actually at the mp end.


- in your lua code do this

local cosd = math.cosd
local sind = math.sind
local sqrt = math.sqrt

- also, use "MP.makeglobe" in the mp code and at the lua end function 
MP.makeglobe"" as that is the user namespace.


I'll mail you the lua file with some suggestions. When all is stable I 
can spend a few hours on optimizing if needed.



I am a novice at both Lua and MetaPost. I’m also new to Git and have never 
shared anything of substance with the ConTeXt community. (This barely counts as 
substantive, but I figure it’s best to start small.) I’m sure many of you could 
find opportunities for improvement with even a quick glance at the code. I 
welcome anything, from advice on performance to suggestions about the license. 
My most pressing questions are these:



1. How do I avoid redrawing diagrams with every typeset? The globe above takes 
about 0.7s, which is not bad, but it adds up in a book with many diagrams.


see previous mail


2. How do I organize this according to TDS for sharing? I know what TDS is and 
why it’s important, but that’s about it!

3. Should I be creating a namespace for this module, or launching a separate 
MetaFun instance? I have a general sense of what “namespace” and “instance” 
mean is this context, but I don’t know the consequences or the how-to.

I’d like to share this module, even though the potential demand is tiny, at 
best. I’m going through the Module Writing Guidelines 
(https://wiki.contextgarden.net/Modules#Module_writing_guidelines), but there 
is a lot that I don’t understand in those instructions. Questions 2 and 3 above 
relate to the instructions that are most mysterious to me. I think I can figure 
most of the others out.

I have been using ConTeXt for several years to write a high school physics 
textbook (along with the problem sets, tests, equations sheets, etc.). I wrote 
this module because I needed globes in some diagrams. I found an old MetaPost 
tool, mp-geo, that seemed to have the right ingredients, but I couldn’t get it 
to work, so I wrote my own tool using the data files from mp-geo. Hans and 
others on the list gave me valuable advice for these globes a couple years ago 
(and gave other valuable advice on all sorts of things before and since).

Many diagrams in my physics book use TikZ and pgfplots. I'd like to convert 
everything to MetaFun. I think the best way will be writing a few more modules 
for things like graphs (including polar and 3D plots), simple circuits, simple 
Feynman diagrams, etc. I’m hoping that these would be useful to the ConTeXt 
community. The luageo module has the basic design I’d like to use for the 
others: Lua for data handling and calculations, producing paths that are drawn 
by MetaFun. With some mentoring from the generous ConTeXt community, I’m hoping 
we can provide MetaFun alternatives to some of the TikZ libraries.


next year Mikael S and I are going to look into 3D (and projections) as 
we can only work on math when we have a parallel metafun pet project.



I have an alpha version of luagraph by Alan Braslau, which was helpful in 
designing luageo. Working on luagraph is my next project.

Gavin



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

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


--

-

[NTG-context] Seeking advice for module that draws globes

2023-12-17 Thread Gavin via ntg-context
Hello ConTeXters,

I wrote a little ConTeXt module for drawing globes. I would love some advice on 
how to improve it and share it. The code is quite short (about 250 lines). Most 
of the work is done by Lua, which reads the data files and calculates paths. 
These paths are passed to MetaFun, which draws the globe.

Below is an example document with the output. (I attached a small .png of the 
output for the mailing list. The output PDF has excessive detail.) The module 
(code and data) is on GitHub at https://github.com/GavinPolhemus/luageo.

\usemodule [luageo]
\startMPpage
GlobeDiameter = 10cm ;
fill fullcircle scaled GlobeDiameter withcolor .9white ;  % Fill a circle 
with the water color.
drawglobe(23, 0) scaled GlobeDiameter withcolor .75white ;% Draw the land, 
centered on the given latitude and longitude.
draw fullcircle scaled GlobeDiameter withcolor black ;% Add a border, 
if you want.
\stopMPpage



I am a novice at both Lua and MetaPost. I’m also new to Git and have never 
shared anything of substance with the ConTeXt community. (This barely counts as 
substantive, but I figure it’s best to start small.) I’m sure many of you could 
find opportunities for improvement with even a quick glance at the code. I 
welcome anything, from advice on performance to suggestions about the license. 
My most pressing questions are these:

1. How do I avoid redrawing diagrams with every typeset? The globe above takes 
about 0.7s, which is not bad, but it adds up in a book with many diagrams.

2. How do I organize this according to TDS for sharing? I know what TDS is and 
why it’s important, but that’s about it!

3. Should I be creating a namespace for this module, or launching a separate 
MetaFun instance? I have a general sense of what “namespace” and “instance” 
mean is this context, but I don’t know the consequences or the how-to.

I’d like to share this module, even though the potential demand is tiny, at 
best. I’m going through the Module Writing Guidelines 
(https://wiki.contextgarden.net/Modules#Module_writing_guidelines), but there 
is a lot that I don’t understand in those instructions. Questions 2 and 3 above 
relate to the instructions that are most mysterious to me. I think I can figure 
most of the others out.

I have been using ConTeXt for several years to write a high school physics 
textbook (along with the problem sets, tests, equations sheets, etc.). I wrote 
this module because I needed globes in some diagrams. I found an old MetaPost 
tool, mp-geo, that seemed to have the right ingredients, but I couldn’t get it 
to work, so I wrote my own tool using the data files from mp-geo. Hans and 
others on the list gave me valuable advice for these globes a couple years ago 
(and gave other valuable advice on all sorts of things before and since).

Many diagrams in my physics book use TikZ and pgfplots. I'd like to convert 
everything to MetaFun. I think the best way will be writing a few more modules 
for things like graphs (including polar and 3D plots), simple circuits, simple 
Feynman diagrams, etc. I’m hoping that these would be useful to the ConTeXt 
community. The luageo module has the basic design I’d like to use for the 
others: Lua for data handling and calculations, producing paths that are drawn 
by MetaFun. With some mentoring from the generous ConTeXt community, I’m hoping 
we can provide MetaFun alternatives to some of the TikZ libraries.

I have an alpha version of luagraph by Alan Braslau, which was helpful in 
designing luageo. Working on luagraph is my next project.

Gavin


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

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: About framedtext

2023-12-13 Thread Alan Braslau via ntg-context
On Wed, 13 Dec 2023 18:55:34 +0100
Wolfgang Schuster  wrote:

> This was added a few years ago (AFAIR to provide something similar to 
> the TikZ color command).

You actually mean similar to the MetaPost color command.

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

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: About framedtext

2023-12-13 Thread Henning Hraban Ramm

Am 13.12.23 um 18:19 schrieb Wolfgang Schuster:

Fabrice Couvreur schrieb am 13.12.2023 um 19:03:

Hi,
Is this a bug or not ?
The key to coloring the background of the text seems to no longer work.


There is a problem with the corner option, you can either hope it gets 
fixed in the next release
(corner=round still works) or create your own background as metapost 
graphic with rounded corners.


Oh, yes, here’s Hans’ fix.

Hraban
if not modules then modules = { } end modules ['lpdf-rul'] = {
version   = 1.001,
comment   = "companion to grph-rul.mkiv",
author= "Hans Hagen, PRAGMA-ADE, Hasselt NL",
copyright = "PRAGMA ADE / ConTeXt Development Team",
license   = "see context related readme files"
}

-- todo: split backend and pdf

local tonumber, tostring, next, type = tonumber, tostring, next, type
local concat, setmetatableindex = table.concat, table.setmetatableindex

local attributes   = attributes
local nodes= nodes

local bpfactor = number.dimenfactors.bp

local nuts = nodes.nuts
local ruleactions  = nuts.rules.ruleactions

local getwhd   = nuts.getwhd

local lefttoright_code = tex.directioncodes.lefttoright

local mpcolor  = attributes.colors.mpcolor

local trace_mp = false  trackers.register("rules.mp", function(v) 
trace_mp = v end)

local report_mp= logs.reporter("rules","mp")

local floor= math.floor
local getrandom= utilities.randomizer.get
local formatters   = string.formatters

local setdimen = tex.setdimen
local isdimen  = tex.isdimen
local setmacro = tokens.setters.macro

local codeinjections   = backends.registered.pdf.codeinjections

local d_rule_width  = isdimen("d_rule_width")
local d_rule_height = isdimen("d_rule_height")
local d_rule_depth  = isdimen("d_rule_depth")
local d_rule_h  = isdimen("d_rule_h")
local d_rule_v  = isdimen("d_rule_v")
local d_rule_line   = isdimen("d_rule_line")
local d_rule_offset = isdimen("d_rule_offset")
local d_rule_factor = isdimen("d_rule_factor")

-- This is very pdf specific. Maybe move some to lpdf-rul.lua some day.

local pdfprint ; pdfprint = function(...) pdfprint = lpdf.print return 
pdfprint(...) end

do

local simplemetapost = metapost.simple
local cachesize  = 0
local maxcachesize   = 256*1024
local cachethreshold = 1024
local caching= false -- otherwise random issues so we need a 
dedicated randomizer first

 -- local maxcachesize   = 8*1024
 -- local cachethreshold = 1024/2

local cache = setmetatableindex(function(t,k)
local v = simplemetapost("rulefun",k) -- w, h, d
cachesize = cachesize + #v
if cachesize > maxcachesize then
 -- print("old",cachesize)
for k, v in next, t do
local n = #v
if n > cachethreshold then
t[k] = nil
cachesize = cachesize - n
end
end
 -- print("new",cachesize)
end
 -- print(cachesize,maxcachesize,cachethreshold,#v)
t[k] = v
return v
end)

local replacer = utilities.templates.replacer

-- todo: RuleColor -> just string ?
-- todo: fetch them instead fo push them

-- local predefined = {
-- ["fake:word"] = replacer [[
-- FakeWord(%width%,%height%,%depth%,%line%,%color%);
-- ]],
-- ["fake:rule"] = replacer[[
-- %initializations%
-- FakeRule(%width%,%height%,%depth%,%line%,%color%);
-- ]],
-- ["fake:rest"] = replacer [[
-- RuleDirection := "%direction%" ;
-- RuleOption := "%option%" ;
-- RuleWidth := %width% ;
-- RuleHeight := %height% ;
-- RuleDepth := %depth% ;
-- RuleH := %h% ;
-- RuleV := %v% ;
-- RuleThickness := %line% ;
-- RuleFactor := %factor% ;
-- RuleOffset := %offset% ;
-- def RuleColor = %color% enddef ;
-- %data%;
-- ]]
-- }

local predefined = {
["fake:word"] = replacer [[
FakeWord(RuleWidth,RuleHeight,RuleDepth,RuleThickness,RuleColor);
]],
["fake:rule"] = replacer[[
%initializations%
FakeRule(RuleWidth,RuleHeight,RuleDepth,RuleThickness,RuleColor);
]],
["fake:rest"] = replacer [[
%data%;
]]
}

local initialized = false ;

local function rule_mp(p,h,v,i,n)
local name  = p.name or "fake:rest"
local ht= p.height or 0
local dp= p.depth  or 0
local total = ht + dp
local code  = (predefined[name] or predefined["fake:rest"]) {
data  = p.data or "",
  -- -- width = p.width * bpfactor,
  -- -- height= p.height * bpfactor,
  -- -

[NTG-context] Re: About framedtext

2023-12-13 Thread Wolfgang Schuster

Fabrice Couvreur schrieb am 13.12.2023 um 19:03:

Hi,
Is this a bug or not ?
The key to coloring the background of the text seems to no longer work.


There is a problem with the corner option, you can either hope it gets 
fixed in the next release
(corner=round still works) or create your own background as metapost 
graphic with rounded corners.


Wolfgang

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

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] framed: rounded corner oddity

2023-12-05 Thread Henning Hraban Ramm

Hi,

in my ConTeXt book, some examples for \framed with rounded corners look 
odd, as if the MetaPost calculation of rounded corners fails.


I can’t find a minimal example that shows the problem, and I can’t 
imagine which of the settings in my extensive environment would cause it.


Find below the code that works on its own, but causes the results as 
shown in the attachments within my book. There’s nowhere a \setupframed, 
and nothing that should influence MetaPost.


Do you have any clue for what I should look?

Hraban

\starttext

\framed[
  rulethickness=1pt,
  offset=0.5em,
  background=color,
  backgroundcolor=yellow,
  framecorner=13,
  backgroundcorner=07,
  backgroundoffset=0.5em,
]{Das Runde muss ins Eckige}

\blank

\framed[
  frame=on,
  corner=round,
  frameoffset=0.5em,
  framecolor=black,
  background=color,
  backgroundcolor=darkgreen,
  backgroundoffset=1em,
  foregroundcolor=white,
  foregroundstyle={\ss\bf},
]{Komm ins Grüne!}

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

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


  1   2   3   4   5   6   7   8   9   10   >