Re: [NTG-context] metafun paralleled does not give a parallel path

2022-08-25 Thread Hans Hagen via ntg-context

On 8/25/2022 6:05 PM, Bruce Horrocks via ntg-context wrote:

I'm seeing the line + arcs behaviour here.
fixed in upload (we had a bug in mplib .. direction is now a primitive 
so that one was wrong)


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://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : https://contextgarden.net
___


Re: [NTG-context] metafun paralleled does not give a parallel path

2022-08-25 Thread Bruce Horrocks via ntg-context
I'm seeing the line + arcs behaviour here.

ConTeXt  ver: 2022.08.05 11:44 LMTX  fmt: 2022.8.5  int: english/english


> On 25 Aug 2022, at 13:03, Fabrice L via ntg-context  
> wrote:
> 
> Hi,
> 
>> Le 24 août 2022 à 22:50, fv leung via ntg-context  a 
>> écrit :
>> 
>> The following used to produce three parallel lines.
>> Now it produces one straight line and two arcs.
>> 
>> \starttext
>> 
>> \startMPcode
>>   z0 = origin;
>>   z1 = 72dir(45);
>>   dotlabel.bot("z0", z0);
>>   draw z0--z1;
>>   draw (z0--z1) paralleled -15 withcolor red;
>>   draw (z0--z1) paralleled 15 withcolor blue;
>> \stopMPcode
>>   
>> \stoptext
> 
> Your code produce three perfect parallels lines here, see attached pdf. 
> F.
> 
> 

—
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://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : https://contextgarden.net
___


Re: [NTG-context] metafun paralleled does not give a parallel path

2022-08-25 Thread Fabrice L via ntg-context
Hi,Le 24 août 2022 à 22:50, fv leung via ntg-context  a écrit :The following used to produce three parallel lines.Now it produces one straight line and two arcs.\starttext\startMPcode  z0 = origin;  z1 = 72dir(45);  dotlabel.bot("z0", z0);  draw z0--z1;  draw (z0--z1) paralleled -15 withcolor red;  draw (z0--z1) paralleled 15 withcolor blue;\stopMPcode  \stoptextYour code produce three perfect parallels lines here, see attached pdf. F.

parralel.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://www.ntg.nl/mailman/listinfo/ntg-contextwebpage  : https://www.pragma-ade.nl / http://context.aanhet.netarchive  : https://bitbucket.org/phg/context-mirror/commits/wiki : https://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://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : https://contextgarden.net
___


Re: [NTG-context] Metafun hexagons aren't hexagons

2022-07-21 Thread Alan via ntg-context
On Thu, 21 Jul 2022 18:51:23 +0200
Hans Hagen via ntg-context  wrote:

> On 7/21/2022 5:56 AM, Alan via ntg-context wrote:
> > On Wed, 20 Jul 2022 15:26:53 -0600
> > Max Chernoff via ntg-context  wrote:
> > 
> >> The recently added Metafun hexagons seem to be producing octagons
> >> instead:
> >>
> >> \startMPpage
> >> fill fullhexagon scaled 100;
> >> draw unithexagon scaled 50 withcolor white;
> >> \stopMPpage
> > 
> > Of course, for an MP circle is defined by 8 points.
> > 
> > draw textext(decimal length unitcircle) ;
> i'll change it to octagon (was only used for some envelope tracing 
> experiment)

\startMPcode
fullhexagon := for i=0 upto 5 : .5dir(60i) -- endfor cycle ;
unithexagon := fullhexagon shifted (.5,.5) ;

draw fullhexagon scaled 1cm ;
draw unithexagon scaled 1cm withcolor red ;
draw unitcircle  scaled 1cm withcolor red ;
draw fullcircle  scaled 1cm ;
\stopMPcode
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : https://contextgarden.net
___


Re: [NTG-context] Metafun hexagons aren't hexagons

2022-07-21 Thread Hans Hagen via ntg-context

On 7/21/2022 5:56 AM, Alan via ntg-context wrote:

On Wed, 20 Jul 2022 15:26:53 -0600
Max Chernoff via ntg-context  wrote:


The recently added Metafun hexagons seem to be producing octagons
instead:

\startMPpage
fill fullhexagon scaled 100;
draw unithexagon scaled 50 withcolor white;
\stopMPpage


Of course, for an MP circle is defined by 8 points.

draw textext(decimal length unitcircle) ;
i'll change it to octagon (was only used for some envelope tracing 
experiment)



-
  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://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : https://contextgarden.net
___


Re: [NTG-context] Metafun hexagons aren't hexagons

2022-07-20 Thread Alan via ntg-context
On Wed, 20 Jul 2022 15:26:53 -0600
Max Chernoff via ntg-context  wrote:

> The recently added Metafun hexagons seem to be producing octagons
> instead:
> 
>\startMPpage
>fill fullhexagon scaled 100;
>draw unithexagon scaled 50 withcolor white;
>\stopMPpage

Of course, for an MP circle is defined by 8 points.

draw textext(decimal length unitcircle) ;

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

maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : https://contextgarden.net
___


Re: [NTG-context] Metafun : save memory content ?

2022-07-19 Thread Fabrice L via ntg-context
Dear Bruce, dear list, 

> Le 19 juill. 2022 à 07:42, Bruce Horrocks  a écrit :
> 
>> On 19 Jul 2022, at 04:28, Fabrice L via ntg-context  
>> wrote:
>> 
>> Complementary question : I saw that the « pos_a » « pos_b » of the example 
>> could not take numerical value, for example pos_1, pos_2.. How can I use 
>> metafun to write a macro to save the contents of hundreds of variable in 
>> this object, something like :
>> 
>> getparameters "MyData » [
>>  for i=1 upto 100 :
>>  pos_decimal(i) = ThePosition[i],
>>  endfor ;
>> ] ;
>> 
>> If this is possible, then this is wonderful and open news doors ! 
> 
> I've adapted this example from the metafun-p manual by adding some "write" 
> statements.

I have read the manuals, but not enough it seems ! I missed this part ! I 
completely miss the «write to » and « read from » instructions. Even a research 
on the web before posting did not return something interesting. I guess I did 
not used the good terms, because now, I find some ressources about these 
functions ! 
> 
> \starttext
> \startMPpage
> 
> numeric done[][], i, j, n ; n := 0 ;
> forever :
>   i := round(uniformdeviate(10)) ;
>   j := round(uniformdeviate(10)) ;
>   if unknown done[i][j] :
>   drawdot
>   (i*cm,j*cm)
>   withpen pencircle scaled 0.5cm
>   withcolor darkred;
>   n := n + 1 ;
>   done[i][j] := n ;
>   
>   write "done[" & tostring(i) & "][" & tostring(j) & "] := " & 
> tostring(n) & " ;" to "mp_test_file.txt" ;
> 
>   fi ;
>   exitif n = 10 ;
>   
> endfor ;
> 
> write EOF to "mp_test_file.txt" ;
> 
> \stopMPpage
> \stoptext
> 
> This results in the expected graphic but also a local file (in the same 
> directory as the source) called "mp_test_file.txt" that contains:
> 
> done[9][1] := 1 ;
> done[4][3] := 2 ;
> done[5][3] := 3 ;
> done[5][1] := 4 ;
> done[2][9] := 5 ;
> done[8][6] := 6 ;
> done[9][10] := 7 ;
> done[9][7] := 8 ;
> done[10][2] := 9 ;
> done[6][5] := 10 ;
> 
> I think, with a bit of judicious use of "write" statements to add some 
> ConTeXt / MP setup code, it would be possible to include the output from the 
> previous run as MP source of the next run.
> 
> Hope this helps, or at least provides some food for thought.

Totally, a lot of food  ! Here is my yesterday example with these functions : 

\starttext
\startMPpage
pair ThePosition[];
ThePosition[1] := (0,0) ;
ThePosition[2] := (10,10) ;
draw ThePosition[1] -- ThePosition[2] ;

% Save the position into a file "bruce.mp"
for i=1 upto 2:
  write "ThePosition[" & tostring(i) & "] := (" & 
tostring(xpart(ThePosition[i])) & ","& tostring(ypart(ThePosition[i])) &") ;" 
to "bruce.mp" ;
endfor;
write EOF to "bruce.mp" ;
\stopMPpage

% The external file would like like (comment added manually here):
% ThePosition[1] := (0,0) ;
% ThePosition[2] := (10,10) ;

% We modify the value of ThePosition[2] 
\startMPpage
ThePosition[2] := (10,0) ;
draw ThePosition[1] -- ThePosition[2] ;
\stopMPpage

% We now read the value of ThePosition[2] from the file 
\startMPpage
input "bruce.mp";
% Save the data from the external file 
draw ThePosition[1] -- ThePosition[2] ;

\stopMPpage

\stoptext

> 
> (Note you need to delete the mp_test_file.txt before re-running else it 
> fails.)

So this totally do the trick : once again, magic is happening ! 
Note that in my installation, I do not need to delete the external file. 
> 
> —
> Bruce Horrocks
> Hampshire, UK

Thanks a lot ! 
Fabrice. 
> 

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

maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : https://contextgarden.net
___


Re: [NTG-context] Metafun : save memory content ?

2022-07-19 Thread Bruce Horrocks via ntg-context


> On 19 Jul 2022, at 04:28, Fabrice L via ntg-context  
> wrote:
> 
> Complementary question : I saw that the « pos_a » « pos_b » of the example 
> could not take numerical value, for example pos_1, pos_2.. How can I use 
> metafun to write a macro to save the contents of hundreds of variable in this 
> object, something like :
> 
> getparameters "MyData » [
>   for i=1 upto 100 :
>   pos_decimal(i) = ThePosition[i],
>   endfor ;
> ] ;
> 
> If this is possible, then this is wonderful and open news doors ! 

I've adapted this example from the metafun-p manual by adding some "write" 
statements.

\starttext
\startMPpage
  
numeric done[][], i, j, n ; n := 0 ;
forever :
i := round(uniformdeviate(10)) ;
j := round(uniformdeviate(10)) ;
if unknown done[i][j] :
drawdot
(i*cm,j*cm)
withpen pencircle scaled 0.5cm
withcolor darkred;
n := n + 1 ;
done[i][j] := n ;

write "done[" & tostring(i) & "][" & tostring(j) & "] := " & 
tostring(n) & " ;" to "mp_test_file.txt" ;

fi ;
exitif n = 10 ;

endfor ;

write EOF to "mp_test_file.txt" ;
   
\stopMPpage
\stoptext

This results in the expected graphic but also a local file (in the same 
directory as the source) called "mp_test_file.txt" that contains:

done[9][1] := 1 ;
done[4][3] := 2 ;
done[5][3] := 3 ;
done[5][1] := 4 ;
done[2][9] := 5 ;
done[8][6] := 6 ;
done[9][10] := 7 ;
done[9][7] := 8 ;
done[10][2] := 9 ;
done[6][5] := 10 ;

I think, with a bit of judicious use of "write" statements to add some ConTeXt 
/ MP setup code, it would be possible to include the output from the previous 
run as MP source of the next run.

Hope this helps, or at least provides some food for thought.

(Note you need to delete the mp_test_file.txt before re-running else it fails.)

—
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://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : https://contextgarden.net
___


Re: [NTG-context] Metafun : save memory content ?

2022-07-18 Thread Fabrice L via ntg-context

> Le 18 juill. 2022 à 12:31, Hans Hagen via ntg-context  a 
> écrit :
> 
> On 7/18/2022 3:20 PM, Fabrice L via ntg-context wrote:
>> Dear list,
>> I’m doing animations in MetaFun, by simply using \startMPpage (…) 
>> \stopMPpage for each frame of the animation. Here is an example: 
>> https://youtu.be/yhxUbVQx9Uo (please note you can watch it in HD by 
>> adjusting the setting in YouTube).
>> This works usually great, but when the number of objects to draw by page is 
>> large, the resulting pdf file could be huge, several gigabytes sometimes. 
>> Such huge files are difficult (sometimes impossible) to convert in jpeg 
>> files (I’m using Image magick for the conversion), necessary to do a mp4 
>> movie.
>> One solution is to do several pdf files, for example one by second; with 
>> this option, I can do 60 files of 30 pages, for an animation of 60 seconds 
>> (1800 frames for 1 minute). Everything is smoother this way, quicker to 
>> convert files. But in order to do so, I have to be able to describe each 
>> frame of the animation with the same set of instructions; so the position of 
>> an object at time t is described by an equation for example.
>> But this is not always possible. If the animation is based on a random 
>> process, the position of an object at time t depends on his position at time 
>> t-1. I can still use this preceeding strategy by simulating the past at the 
>> begging of each second, starting with a unique random seed. So for example 
>> if I work on second 9, I begin by calculating the past from frame 1 to frame 
>> 240 (8*30) and then simulate time 241, draw frame 241, simulate time 242, 
>> draw time 242, etc.. This could be complicated to do, but is feasible. The 
>> drawback is that more I advance in time, the more computations I have to do 
>> at the beginning of each file.
>> So to simplify things, one option would be to be save the state of some 
>> variables at some point in time, say t, in order to be able to access these 
>> informations at time t+1. So the strategy would be :
>> % File second1.pdf
>> for frame =1 to 30 :
>>  simulate position of objects ;
>>  draw the frame ;
>> endfor;
>> save the position of all objects ;
>> % File second2.pdf
>> Read (access) the position of all objects from second 1(after frame 30);
>> for frame =31 to 60 :
>>  simulate position of objects ;
>>  draw the frame ;
>> endfor;
>> save the position of all objects ;
>> Etc...
>> Does someone has an idea of how to do such a thing ? I can read text file in 
>> Context with no problem and integrate them in the animation process with 
>> \startMPinclusions (…) \stopMPinclusions, but I did not find a way to write 
>> information from MetaFun to a text file. Is Lua the solution ?
> there's always an idea ...

Great ! And thanks… 

Of course, it takes me some time to understand, and a little reading in the 
metafun xl manual,  but now I catch it ! 
> 
> \starttext
> \startMPpage
> runscript("metapost.setparameterset('test', table.load('mydata.lua') or { 
> })") ;
> path b ; b := getparameterpath "test" "test_c";
> draw fullcircle scaled 3cm ;
> draw b scaled .4;
> % show(b);
> getparameters "test" [
> test_a = 123,
> test_b = (456,789),
> test_c = (boundingbox currentpicture)
> ] ;
> runscript("table.save('mydata.lua',(metapost.getparameterset('test')))") ;
> \stopMPpage
> \stoptext
> 
> but maybe i need abetter one .. a proper save/restore in the tuc file or so, 
> but you can play with this first
> 
> Hans

If someones in the futur needs more explanation (like me!), here is my minimal 
working example derived from the one of Hans:
First page, we assign a value to the pair « ThePosition[2]  », write the value 
in a file (« TheMagicalFile.lua »), change the value in memory in the second 
page, and then read it from the external file in the third page. Of course, it 
works ! And this could run in separates process of course. 

% 
\starttext
\startMPpage
pair ThePosition[];
ThePosition[1] := (0,0) ;
ThePosition[2] := (10,10) ;
draw ThePosition[1] -- ThePosition[2] ;
% save the parameters in the object MyData
getparameters "MyData" [
pos_a = ThePosition[1],
pos_b = ThePosition[2]
] ;
% Save this object in a file 
runscript("table.save('TheMagicalFile.lua',(metapost.getparameterset('MyData')))")
 ;
\stopMPpage

% We modify the value of ThePosition[2] 
\startMPpage
ThePosition[2] := (10,0) ;
draw ThePosition[1] -- ThePosition[2] ;
\stopMPpage

% We now read the value of ThePosition[2] from the file 
\startMPpage
% Save the data from the external file 
runscript("metapost.setparameterset('MyData', table.load('TheMagicalFile.lua') 
or { })") ;
ThePosition[2] := getparameter "MyData" "pos_b" ; 
draw ThePosition[1] -- ThePosition[2] ;
\stopMPpage

\stoptext
% 

Complementary question : I saw that the « pos_a » « pos_b » of the example 
could not take numerical value, for example pos_1, pos_2.. How can I use 
metafun to write a macro to save the contents of 

Re: [NTG-context] Metafun : save memory content ?

2022-07-18 Thread Hans van der Meer via ntg-context
Storing in a memory block in the computers' internal memory would be super, of 
course. But I am afraid that is asking a bit too much;-)

dr. Hans van der Meer


> On 18 Jul 2022, at 18:31, Hans Hagen via ntg-context  
> wrote:
> 
> On 7/18/2022 3:20 PM, Fabrice L via ntg-context wrote:
>> Dear list,
>> I’m doing animations in MetaFun, by simply using \startMPpage (…) 
>> \stopMPpage for each frame of the animation. Here is an example: 
>> https://youtu.be/yhxUbVQx9Uo (please note you can watch it in HD by 
>> adjusting the setting in YouTube).
>> This works usually great, but when the number of objects to draw by page is 
>> large, the resulting pdf file could be huge, several gigabytes sometimes. 
>> Such huge files are difficult (sometimes impossible) to convert in jpeg 
>> files (I’m using Image magick for the conversion), necessary to do a mp4 
>> movie.
>> One solution is to do several pdf files, for example one by second; with 
>> this option, I can do 60 files of 30 pages, for an animation of 60 seconds 
>> (1800 frames for 1 minute). Everything is smoother this way, quicker to 
>> convert files. But in order to do so, I have to be able to describe each 
>> frame of the animation with the same set of instructions; so the position of 
>> an object at time t is described by an equation for example.
>> But this is not always possible. If the animation is based on a random 
>> process, the position of an object at time t depends on his position at time 
>> t-1. I can still use this preceeding strategy by simulating the past at the 
>> begging of each second, starting with a unique random seed. So for example 
>> if I work on second 9, I begin by calculating the past from frame 1 to frame 
>> 240 (8*30) and then simulate time 241, draw frame 241, simulate time 242, 
>> draw time 242, etc.. This could be complicated to do, but is feasible. The 
>> drawback is that more I advance in time, the more computations I have to do 
>> at the beginning of each file.
>> So to simplify things, one option would be to be save the state of some 
>> variables at some point in time, say t, in order to be able to access these 
>> informations at time t+1. So the strategy would be :
>> % File second1.pdf
>> for frame =1 to 30 :
>>  simulate position of objects ;
>>  draw the frame ;
>> endfor;
>> save the position of all objects ;
>> % File second2.pdf
>> Read (access) the position of all objects from second 1(after frame 30);
>> for frame =31 to 60 :
>>  simulate position of objects ;
>>  draw the frame ;
>> endfor;
>> save the position of all objects ;
>> Etc...
>> Does someone has an idea of how to do such a thing ? I can read text file in 
>> Context with no problem and integrate them in the animation process with 
>> \startMPinclusions (…) \stopMPinclusions, but I did not find a way to write 
>> information from MetaFun to a text file. Is Lua the solution ?
> there's always an idea ...
> 
> \starttext
>\startMPpage
>runscript("metapost.setparameterset('test', table.load('mydata.lua') 
> or { })") ;
>path b ; b := getparameterpath "test" "test_c";
>draw fullcircle scaled 3cm ;
>draw b scaled .4;
>  % show(b);
>getparameters "test" [
>test_a = 123,
>test_b = (456,789),
>test_c = (boundingbox currentpicture)
>] ;
> runscript("table.save('mydata.lua',(metapost.getparameterset('test')))") ;
>\stopMPpage
> \stoptext
> 
> but maybe i need abetter one .. a proper save/restore in the tuc file or so, 
> but you can play with this first
> 
> 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://www.ntg.nl/mailman/listinfo/ntg-context
> webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
> archive  : https://bitbucket.org/phg/context-mirror/commits/
> wiki : https://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://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : https://contextgarden.net
___


Re: [NTG-context] Metafun : save memory content ?

2022-07-18 Thread Hans Hagen via ntg-context

On 7/18/2022 3:20 PM, Fabrice L via ntg-context wrote:

Dear list,

I’m doing animations in MetaFun, by simply using \startMPpage (…) \stopMPpage 
for each frame of the animation. Here is an example: 
https://youtu.be/yhxUbVQx9Uo (please note you can watch it in HD by adjusting 
the setting in YouTube).

This works usually great, but when the number of objects to draw by page is 
large, the resulting pdf file could be huge, several gigabytes sometimes. Such 
huge files are difficult (sometimes impossible) to convert in jpeg files (I’m 
using Image magick for the conversion), necessary to do a mp4 movie.

One solution is to do several pdf files, for example one by second; with this 
option, I can do 60 files of 30 pages, for an animation of 60 seconds (1800 
frames for 1 minute). Everything is smoother this way, quicker to convert 
files. But in order to do so, I have to be able to describe each frame of the 
animation with the same set of instructions; so the position of an object at 
time t is described by an equation for example.

But this is not always possible. If the animation is based on a random process, 
the position of an object at time t depends on his position at time t-1. I can 
still use this preceeding strategy by simulating the past at the begging of 
each second, starting with a unique random seed. So for example if I work on 
second 9, I begin by calculating the past from frame 1 to frame 240 (8*30) and 
then simulate time 241, draw frame 241, simulate time 242, draw time 242, etc.. 
This could be complicated to do, but is feasible. The drawback is that more I 
advance in time, the more computations I have to do at the beginning of each 
file.

So to simplify things, one option would be to be save the state of some 
variables at some point in time, say t, in order to be able to access these 
informations at time t+1. So the strategy would be :

% File second1.pdf
for frame =1 to 30 :
simulate position of objects ;
draw the frame ;
endfor;
save the position of all objects ;

% File second2.pdf
Read (access) the position of all objects from second 1(after frame 30);
for frame =31 to 60 :
simulate position of objects ;
draw the frame ;
endfor;
save the position of all objects ;

Etc...

Does someone has an idea of how to do such a thing ? I can read text file in 
Context with no problem and integrate them in the animation process with 
\startMPinclusions (…) \stopMPinclusions, but I did not find a way to write 
information from MetaFun to a text file. Is Lua the solution ?

there's always an idea ...

\starttext
\startMPpage
runscript("metapost.setparameterset('test', 
table.load('mydata.lua') or { })") ;

path b ; b := getparameterpath "test" "test_c";
draw fullcircle scaled 3cm ;
draw b scaled .4;
  % show(b);
getparameters "test" [
test_a = 123,
test_b = (456,789),
test_c = (boundingbox currentpicture)
] ;

runscript("table.save('mydata.lua',(metapost.getparameterset('test')))") ;
\stopMPpage
\stoptext

but maybe i need abetter one .. a proper save/restore in the tuc file or 
so, but you can play with this first


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://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : https://contextgarden.net
___


Re: [NTG-context] Metafun : save memory content ?

2022-07-18 Thread Hans Hagen via ntg-context

On 7/18/2022 4:39 PM, Henning Hraban Ramm via ntg-context wrote:

Am 18.07.22 um 15:20 schrieb Fabrice L via ntg-context:

Dear list,

I’m doing animations in MetaFun, by simply using \startMPpage (…) 
\stopMPpage for each frame of the animation. Here is an example: 
https://youtu.be/yhxUbVQx9Uo (please note you can watch it in HD by 
adjusting the setting in YouTube).


A great piece again! I’m amazed every time I look at your homepage 
(https://art-aleatoire.com for those who don’t know it).



Does someone has an idea of how to do such a thing ? I can read text 
file in Context with no problem and integrate them in the animation 
process with \startMPinclusions (…) \stopMPinclusions, but I did not 
find a way to write information from MetaFun to a text file. Is Lua 
the solution ?


Lua is always the solution ;) but I don’t understand enough of both Lua 
and MetaFun...


Maybe there’s something in luametafun.pdf*?

*) Hans, this is one of the manuals that doesn’t have interaction, i.e. 
links and bookmarks; would be more usable with them.

time ... time .. time

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://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : https://contextgarden.net
___


Re: [NTG-context] Metafun : save memory content ?

2022-07-18 Thread Henning Hraban Ramm via ntg-context

Am 18.07.22 um 15:20 schrieb Fabrice L via ntg-context:

Dear list,

I’m doing animations in MetaFun, by simply using \startMPpage (…) \stopMPpage 
for each frame of the animation. Here is an example: 
https://youtu.be/yhxUbVQx9Uo (please note you can watch it in HD by adjusting 
the setting in YouTube).


A great piece again! I’m amazed every time I look at your homepage 
(https://art-aleatoire.com for those who don’t know it).




Does someone has an idea of how to do such a thing ? I can read text file in 
Context with no problem and integrate them in the animation process with 
\startMPinclusions (…) \stopMPinclusions, but I did not find a way to write 
information from MetaFun to a text file. Is Lua the solution ?


Lua is always the solution ;) but I don’t understand enough of both Lua 
and MetaFun...


Maybe there’s something in luametafun.pdf*?

*) Hans, this is one of the manuals that doesn’t have interaction, i.e. 
links and bookmarks; would be more usable with them.


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

maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : https://contextgarden.net
___


Re: [NTG-context] Metafun, difficulty with graphical element in the margin

2022-03-21 Thread Willi Egger via ntg-context
Hello Wolfgang,

thank you so much for your time and investigation. — Indeed your solution works 
fine! 

I use the latest version from March 2022.
I use \startbodymatter cum suis.

Lieber Gruß

Willi

> On 20 Mar 2022, at 17:21, Wolfgang Schuster via ntg-context 
>  wrote:
> 
> Willi Egger via ntg-context schrieb am 20.03.2022 um 17:05:
>> Hoi Wolfgang,
>> 
>> I tested both variants (bodymatter and bodypart. The compilation runs 
>> through, however without the thumb-picture in the margin and the metafun 
>> error is in the log.
> 
> 1. Do you use \startfrontmatter and \startbodymatter in your document to 
> create blocks?
> 
> 2. Is you installation up-to-date?
> 
> Attached is a slightly modified version of your example, the only thing which 
> has to be local to the bodypart is the background setting to enable the thumb 
> pictures.
> 
> Wolfgang
> 
> ___
> If your question is of interest to others as well, please add an entry to the 
> Wiki!
> 
> maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
> webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
> archive  : https://bitbucket.org/phg/context-mirror/commits/
> wiki : http://contextgarden.net
> ___

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

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] Metafun, difficulty with graphical element in the margin

2022-03-20 Thread Wolfgang Schuster via ntg-context

Willi Egger via ntg-context schrieb am 20.03.2022 um 17:05:

Hoi Wolfgang,

I tested both variants (bodymatter and bodypart. The compilation runs through, 
however without the thumb-picture in the margin and the metafun error is in the 
log.


1. Do you use \startfrontmatter and \startbodymatter in your document to 
create blocks?


2. Is you installation up-to-date?

Attached is a slightly modified version of your example, the only thing 
which has to be local to the bodypart is the background setting to 
enable the thumb pictures.


Wolfgang

\definecolor [chap_frame] [black]
\definecolor [textcolor]  [white]

\startuseMPgraphic{chapter-thumb}
path chap_frame ;
pair pos,a,b ;
picture Chap ;

if \somenamedheadnumber{chapter}{current} > 0 :
curr_chap := \somenamedheadnumber{chapter}{current} ;
else :
curr_chap := 1 ;
fi;
if \somenamedheadnumber{chapter}{last} > 0 :
last_chap := \somenamedheadnumber{chapter}{last} ;
else :
last_chap := 1 ;
fi;
if \somenamedheadnumber{section}{current} > 0 :
curr_sect := \somenamedheadnumber{section}{current} ;
else:
curr_sect := 1 ;
fi;
if \somenamedheadnumber{section}{last} > 0 :
last_sect := \somenamedheadnumber{section}{last} ;
else:
last_sect := 1;
fi;
if curr_chap < 11 :
skip := TextHeight * (curr_chap-1)/11 ;
elseif curr_chap < 21 :
skip := TextHeight * (curr_chap-11)/11 ;
else:
skip := TextHeight * (curr_chap-21)/11 ;
fi;

Chap := textext("\bfa\textcolor\getmarking[chapter]") ;

StartPage ;
chap_frame := lcircle xscaled (2*RightMarginWidth) yscaled 
(1.5*RightMarginWidth) ;

a := ulcorner chap_frame ;
b := urcorner chap_frame ;

pos := urcorner Field[Text][RightMarginSeparator] - ulcorner chap_frame 
- (-1mm,skip) ;

fill chap_frame shifted pos withcolor "chap_frame" ;
draw Chap rotated 90 shifted (xpart pos-4mm,ypart pos) ;
StopPage ;
\stopuseMPgraphic

\defineoverlay[chapter-thumb][\useMPgraphic{chapter-thumb}]

\startsectionblockenvironment[bodypart]
\setupbackgrounds[rightpage][background=chapter-thumb]
\stopsectionblockenvironment

\showframe

\starttext

\startfrontmatter

\startchapter[title=Test A]
\samplefile{ward}
\stopchapter

\stopfrontmatter

\startbodymatter

\startchapter[title=Test C]
\samplefile{ward}
\stopchapter

\stopbodymatter

\stoptext























% Global settings for all chapters
\setuphead[chapter][style=\ssc]

% Local settings for chapter in the bodymatter block
\startsectionblockenvironment[bodypart]
\setuphead[chapter][color=blue]
\stopsectionblockenvironment

\starttext

\startfrontmatter

\title{Table of content}

\placecontent

\stopfrontmatter

\startbodymatter

\chapter{Knuth}

\input knuth

\chapter{Zapf}

\input zapf

\stopbodymatter

\stoptext





\starttext

a\texttilde b\lettertilde c\textasciitilde d

\stoptext




\definepageinjectionalternative
  [chapter:image]
  [renderingsetup=pageinjection:chapter:image]

\startsetups [pageinjection:chapter:image]
  \centerbox{\externalfigure[\dummyparameter{name}]}
\stopsetups

\definepageinjection
  [chapter:start]
  [empty]
  [page=left]

\definepageinjection
  [chapter:insert]
  [previouspage]
  [alternative=chapter:image,
   offset=1cm,
   pagestate=stop]

\setuphead
  [chapter]
  [beforesection={\pageinjection[chapter:start]},
   
insidesection={\pageinjection[chapter:insert][name={chapter-\namedheadnumber{chapter}}]}]

\setuppagenumbering
  [alternative=doublesided]

\setupexternalfigures
  [location=default]

\useexternalfigure [chapter-1] [mill]   [factor=max]
\useexternalfigure [chapter-2] [hacker] [orientation=90,scale=2000]
\useexternalfigure [chapter-3] [cow][orientation=90,height=\framedwidth]

\starttext

\startchapter [title={Mill}]
\dorecurse{7}{\samplefile{lorem}}
\stopchapter

\startchapter [title={Hacker}]
\dorecurse{11}{\samplefile{lorem}}
\stopchapter

\startchapter [title={cow}]
\dorecurse{7}{\samplefile{lorem}}
\stopchapter

\stoptext




\setupbodyfont[termes]

\starttext

plays \m{\frac{2}{3} A}, \m{\frac{1}{3} D}.

\stoptext






\definefallbackfamily[story][serif][notoserif][range={greekandcoptic,greekextended},force=yes]
\definefontfamily[story][serif][TeX Gyre Schola]

\definefontfamily [story] [sans] [Latin Modern Sans]
\definefontfamily [story] [mono] [Latin Modern Mono] [features=none]

\definetypeface [story] [ss] [sans] [modern] [default]
\definetypeface [story] [ss] [mono] [modern] [default]

\definetypeface [story] [ss] [sans] [modern-designsize] [default]
\definetypeface [story] [ss] [mono] [modern-designsize] [default]

\definefontfamily[story][mm][TeX Gyre Pagella Math]

\definetypeface [story] [mm] [math] [pagella] [default]

\setupbodyfont[story,11pt]

\usebodyfont[termes]

\showframe

\startsetups [blockquote:style]
\switchtobodyfont[termes]
\setupwhitespace[2pt]
\stopsetups


Re: [NTG-context] Metafun, difficulty with graphical element in the margin

2022-03-20 Thread Willi Egger via ntg-context
Hoi Wolfgang,

I tested both variants (bodymatter and bodypart. The compilation runs through, 
however without the thumb-picture in the margin and the metafun error is in the 
log.

Gruß!
Willi

> On 20 Mar 2022, at 17:00, Wolfgang Schuster via ntg-context 
>  wrote:
> 
> Willi Egger via ntg-context schrieb am 20.03.2022 um 16:53:
>> Hoi Wolfgang!
>> 
>> thank you for your suggestion. Your example indeed works. However if I apply 
>> this to my situation, which is
>> 
>> \startsectionblockenvironment[bodymatter]
> 
> You use the wrong name for the argument:
> 
> \startsectionblockenvironment[bodypart]
> 
> Wolfgang
> 
> ___
> If your question is of interest to others as well, please add an entry to the 
> Wiki!
> 
> maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
> webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
> archive  : https://bitbucket.org/phg/context-mirror/commits/
> wiki : http://contextgarden.net
> ___

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

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] Metafun, difficulty with graphical element in the margin

2022-03-20 Thread Wolfgang Schuster via ntg-context

Willi Egger via ntg-context schrieb am 20.03.2022 um 16:53:

Hoi Wolfgang!

thank you for your suggestion. Your example indeed works. However if I apply 
this to my situation, which is

\startsectionblockenvironment[bodymatter]


You use the wrong name for the argument:

\startsectionblockenvironment[bodypart]

Wolfgang

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

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] Metafun, difficulty with graphical element in the margin

2022-03-20 Thread Willi Egger via ntg-context
Hoi Wolfgang!

thank you for your suggestion. Your example indeed works. However if I apply 
this to my situation, which is

\startsectionblockenvironment[bodymatter]
\setups{Thumb-pictures}
\stopsectionblockenvironment

nothing happens. I.e. I get no error, but also no picture, indicating, that the 
\setups command is not executed..

Kind regards

Willi

> On 20 Mar 2022, at 11:28, Wolfgang Schuster via ntg-context 
>  wrote:
> 
> Willi Egger via ntg-context schrieb am 19.03.2022 um 21:42:
>> Hello Otared,
>> thanks so much for your testing and comments. — Tthe problem is, that this 
>> thumb-picture should only be placed in the \startboydmatter..\stopbodymatter 
>> sections. In the case of this book however there are the title pages and 
>> quite some text including the TOC in the 
>> \startfrontmatter..\stopfrontmatter. SO I end up with being forced to invoke 
>> the setups at the beginning of the bodymatter.
> 
> Use sectionblockenvironment to set value which are only applied in the 
> frontmatter, bodymatter etc.
> 
>  begin example
> % Global settings for all chapters
> \setuphead[chapter][style=\ssc]
> 
> % Local settings for chapter in the bodymatter block
> \startsectionblockenvironment[bodypart]
> \setuphead[chapter][color=blue]
> \stopsectionblockenvironment
> 
> \starttext
> 
> \startfrontmatter
> 
> \title{Table of content}
> 
> \placecontent
> 
> \stopfrontmatter
> 
> \startbodymatter
> 
> \chapter{Knuth}
> 
> \input knuth
> 
> \chapter{Zapf}
> 
> \input zapf
> 
> \stopbodymatter
> 
> \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 / http://www.ntg.nl/mailman/listinfo/ntg-context
> webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
> archive  : https://bitbucket.org/phg/context-mirror/commits/
> wiki : http://contextgarden.net
> ___

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

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] Metafun, difficulty with graphical element in the margin

2022-03-20 Thread Willi Egger via ntg-context
Hi Otared,

thank you for your help. — I tried your approach aswel on my Mac as also on 
Linux. Unfortunately neither installation did give me a positive result. The 
error remains.

Kind regards

Willi

> On 19 Mar 2022, at 23:39, Otared Kavian via ntg-context  
> wrote:
> 
> Hi Willi,
> 
> How about invoking the command \setups{Thumb-pictures} between a \start \stop 
> pair as in the following:
> 
> \showframe
> 
> \starttext
> 
> \startfrontmatter
> \startchapter[title=Test A]
>   \samplefile{knuth}
> \stopchapter
> 
> \stopfrontmatter
> 
> %\page[yes]
> 
> \start
> \setups{Thumb-pictures}
> 
> \startbodymatter
> \startchapter[title=Test B]
>   \samplefile{ward}
> \stopchapter
> 
> \startchapter[title=Test C]
>   \samplefile{ward}
> \stopchapter
> 
> \startchapter[title=Test D]
>   \samplefile{ward}
> \stopchapter
> 
> 
> \stopbodymatter
> \stop
> 
> \startbackmatter
> \dorecurse{5}{\startchapter[title=Test #1]
>   \samplefile{thuan}
>   \stopchapter}
>   
> \stopbackmatter
> 
> \stoptext
>   
> 
>> On 19 Mar 2022, at 21:42, Willi Egger via ntg-context  
>> wrote:
>> 
>> Hello Otared,
>> 
>> thanks so much for your testing and comments. — Tthe problem is, that this 
>> thumb-picture should only be placed in the \startboydmatter..\stopbodymatter 
>> sections. In the case of this book however there are the title pages and 
>> quite some text including the TOC in the 
>> \startfrontmatter..\stopfrontmatter. SO I end up with being forced to invoke 
>> the setups at the beginning of the bodymatter.
>> 
>> Thanks!
>> Kind regards
>> 
>> Willi
>> 
>>> On 19 Mar 2022, at 16:52, Otared Kavian via ntg-context 
>>>  wrote:
>>> 
>>> Hi Willi,
>>> 
>>> Your test file works fine if I place 
>>> \setups{Thumb-pictures}
>>> before \starttext (using version 2022.03.12 17:56 LMTX).
>>> However in the file you sent the choice of the command
>>> \setups{Thumb-pictures}
>>> is between chapter A and B, which seems starnge to me...
>>> 
>>> Best regards: Otared K.
>>> 
 On 18 Mar 2022, at 20:29, Willi Egger via ntg-context  
 wrote:
 
 Good evening!
 
 I have a dictionary where I would like to include thumb-pictures in the 
 margin. — When I use the attached code with a single 
 \startchapter...\stopchapter, it works. However if I add another 
 \startchapter…\stopchapter before loading the setups for the thumb-picture 
 metafun throws an error about not having complete information for 
 performing a transformation.
 
 I am currently using the before last version of LMTX-ConTeXT (January 21st 
 2022).
 
 Could someone try to compile?
 
 Thanks, kind regards
 
 Willi___
 If your question is of interest to others as well, please add an entry to 
 the Wiki!
 
 maillist : ntg-context@ntg.nl / 
 http://www.ntg.nl/mailman/listinfo/ntg-context
 webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
 archive  : https://bitbucket.org/phg/context-mirror/commits/
 wiki : http://contextgarden.net
 ___
>>> 
>>> ___
>>> If your question is of interest to others as well, please add an entry to 
>>> the Wiki!
>>> 
>>> maillist : ntg-context@ntg.nl / 
>>> http://www.ntg.nl/mailman/listinfo/ntg-context
>>> webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
>>> archive  : https://bitbucket.org/phg/context-mirror/commits/
>>> wiki : http://contextgarden.net
>>> ___
>> 
>> ___
>> If your question is of interest to others as well, please add an entry to 
>> the Wiki!
>> 
>> maillist : ntg-context@ntg.nl / 
>> http://www.ntg.nl/mailman/listinfo/ntg-context
>> webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
>> archive  : https://bitbucket.org/phg/context-mirror/commits/
>> wiki : http://contextgarden.net
>> ___
> 
> ___
> If your question is of interest to others as well, please add an entry to the 
> Wiki!
> 
> maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
> webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
> archive  : https://bitbucket.org/phg/context-mirror/commits/
> wiki : http://contextgarden.net
> ___

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

Re: [NTG-context] Metafun, difficulty with graphical element in the margin

2022-03-20 Thread Wolfgang Schuster via ntg-context

Willi Egger via ntg-context schrieb am 19.03.2022 um 21:42:

Hello Otared,

thanks so much for your testing and comments. — Tthe problem is, that this 
thumb-picture should only be placed in the \startboydmatter..\stopbodymatter 
sections. In the case of this book however there are the title pages and quite 
some text including the TOC in the \startfrontmatter..\stopfrontmatter. SO I 
end up with being forced to invoke the setups at the beginning of the 
bodymatter.


Use sectionblockenvironment to set value which are only applied in the 
frontmatter, bodymatter etc.


 begin example
% Global settings for all chapters
\setuphead[chapter][style=\ssc]

% Local settings for chapter in the bodymatter block
\startsectionblockenvironment[bodypart]
\setuphead[chapter][color=blue]
\stopsectionblockenvironment

\starttext

\startfrontmatter

\title{Table of content}

\placecontent

\stopfrontmatter

\startbodymatter

\chapter{Knuth}

\input knuth

\chapter{Zapf}

\input zapf

\stopbodymatter

\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 / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] Metafun, difficulty with graphical element in the margin

2022-03-19 Thread Otared Kavian via ntg-context
Hi Willi,

How about invoking the command \setups{Thumb-pictures} between a \start \stop 
pair as in the following:

\showframe

\starttext

\startfrontmatter
\startchapter[title=Test A]
\samplefile{knuth}
\stopchapter

\stopfrontmatter

%\page[yes]

\start
\setups{Thumb-pictures}

\startbodymatter
 \startchapter[title=Test B]
\samplefile{ward}
 \stopchapter

\startchapter[title=Test C]
\samplefile{ward}
\stopchapter

\startchapter[title=Test D]
\samplefile{ward}
\stopchapter


\stopbodymatter
\stop

\startbackmatter
\dorecurse{5}{\startchapter[title=Test #1]
\samplefile{thuan}
\stopchapter}

\stopbackmatter

\stoptext


> On 19 Mar 2022, at 21:42, Willi Egger via ntg-context  
> wrote:
> 
> Hello Otared,
> 
> thanks so much for your testing and comments. — Tthe problem is, that this 
> thumb-picture should only be placed in the \startboydmatter..\stopbodymatter 
> sections. In the case of this book however there are the title pages and 
> quite some text including the TOC in the \startfrontmatter..\stopfrontmatter. 
> SO I end up with being forced to invoke the setups at the beginning of the 
> bodymatter.
> 
> Thanks!
> Kind regards
> 
> Willi
> 
>> On 19 Mar 2022, at 16:52, Otared Kavian via ntg-context  
>> wrote:
>> 
>> Hi Willi,
>> 
>> Your test file works fine if I place 
>>  \setups{Thumb-pictures}
>> before \starttext (using version 2022.03.12 17:56 LMTX).
>> However in the file you sent the choice of the command
>>  \setups{Thumb-pictures}
>> is between chapter A and B, which seems starnge to me...
>> 
>> Best regards: Otared K.
>> 
>>> On 18 Mar 2022, at 20:29, Willi Egger via ntg-context  
>>> wrote:
>>> 
>>> Good evening!
>>> 
>>> I have a dictionary where I would like to include thumb-pictures in the 
>>> margin. — When I use the attached code with a single 
>>> \startchapter...\stopchapter, it works. However if I add another 
>>> \startchapter…\stopchapter before loading the setups for the thumb-picture 
>>> metafun throws an error about not having complete information for 
>>> performing a transformation.
>>> 
>>> I am currently using the before last version of LMTX-ConTeXT (January 21st 
>>> 2022).
>>> 
>>> Could someone try to compile?
>>> 
>>> Thanks, kind regards
>>> 
>>> Willi___
>>> If your question is of interest to others as well, please add an entry to 
>>> the Wiki!
>>> 
>>> maillist : ntg-context@ntg.nl / 
>>> http://www.ntg.nl/mailman/listinfo/ntg-context
>>> webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
>>> archive  : https://bitbucket.org/phg/context-mirror/commits/
>>> wiki : http://contextgarden.net
>>> ___
>> 
>> ___
>> If your question is of interest to others as well, please add an entry to 
>> the Wiki!
>> 
>> maillist : ntg-context@ntg.nl / 
>> http://www.ntg.nl/mailman/listinfo/ntg-context
>> webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
>> archive  : https://bitbucket.org/phg/context-mirror/commits/
>> wiki : http://contextgarden.net
>> ___
> 
> ___
> If your question is of interest to others as well, please add an entry to the 
> Wiki!
> 
> maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
> webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
> archive  : https://bitbucket.org/phg/context-mirror/commits/
> wiki : http://contextgarden.net
> ___

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

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] Metafun, difficulty with graphical element in the margin

2022-03-19 Thread Willi Egger via ntg-context
Hello Otared,

thanks so much for your testing and comments. — Tthe problem is, that this 
thumb-picture should only be placed in the \startboydmatter..\stopbodymatter 
sections. In the case of this book however there are the title pages and quite 
some text including the TOC in the \startfrontmatter..\stopfrontmatter. SO I 
end up with being forced to invoke the setups at the beginning of the 
bodymatter.

Thanks!
Kind regards

Willi

> On 19 Mar 2022, at 16:52, Otared Kavian via ntg-context  
> wrote:
> 
> Hi Willi,
> 
> Your test file works fine if I place 
>   \setups{Thumb-pictures}
> before \starttext (using version 2022.03.12 17:56 LMTX).
> However in the file you sent the choice of the command
>   \setups{Thumb-pictures}
> is between chapter A and B, which seems starnge to me...
> 
> Best regards: Otared K.
> 
>> On 18 Mar 2022, at 20:29, Willi Egger via ntg-context  
>> wrote:
>> 
>> Good evening!
>> 
>> I have a dictionary where I would like to include thumb-pictures in the 
>> margin. — When I use the attached code with a single 
>> \startchapter...\stopchapter, it works. However if I add another 
>> \startchapter…\stopchapter before loading the setups for the thumb-picture 
>> metafun throws an error about not having complete information for performing 
>> a transformation.
>> 
>> I am currently using the before last version of LMTX-ConTeXT (January 21st 
>> 2022).
>> 
>> Could someone try to compile?
>> 
>> Thanks, kind regards
>> 
>> Willi___
>> If your question is of interest to others as well, please add an entry to 
>> the Wiki!
>> 
>> maillist : ntg-context@ntg.nl / 
>> http://www.ntg.nl/mailman/listinfo/ntg-context
>> webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
>> archive  : https://bitbucket.org/phg/context-mirror/commits/
>> wiki : http://contextgarden.net
>> ___
> 
> ___
> If your question is of interest to others as well, please add an entry to the 
> Wiki!
> 
> maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
> webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
> archive  : https://bitbucket.org/phg/context-mirror/commits/
> wiki : http://contextgarden.net
> ___

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

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] Metafun, difficulty with graphical element in the margin

2022-03-19 Thread Otared Kavian via ntg-context
Hi Willi,

Your test file works fine if I place 
\setups{Thumb-pictures}
before \starttext (using version 2022.03.12 17:56 LMTX).
However in the file you sent the choice of the command
\setups{Thumb-pictures}
is between chapter A and B, which seems starnge to me...

Best regards: Otared K.

> On 18 Mar 2022, at 20:29, Willi Egger via ntg-context  
> wrote:
> 
> Good evening!
> 
> I have a dictionary where I would like to include thumb-pictures in the 
> margin. — When I use the attached code with a single 
> \startchapter...\stopchapter, it works. However if I add another 
> \startchapter…\stopchapter before loading the setups for the thumb-picture 
> metafun throws an error about not having complete information for performing 
> a transformation.
> 
> I am currently using the before last version of LMTX-ConTeXT (January 21st 
> 2022).
> 
> Could someone try to compile?
> 
> Thanks, kind regards
> 
> Willi___
> If your question is of interest to others as well, please add an entry to the 
> Wiki!
> 
> maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
> webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
> archive  : https://bitbucket.org/phg/context-mirror/commits/
> wiki : http://contextgarden.net
> ___

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

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] Metafun, difficulty with graphical element in the margin

2022-03-19 Thread Hans Hagen via ntg-context

On 3/18/2022 8:29 PM, Willi Egger via ntg-context wrote:

Good evening!

I have a dictionary where I would like to include thumb-pictures in the margin. 
— When I use the attached code with a single \startchapter...\stopchapter, it 
works. However if I add another \startchapter…\stopchapter before loading the 
setups for the thumb-picture metafun throws an error about not having complete 
information for performing a transformation.

I am currently using the before last version of LMTX-ConTeXT (January 21st 
2022).

Could someone try to compile?

works here (with the latest)

Hans

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

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] Metafun, difficulty with graphical element in the margin

2022-03-18 Thread śrīrāma via ntg-context
On Saturday, March 19, 2022 12:59 AM Willi Egger via ntg-context wrote:
> Could someone try to compile?

I have compiled your test file with both the below versions :
 • mtx-context | current version: 2022.01.21 20:13
 • mtx-context | current version: 2022.03.12 17:56

In both cases, no errors were emitted by MetaFun; the output also seems to be 
as expected (thumb pictures progressively moving downward with every chapter).

Sreeram


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

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] [MetaFun] Trying to understand outlinetext, 'stretch' effect and \kerncharacters

2022-01-01 Thread kauśika via ntg-context
On Saturday, January 1, 2022 3:45:36 PM IST Hans Hagen wrote:
> \starteffect is kind of old (comes from mkii), but you could use the
> pseudo font feature effect in mkiv / lmtx which then makes a real font
> instance instead of mixing in some pdf magic

Thanks for the explanations Hans! Happy new year wishes to you!

kauśika


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

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] [MetaFun] Trying to understand outlinetext, 'stretch' effect and \kerncharacters

2022-01-01 Thread Hans Hagen via ntg-context

On 12/31/2021 3:13 AM, kauśika via ntg-context wrote:

Dear list,

I have the following graphic

\startuseMPgraphic{TitleGraphic}
draw outlinetext.b (\MPstring{TitleText})
 (withcolor "titlefg")
 (withcolor "titleoutline");
\stopuseMPgraphic

which I tried to use as follows to produce a stylized 'title' head:

\setupMPtext{TitleText}{%
\starteffect[stretch]\bfc\namedstructurevariable{title}{title}\stopeffect}
\useMPgraphic{TitleGraphic}


low level pdf magic ... so not done in mp


[colors "titlefg" and "titleoutline" are set using \definecolor]

But, the 'stretch' effect caused by \starteffect[stretch]…\stopeffect does not
work with 'outlinetext' method in the MPgraphic. I have verified that the
desired effect is produced using 'textext' method instead. But in that case I
have to cheat (i.e draw twice; once with blownup) to get the text outline.

Now, if I write instead

\setupMPtext{TitleText}{%
\kerncharacters[0.15]\bfc\namedstructurevariable{title}{title}}
\useMPgraphic{TitleGraphic}


tex magic so done in tex


then the desired effect is produced. As such, my purpose is served well by
using \kerncharacters.

Nonetheless, I request your kind help in understanding why this is happening
and/or if I am doing something wrong.
\starteffect is kind of old (comes from mkii), but you could use the 
pseudo font feature effect in mkiv / lmtx which then makes a real font 
instance instead of mixing in some pdf magic


Hans


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

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] [MetaFun] Trying to understand outlinetext, 'stretch' effect and \kerncharacters

2021-12-30 Thread kauśika via ntg-context
On Friday, December 31, 2021 7:43:21 AM IST kauśika wrote:
> Dear list,
> 
> I have the following graphic
> 
> \startuseMPgraphic{TitleGraphic}
> draw outlinetext.b (\MPstring{TitleText})
> (withcolor "titlefg")
> (withcolor "titleoutline");
> \stopuseMPgraphic
> 
> which I tried to use as follows to produce a stylized 'title' head:
> 
> \setupMPtext{TitleText}{%
> \starteffect[stretch]\bfc\namedstructurevariable{title}{title}\stopeffect}
> \useMPgraphic{TitleGraphic}
> 
> [colors "titlefg" and "titleoutline" are set using \definecolor]
> 
> But, the 'stretch' effect caused by \starteffect[stretch]…\stopeffect does
> not work with 'outlinetext' method in the MPgraphic. I have verified that
> the desired effect is produced using 'textext' method instead. But in that
> case I have to cheat (i.e draw twice; once with blownup) to get the text
> outline.
> 
> Now, if I write instead
> 
> \setupMPtext{TitleText}{%
> \kerncharacters[0.15]\bfc\namedstructurevariable{title}{title}}
> \useMPgraphic{TitleGraphic}
> 
> then the desired effect is produced. As such, my purpose is served well by
> using \kerncharacters.
> 
> Nonetheless, I request your kind help in understanding why this is happening
> and/or if I am doing something wrong.
> 
> Thanks,
> kauśika

Please read '\setupMPtext' as '\setMPtext' in the above. Apologies for the 
typos.

kauśika


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

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] metafun: circular arc

2021-10-05 Thread Floris van Manen via ntg-context

In the example the text is drawn as:

draw followtext(q, "\strut TEXT ONE")


it looks as if the \strut generates a space before the text.
e.g. if you omit the \strut, the text will align at the start point.
In my perception, the \strut is a zero width box, so it should not 
generate the space before.

But I might be wrong here (most likely ;-)

.F




On 05/10/2021 23:32, Thomas A. Schmitz via ntg-context wrote:


\startuseMPgraphic{empedocless}
path p, q, r ;
pair a ;

p := fullcircle scaled 10cm ;
drawarrow p  withpen pencircle scaled 1mm withcolor red ;
draw    point 0 of p withpen pencircle scaled 1mm withcolor blue ;
q := p cutafter (point .4 along p) ;
drawarrow q  withpen pencircle scaled .5mm withcolor green ;
draw followtext(q, "\strut TEXT ONE") ;

p := fullcircle scaled 8cm ;
drawarrow p  withpen pencircle scaled 1mm withcolor cyan ;
draw    point 0 of p withpen pencircle scaled 1mm withcolor magenta ;
q := p cutafter (point .3 along p) ;
q := q rotated 120 ;
drawarrow q  withpen pencircle scaled .5mm withcolor yellow ;
draw followtext(q, "\strut TEXT TWO") ;

% the real deal: best make a macro for this

p := fullcircle scaled 6cm ;
draw    point 0 of p withpen pencircle scaled 5mm withcolor blue ;
drawarrow p  withpen pencircle scaled 1mm withcolor red ;
a := (point eps of p) rotated 45 ;
draw a withpen pencircle scaled 2mm;
q := p cutafter a ;
q := q rotated 20 ;
drawarrow q  withpen pencircle scaled .5mm withcolor green ;
draw followtext(q, "\strut TEXT TWO") ;

\stopuseMPgraphic

\useMPgraphic{empedocless}

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

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] metafun: circular arc

2021-10-05 Thread Thomas A. Schmitz via ntg-context


Thank you so much, Hans, that's a neat solution! I was banging my head 
against the wall, but this makes sense.


On 10/5/21 6:38 PM, Hans Hagen wrote:

Because you know how to rotate and scale:

\startuseMPgraphic{empedocless}
path p, q, r ;
pair a ;

p := fullcircle scaled 10cm ;
drawarrow p  withpen pencircle scaled 1mm withcolor red ;
draw    point 0 of p withpen pencircle scaled 1mm withcolor blue ;
q := p cutafter (point .4 along p) ;
drawarrow q  withpen pencircle scaled .5mm withcolor green ;
draw followtext(q, "\strut TEXT ONE") ;

p := fullcircle scaled 8cm ;
drawarrow p  withpen pencircle scaled 1mm withcolor cyan ;
draw    point 0 of p withpen pencircle scaled 1mm withcolor magenta ;
q := p cutafter (point .3 along p) ;
q := q rotated 120 ;
drawarrow q  withpen pencircle scaled .5mm withcolor yellow ;
draw followtext(q, "\strut TEXT TWO") ;

% the real deal: best make a macro for this

p := fullcircle scaled 6cm ;
draw    point 0 of p withpen pencircle scaled 5mm withcolor blue ;
drawarrow p  withpen pencircle scaled 1mm withcolor red ;
a := (point eps of p) rotated 45 ;
draw a withpen pencircle scaled 2mm;
q := p cutafter a ;
q := q rotated 20 ;
drawarrow q  withpen pencircle scaled .5mm withcolor green ;
draw followtext(q, "\strut TEXT TWO") ;

\stopuseMPgraphic

\useMPgraphic{empedocless}

So, just always start at point 0 and then just rotate the cutof piece 
over the angle that you want. The eps in the last case makes that we 
actually have a cut off piece (zero fails here).


So ... solution 4. best suits non math gurus (like you and me).


This is the part of your reply that fails to convince. You don't even 
know how bad I am at math...


Thanks, and all best

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

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] metafun: circular arc

2021-10-05 Thread Hans Hagen via ntg-context

On 10/5/2021 4:58 PM, Thomas A. Schmitz via ntg-context wrote:


Hi all,

I hope the following example is not too convoluted:

\useMPlibrary [txt]

\define\EmpArrow{\getscaledglyph{1.6}{name:dejavumath}{\char"2B05}}

\setupbodyfont [ss,9pt]

\starttext

\startuseMPgraphic{empedocles}
%numeric a ; a = 6.56cm ;
%numeric b ; b = 1.1 ;
save S; path S[] ;
S[1] = fullcircle scaled 8cm rotated 306 ;
S[2] = S[1] scaled 1.1 ;
S[3] = S[1] scaled 1.23 ;
S[4] = S[1] scaled 1.3 ;
S[5] = S[1] scaled 1.43 ;
S[6] = S[1] scaled 1.5 ;
S[7] = S[1] scaled 1.6 ;
z[1] = point 1 along S[7] ;
z[2] = point 1 along S[1] ;
z[3] = point 0.1 along S[7] ;
z[4] = point 0.1 along S[1] ;
z[5] = point 0.2 along S[7] ;
z[6] = point 0.2 along S[1] ;
z[7] = point 0.3 along S[7] ;
z[8] = point 0.3 along S[1] ;
z[9] = point 0.4 along S[7] ;
z[10] = point 0.4 along S[1] ;
z[11] = point 0.5 along S[7] ;
z[12] = point 0.5 along S[1] ;
z[13] = point 0.6 along S[7] ;
z[14] = point 0.6 along S[1] ;
z[15] = point 0.7 along S[7] ;
z[16] = point 0.7 along S[1] ;
z[17] = point 0.8 along S[7] ;
z[18] = point 0.8 along S[1] ;
S[8] = z[1] -- z[2] ;
S[9] = z[3] -- z[4] ;
S[10] = z[5] -- z[6] ;
S[11] = z[7] -- z[8] ;
S[12] = z[9] -- z[10] ;
S[13] = z[11] -- z[12] ;
S[14] = z[13] -- z[14] ;
S[15] = z[15] -- z[16] ;
S[16] = z[17] -- z[18] ;
z[19] = S[3] intersection_point S[8] ;
z[20] = S[3] intersection_point S[16] ;
S[18] = S[3] cutbefore z[20] cutafter z[19] ;
z[21] = S[5] intersection_point S[8] ;
z[22] = S[5] intersection_point S[16] ;
S[19] = S[5] cutbefore z[22] cutafter z[21] ;
z[23] = S[12] intersection_point S[3] ;
S[20] = S[3] cutbefore z[20] cutafter z[23] ;
for i = 1 upto 16:
 draw S[i] withcolor 0.7white ;
endfor ;
draw z[23] -- z[20] withcolor red ;
draw S[20] withcolor blue ;
label.bot(textext("\noexpand\framed[align=middle,frame=off]{Jahr \crlf 
20.000 = 0}"), z[10]) ;
label.llft(textext("\noexpand\framed[align=middle,frame=off]{Jahr \crlf 
2.000}"), z[8]) ;
label.lft(textext("\noexpand\framed[align=middle,frame=off]{Jahr \crlf 
4.000}"), z[6]) ;
label.lft(textext("\noexpand\framed[align=middle,frame=off]{Jahr \crlf 
6.000}"), z[4]) ;
label.ulft(textext("\noexpand\framed[align=middle,frame=off]{Jahr \crlf 
8.000}"), z[2]) ;
label.urt(textext("\noexpand\framed[align=middle,frame=off]{Jahr \crlf 
12.000}"), z[18]) ;
label.rt(textext("\noexpand\framed[align=middle,frame=off]{Jahr \crlf 
14.000}"), z[16]) ;
label.rt(textext("\noexpand\framed[align=middle,frame=off]{Jahr \crlf 
16.000}"), z[14]) ;
label.lrt(textext("\noexpand\framed[align=middle,frame=off]{Jahr \crlf 
18.000}"), z[12]) ;
draw followtext(S[18], "\strut\hbox to 2em{\EmpArrow}\hskip2em 
RUHEPAUSE\hskip4em\strut") ;
draw followtext(S[19], "\strut\hbox to 2em{\EmpArrow}EINHEIT 
(SPHAIROS)\hskip2em\strut") ;

\stopuseMPgraphic

\useMPgraphic{empedocles}

\stoptext

I have a big problem and some smaller questions, for those who are 
better at math and at metafun than I am:


1. The big problem: for the next followtext, I need the circular arc 
between points z[23] and z[20]. But however I place the cutbefore and 
cutafter, I don't get the proper part of the circle. I'm looking at the 
right intersection points, as the red line shows, but the blue line 
shows that I'm not getting the right section of the circle. How can I 
get this section into the path S[20]?


2. Math... :-) Is there a better way to define three circles that are at 
exactly the same distance than my naive "scaled 1.3" and "scaled 1.5"?


3. TeX and metafun: is there a better way to have the followtext exactly 
centered between the two circles rather than just fiddle with the scale 
factor?


4. Or is there a better approach to my problem altogether? I'm trying to 
reproduce an illustration from a book, so I'm very open to suggestions 
here. I looked at the example in the metafun manual chapter 10.4, but 
I'm not sure if using an overlay and multiple \followtokens would be 
easier. Especially since there is the scary remark "This definition is 
not the right one!" in this chapter without any further explanation.


I hope you all had a wonderful meeting last week. I was sad I couldn't 
come, I was in Paris for a conference, the first after 18 months, so I 
couldn't skip this one.

Because you know how to rotate and scale:

\startuseMPgraphic{empedocless}
path p, q, r ;
pair a ;

p := fullcircle scaled 10cm ;
drawarrow p  withpen pencircle scaled 1mm withcolor red ;
drawpoint 0 of p withpen pencircle scaled 1mm withcolor blue ;
q := p cutafter (point .4 along p) ;
drawarrow q  withpen pencircle scaled .5mm withcolor green ;
draw followtext(q, "\strut TEXT ONE") ;

p := fullcircle scaled 8cm ;
drawarrow p  withpen pencircle scaled 1mm withcolor cyan ;
drawpoint 0 of p withpen pencircle scaled 1mm withcolor magenta ;
q := p cutafter (point .3 along p) ;
q := q rotated 120 ;
drawarrow q  withpen pencircle scaled .5mm withcolor yellow ;
draw followtext(q, 

Re: [NTG-context] metafun doesn't compile \root 3 \of 2

2021-09-03 Thread Hans Hagen via ntg-context

On 9/3/2021 11:48 AM, fv leung via ntg-context wrote:

\starttext

\m{\root3\of2}

\stoptext

works.

But

\starttext

\startMPcode
   label("\m{\root3\of2}", origin);
\stopMPcode

\stoptext

doesn't.

draw thetextext("\m{\root3\of2}",origin);

labels are done in the default (normally monospace) font

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

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] metafun transformation error

2021-06-04 Thread Ajith R
Hi,


> here a ; is missing after the q

That was a silly mistake while making the MWE. 
When I corrected it, the MWE compiled correctly. However, the original code 
didn't have that error and wouldn't compile.
So, I tried another MWE and found out what was causing the error.
In the array I defined, there were two elements with empty string as their 
value. Once I changed those empty strings to some valid string, there was no 
error and the file compiled as expected. Here is the new MWE with one array 
element defined as empty string

\starttext
\switchtobodyfont[30pt]
\startMPpage
StartPage ;
unit := 2 * cm ;
%numeric lm, row, col, bm; 
pair  middle;
row := 1; col := 1; 
picture p, q ; p := nullpicture; q := nullpicture;


string l[], lbl;
l[0] := "" ; l[1]:= "2"; 


for i= 0 upto row:
middle := 0.5[((( i * unit) ), ((2 * unit))), i+1) * unit) ), ((2 * unit) 
))];
lbl := l[i];
p := thelabel(lbl, middle); 
q := p reflectedabout (0.5[urcorner p, ulcorner p], 0.5[lrcorner p, llcorner 
p]);
draw q;


endfor
StopPage ;
\stopMPpage
\stoptext


This will throw an error. If l[0] is defined as, say, "hi", there is no error

I suppose, my work around would be to use a non empty string and then fill that 
cell dark. Is there another way?

Anyway, thanks for your prompt replies and patience.

Thanks a ton for sharing your efforts with the world

ajith
\starttext
\switchtobodyfont[30pt]
\startMPpage
StartPage ;
unit := 2 * cm ;
%numeric lm, row, col, bm; 
pair  middle;
row := 1; col := 1; 
picture p, q ; p := nullpicture; q := nullpicture;

string l[], lbl;
l[0] := "" ; l[1]:= "2"; 

for i= 0 upto row:
middle := 0.5[((( i * unit) ), ((2 * unit))), i+1) * unit) ), ((2 * unit) ))];
lbl := l[i];
p := thelabel(lbl, middle); 
q := p reflectedabout (0.5[urcorner p, ulcorner p], 0.5[lrcorner p, llcorner p]);
draw q;

endfor
StopPage ;
\stopMPpage
\stoptext

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

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] metafun transformation error

2021-06-04 Thread Hans Hagen

On 6/4/2021 5:08 PM, Ajith R wrote:

Hi,



here a ; is missing after the q


That was a silly mistake while making the MWE.
When I corrected it, the MWE compiled correctly. However, the original code 
didn't have that error and wouldn't compile.
So, I tried another MWE and found out what was causing the error.
In the array I defined, there were two elements with empty string as their 
value. Once I changed those empty strings to some valid string, there was no 
error and the file compiled as expected. Here is the new MWE with one array 
element defined as empty string

\starttext
\switchtobodyfont[30pt]
\startMPpage
StartPage ;
unit := 2 * cm ;
%numeric lm, row, col, bm;
pair  middle;
row := 1; col := 1;
picture p, q ; p := nullpicture; q := nullpicture;


string l[], lbl;
l[0] := "" ; l[1]:= "2";


for i= 0 upto row:
middle := 0.5[((( i * unit) ), ((2 * unit))), i+1) * unit) ), ((2 * unit) 
))];
lbl := l[i];
p := thelabel(lbl, middle);
q := p reflectedabout (0.5[urcorner p, ulcorner p], 0.5[lrcorner p, llcorner 
p]);
draw q;


endfor
StopPage ;
\stopMPpage
\stoptext


This will throw an error. If l[0] is defined as, say, "hi", there is no error

I suppose, my work around would be to use a non empty string and then fill that 
cell dark. Is there another way?

Anyway, thanks for your prompt replies and patience.

Thanks a ton for sharing your efforts with the world

you canot reflect about zero dimensions:

p := thetextext(lbl, middle);
message(0.5[urcorner p, ulcorner p]);
if llcorner p <> urcorner p :
q := p reflectedabout (0.5[urcorner p, ulcorner p], 
0.5[lrcorner p, llcorner p]);

draw q;
fi

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

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] metafun transformation error

2021-06-04 Thread Ajith R
Hi,


> In order answer that you have to make a MWE that we can run without the 
> need to edit a file.

> Hans

Sorry for having assumed that sharing the code was sufficient as MWE.

Here is the trimmed version that still throws the error 


\startMPpage
StartPage ;


numeric row, col, unit; 
pair  middle;
row := 1; col := 1;
unit := 2 * cm ;
picture p, q ; p := nullpicture; q := nullpicture;
string l[];
l[0] := "2" ; l[1] := " 4"; 


for i= 0 upto row :
middle := (i * unit, 5cm);
p := thelabel( l[i], middle); 
draw p;
%q := p reflectedabout (0.5[urcorner p, ulcorner p], 0.5[lrcorner p, llcorner 
p]);
%draw q
endfor
StopPage ;
\stopMPpage
\stoptext

The file is also attached.
 As I told earlier, an  error is thrown if I uncomment the line that assigns q 
and then draws it.

Thanks for your help,
ajith
\startMPpage
StartPage ;

numeric row, col, unit; 
pair  middle;
row := 1; col := 1;
unit := 2 * cm ;
picture p, q ; p := nullpicture; q := nullpicture;
string l[];
l[0] := "2" ; l[1] := " 4"; 

for i= 0 upto row :
middle := (i * unit, 5cm);
p := thelabel( l[i], middle); 
draw p;
%q := p reflectedabout (0.5[urcorner p, ulcorner p], 0.5[lrcorner p, llcorner p]);
%draw q
endfor
StopPage ;
\stopMPpage
\stoptext

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

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] metafun transformation error

2021-06-04 Thread Hans Hagen

On 6/4/2021 1:25 PM, Ajith R wrote:

Hi,



In order answer that you have to make a MWE that we can run without the
need to edit a file.



Hans


Sorry for having assumed that sharing the code was sufficient as MWE.

Here is the trimmed version that still throws the error


\startMPpage
StartPage ;


numeric row, col, unit;
pair  middle;
row := 1; col := 1;
unit := 2 * cm ;
picture p, q ; p := nullpicture; q := nullpicture;
string l[];
l[0] := "2" ; l[1] := " 4";


for i= 0 upto row :
middle := (i * unit, 5cm);
p := thelabel( l[i], middle);
draw p;
%q := p reflectedabout (0.5[urcorner p, ulcorner p], 0.5[lrcorner p, llcorner 
p]);
%draw q


here a ; is missing after the q


endfor
StopPage ;
\stopMPpage
\stoptext

The file is also attached.
  As I told earlier, an  error is thrown if I uncomment the line that assigns q 
and then draws it.

Thanks for your help,
ajith


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

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___




--

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

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] metafun transformation error

2021-06-04 Thread Hans Hagen

On 6/4/2021 10:15 AM, Ajith R wrote:

Hi all,

I am new to context and need help in solving an error.

I am trying to print some numbers in a grid onto a transparent sheet as mirror images so 
that the numbers are correctly displayed when I view it from the non printed side. The 
numbers have a particular sequence which cannot be obtained from calculations. So, they 
are stored in an array of strings : l[0][0] := "38"; ...

I place them at the centre of the grid squares using the code below:

for i= 0 upto (row - 1):
for j= 0 upto (col - 1):
middle := 0.5[((( i * unit) + lm), ((j * unit) +  bm)), i+1) * unit) + lm), 
(((j +1) * unit) +  bm))];
p := thelabel(l[j][i], middle);
draw p;

% q := p reflectedabout (0.5[urcorner p, ulcorner p], 0.5[lrcorner p, llcorner 
p]);
% draw q;
endfor
endfor

This works as expected. But, when I try to reflect the label by means of the 
commented code, I get an error :

tex error       > mp error on line 643 in file 
/home/ajith/Desktop/PlayGround/numgrid.tex:



(xpart T_,ypart T_,-0.00581xpart T_+0.00497ypart T_+0.15294,-0.00497xpart T_

-0.00581ypart T_+0.98824,-0.00497xpart T_-0.00581ypart T_+0.98825,0.00581xpart
T_-0.00497ypart T_-0.15294)
! Transform components aren't all known.

;
 ...lcorner.p];q:=p.reflectedabout(uq,lq);
draw.p; ENDFOR
 ...=p.reflectedabout(uq,lq);draw.p;endfor
ENDFOR
<*> ...lectedabout (uq, lq); draw p; endfor endfor
StopPage ; ;
I'm unable to apply a partially specified transformation
except to a fully known pair or transform.
Proceed, and I'll omit the transformation.


I tried a mock example without the loops and that didn't throw an error.

How can I make it work within the loops?
In order answer that you have to make a MWE that we can run without the 
need to edit a file.


Hans

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

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] [metafun example does not compile]

2021-05-21 Thread Floris van Manen



On 21/05/2021 14:14, Taco Hoekwater wrote:

It looks like textext.dflt is undefined in the latest lmtx because it is now
renamed to textext.dlft :)


As we say in dutch: een kniesoor die daar op let
;-)

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

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] [metafun example does not compile]

2021-05-21 Thread Floris van Manen

the line preventing the output from showing uo seems to be be:

draw textext.dflt("DFLT-" & MonTexte) shifted PB;

If I remove that, I'll get output.


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

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] [metafun example does not compile]

2021-05-21 Thread Taco Hoekwater
Hi,

It looks like textext.dflt is undefined in the latest lmtx because it is now
renamed to textext.dlft :)


> On 21 May 2021, at 14:03, Floris van Manen  wrote:
> 
> Using the example from the wiki
> https://wiki.contextgarden.net/textext_positioning
> 
> then using the latest version of lmtx
> 
> $ context --version
> mtx-context | ConTeXt Process Management 1.04
> mtx-context |
> mtx-context | main context file: 
> /home/vm/context/tex/texmf-context/tex/context/base/mkiv/context.mkiv
> mtx-context | current version: 2021.05.20 16:06
> mtx-context | main context file: 
> /home/vm/context/tex/texmf-context/tex/context/base/mkxl/context.mkxl
> mtx-context | current version: 2021.05.20 16:06
> 
> 
> it will produce an error (and an empty page)
> 
> 
> metapost> initializing instance 'metafun:1' using format 'metafun' 
> and method 'default'
> metapost> loading 'metafun' as 'metafun.mpxl' using method 'default'
> metapost> initializing number mode 'scaled'
> metafun > log >
> metafun > log > error: Unknown relation will be considered false
> metafun > log >
> metapost> log >
> metapost> log > 
> metapost> log >)
> metapost> log > 
> thetextext->...FIX2)(rawtextext(ddecimal(EXPR3)),(EXPR4))else:if.anchortextexts>0:image(draw(EXPR3)withprescript"tx_anchor="(EXPR4))else:(EXPR3)fi.if(mfun_labtype(SUFFIX2)>=10)
> metapost> log > :shifted(0,y...
> metapost> log > 
> thetextext->begingroup.if.string(EXPR3):thetextext(SUFFIX2)(rawtextext((EXPR3)),(EXPR4))
> metapost> log > 
> elseif.numeric(EXPR3):thetextext(SUFFIX2)(rawtextext(decimal(EXPR3)),(EXPR4))elseif.pair(EXPR3):thetextext(SU...
> metapost> log > 
> textext->begingroup.thetextext(SUFFIX2)((EXPR3),origin)
> metapost> log >   endgroup
> metapost> log > <*> ...A; draw PA withpen pencircle scaled 1.5mm 
> withcolor red; pair PB ; PB := PA shifted decal ; draw textext.drt ("DRT-" & 
> MonTexte) shifted PB; draw textext.dflt("DFLT-" & MonTexte)
> metafun > log >
> metafun > log > Oh dear. I can't decide if the expression above is 
> positive, negative, or zero.
> So this comparison test won't be 'true'.
> 
> 
> 
> 
> As in most of the cases with software, there is (probably) a reason to it ;-)
> 
> 
> .F
> ___
> If your question is of interest to others as well, please add an entry to the 
> Wiki!
> 
> maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
> webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
> archive  : https://bitbucket.org/phg/context-mirror/commits/
> wiki : http://contextgarden.net
> ___

— 
Taco Hoekwater  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 / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] metafun / patterns

2021-03-25 Thread Aditya Mahajan
On Thu, 25 Mar 2021, Hans Hagen wrote:

> Hi,
> 
> As I'm still in metafun (and svg) mode I decided to support patterns 
> (that are already supported at the tex end) also in metafun. As there 
> has never been demands I suppose it's not that interesting but it sort 
> of fits in.
> 
> There are some tricky aspectx involved so the interface might evolve a 
> bit (some more control options) but here are some examples anyway:

This is nice! I have used something like this in the past (but with "manual 
clipping", which is always cumbersome for irregular shapes).

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

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] metafun / patterns

2021-03-25 Thread mf
Sorry for the noise, my fault: Thunderbird replaced some semicolon 
combinations with emojis, so they were missing when I copied and pasted 
them in a source file.


Massi

Il 25/03/21 15:14, mf ha scritto:

Il 25/03/21 14:11, Hans Hagen ha scritto:


\startMPpage[offset=1cm]
 draw (fullcircle scaled 5cm shifted (0cm,0cm))
 withpattern image (fill fullcircle scaled 1cm withcolor 
"darkblue" ;)

 withpatternscale (1/10,1/10)
 ;

 draw (fullcircle scaled 5cm shifted (5cm,0cm))
 withpattern image (fill fullcircle scaled 5mm withcolor 
"darkred" ;)

 withpatternscale (1/20,1/20)
 ;

 draw (fullcircle scaled 5cm shifted (10cm,0cm))
 withpattern image (fill fullcircle scaled 5mm withcolor 
"darkgreen" ;)

 withpatternscale (1/40,1/40)
 ;

 draw (fullcircle scaled 5cm shifted (0cm,5cm))
 withpattern image (fill fullcircle scaled 1cm withcolor 
"darkcyan" ;)

 withpatternscale (1/10,1/20)
 ;

 draw (fullcircle scaled 5cm shifted (5cm,5cm))
 withpattern image (fill fullcircle scaled 5mm withcolor 
"darkmagenta" ;)

 withpatternscale (1/20,1/40)
 ;

 draw (fullcircle scaled 5cm shifted (10cm,5cm))
 withpattern image (fill fullcircle scaled 5mm withcolor 
"darkyellow" ;)

 withpatternscale (1/40,1/80)
 ;
\stopMPpage

\startMPpage[offset=1cm]
 fill fullcircle scaled 11cm
 withcolor "darkyellow" ;

 draw fullcircle scaled 10cm
 withpattern image (fill fullcircle scaled 1cm withcolor 
"darkblue" ;)

 ;

 draw fulldiamond scaled 8cm
 withpattern image (fill fulldiamond scaled 4mm withcolor 
"darkgreen" ;)

 rotated 15
 ;

 draw fulltriangle scaled 9cm
 withpattern image (fill fulltriangle scaled 3mm withcolor 
"white" ;)

 rotated 45
 ;

 draw fullcircle scaled 10cm
 withpattern image (draw textext("!") withcolor "middlegray" ;)
 rotated 45
 ;

 draw fullcircle scaled 10cm
 withpen pencircle scaled 1mm
 withcolor "darkgray" ;
\stopMPpage



Those first two pages appear 20x20mm and blank.

Page 3 and 4 show patterns instead.

Massi
___ 

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


maillist : ntg-context@ntg.nl / 
http://www.ntg.nl/mailman/listinfo/ntg-context

webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___ 


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

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] metafun / patterns

2021-03-25 Thread mf

Il 25/03/21 14:11, Hans Hagen ha scritto:


\startMPpage[offset=1cm]
     draw (fullcircle scaled 5cm shifted (0cm,0cm))
     withpattern image (fill fullcircle scaled 1cm withcolor 
"darkblue" ;)

     withpatternscale (1/10,1/10)
     ;

     draw (fullcircle scaled 5cm shifted (5cm,0cm))
     withpattern image (fill fullcircle scaled 5mm withcolor 
"darkred" ;)

     withpatternscale (1/20,1/20)
     ;

     draw (fullcircle scaled 5cm shifted (10cm,0cm))
     withpattern image (fill fullcircle scaled 5mm withcolor 
"darkgreen" ;)

     withpatternscale (1/40,1/40)
     ;

     draw (fullcircle scaled 5cm shifted (0cm,5cm))
     withpattern image (fill fullcircle scaled 1cm withcolor 
"darkcyan" ;)

     withpatternscale (1/10,1/20)
     ;

     draw (fullcircle scaled 5cm shifted (5cm,5cm))
     withpattern image (fill fullcircle scaled 5mm withcolor 
"darkmagenta" ;)

     withpatternscale (1/20,1/40)
     ;

     draw (fullcircle scaled 5cm shifted (10cm,5cm))
     withpattern image (fill fullcircle scaled 5mm withcolor 
"darkyellow" ;)

     withpatternscale (1/40,1/80)
     ;
\stopMPpage

\startMPpage[offset=1cm]
     fill fullcircle scaled 11cm
     withcolor "darkyellow" ;

     draw fullcircle scaled 10cm
     withpattern image (fill fullcircle scaled 1cm withcolor 
"darkblue" ;)

     ;

     draw fulldiamond scaled 8cm
     withpattern image (fill fulldiamond scaled 4mm withcolor 
"darkgreen" ;)

     rotated 15
     ;

     draw fulltriangle scaled 9cm
     withpattern image (fill fulltriangle scaled 3mm withcolor 
"white" ;)

     rotated 45
     ;

     draw fullcircle scaled 10cm
     withpattern image (draw textext("!") withcolor "middlegray" ;)
     rotated 45
     ;

     draw fullcircle scaled 10cm
     withpen pencircle scaled 1mm
     withcolor "darkgray" ;
\stopMPpage



Those first two pages appear 20x20mm and blank.

Page 3 and 4 show patterns instead.

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

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] metafun

2021-02-20 Thread Hans Hagen

On 2/20/2021 6:43 PM, Otared Kavian wrote:


Thanks for the new upload.

For your information, I would like to report that the metafun.tex file typesets 
almost corretly (actually I often typeset it for testing a new upload…) but I 
get a PDF with 400 pages instead the 448 you are mentionning…
The issues are typically some figures not showing up (for instance figures 13.1 
upto 13.13 in chapter 13).

If you think this may be useful for you, I can send you off list the PDF I get 
on MacOS 10.14.6 and today's release of LMTX.
Did you check the log? Does some graphic fail? The missing pages can be 
the summary chapter (due to just one run).


Hans


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

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] metafun

2021-02-20 Thread Otared Kavian
Hi Hans,

Thanks for the new upload.

For your information, I would like to report that the metafun.tex file typesets 
almost corretly (actually I often typeset it for testing a new upload…) but I 
get a PDF with 400 pages instead the 448 you are mentionning…
The issues are typically some figures not showing up (for instance figures 13.1 
upto 13.13 in chapter 13).

If you think this may be useful for you, I can send you off list the PDF I get 
on MacOS 10.14.6 and today's release of LMTX.

Best regards: Otared

> On 20 Feb 2021, at 17:27, Hans Hagen  wrote:
> 
> Hi,
> 
> When making sure that the metafun manual processes with lmtx (where we have 
> sometimes different implementations of macros) I also checked performance.
> 
> When we started with this manual, it was still MKII time so we either had 
> direct calls or inbetween calls. Especially multiple runs could take a while 
> (many minutes, iir some 15 depending on how it was run). That was no fun.
> 
> In mkiv with luatex and the built in mp library this dramatically went down 
> to 18.1 seconds for one run and 14.2 seconds for luajittex, for 428
> pages.
> 
> This not bad considering that a lots of features are used: thousands of mp 
> images, a bunch of external images, many fonts, plenty of buffers, 
> positioning, color, hyperlinks, backgrounds etc. This document uses plenty of 
> lua so that is why we gain a lot with luajittex.
> 
> In lmtx where we dropped jit and have a less performing backend we expect to 
> need more runtime but in the meantime we're quite okay. Not only the engine 
> is faster, but also some low level macros benefit a bit from new features. I 
> don't know how much lua speedup plays a role but probably not that much. For 
> 448 pages (some 20 more than we had before) we now need 16.5 seconds and 15.7 
> when we use the compact font mode. So we're halfway between luatex and 
> luajittex now. More than 3 seconds of the runtime is for metapost. (I use the 
>  machine as before.)
> 
> Hans
> 
> PS. If all the stories are true is should be 1 second on a modern apple at 
> which point differences in measurements become noise but I cannot check that. 
> Some day I might check it on a rpi 4.
> 
> -
>  Hans Hagen | PRAGMA ADE
>  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
>   tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
> -
> ___
> If your question is of interest to others as well, please add an entry to the 
> Wiki!
> 
> maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
> webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
> archive  : https://bitbucket.org/phg/context-mirror/commits/
> wiki : http://contextgarden.net
> ___

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

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] MetaFun labels and xsized

2020-12-25 Thread Pablo Rodriguez
On 12/25/20 10:09 PM, Hans Hagen wrote:
>> [...]
> \startMPcode
>  path p ; p := (
>  ( 1,  1) --
>  ( 1,  5) --
>  (10, 10) --
>  (14,  4) --
>  cycle) xsized .75TextWidth;
>
>  draw p ;
>
>  freelabel("\strut α",point 0 of p,center p) ;
>  freelabel("\strut β",point 1 of p,center p) ;
>  freelabel("\strut γ",point 2 of p,center p) ;
>  freelabel("\strut δ",point 3 of p,center p) ;
> \stopMPcode

Many thanks for your code, Hans.

This is exactly what I need.

Pablo
--
http://www.ousia.tk
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] MetaFun labels and xsized

2020-12-25 Thread Hans Hagen

On 12/25/2020 6:36 PM, Fabrice L wrote:

Hi,


Le 25 déc. 2020 à 12:30, Pablo Rodriguez  a écrit :

Dear list,

I have this minimal MetaFun sample (the only one in my real document):

  \setupbodyfont[pagella]
  \starttext
  \startMPcode
  pair a ; a := (1, 1) ;
  pair b ; b := (1, 10) ;
  pair c ; c := (10, 10) ;
  pair d ; d := (10, 1) ;
  draw (a--b--c--d--a) xsized .75TextWidth;

  draw thelabel.lft("α",a) ;
  draw thelabel.lft("β",b) ;
  draw thelabel.top("γ",c) ;
  draw thelabel.rt("δ",d) ;
  \stopMPcode
  \stoptext

Is there a way to relate adapt the labels to the xsized positions used?


I’m sure somebody could find a more elegant solution, but here is a simple one:

  \setupbodyfont[pagella]
  \starttext
  \startMPcode
  pair a ; a := (1, 1) ;
  pair b ; b := (1, 10) ;
  pair c ; c := (10, 10) ;
  pair d ; d := (10, 1) ;
  path square ;
  square := (a--b--c--d--cycle) xsized .75TextWidth ;
  
  draw square xsized .75TextWidth;


  draw thelabel.lft("α",point 0 of square) ;
  draw thelabel.lft("β",point 1 of square) ;
  draw thelabel.top("γ",point 2 of square) ;
  draw thelabel.rt("δ",point 3 of square) ;
  \stopMPcode
  \stoptext

Fabrice.


\startMPcode
path p ; p := (
( 1,  1) --
( 1,  5) --
(10, 10) --
(14,  4) --
cycle) xsized .75TextWidth;

draw p ;

freelabel("\strut α",point 0 of p,center p) ;
freelabel("\strut β",point 1 of p,center p) ;
freelabel("\strut γ",point 2 of p,center p) ;
freelabel("\strut δ",point 3 of p,center p) ;
\stopMPcode


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

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] MetaFun labels and xsized

2020-12-25 Thread Pablo Rodriguez
On 12/25/20 6:36 PM, Fabrice L wrote:
>> I have this minimal MetaFun sample (the only one in my real document):
>> [...]
>> Is there a way to relate adapt the labels to the xsized positions used?
>
> I’m sure somebody could find a more elegant solution, but here is a simple 
> one:
>
>  \setupbodyfont[pagella]
>  \starttext
>  \startMPcode
>  pair a ; a := (1, 1) ;
>  pair b ; b := (1, 10) ;
>  pair c ; c := (10, 10) ;
>  pair d ; d := (10, 1) ;
>  path square ;
>  square := (a--b--c--d--cycle) xsized .75TextWidth ;
>
>  draw square xsized .75TextWidth;
>
>  draw thelabel.lft("α",point 0 of square) ;
>  draw thelabel.lft("β",point 1 of square) ;
>  draw thelabel.top("γ",point 2 of square) ;
>  draw thelabel.rt("δ",point 3 of square) ;
>  \stopMPcode
>  \stoptext

Many thanks for your ultra-fast reply, Fabrice.

I didn’t know that paths could be also defined (MP is all Greek to me).

I realized that drawing doesn’t require resizing again (once the path
definition contains resizing).

Many thanks for your help,

Pablo
--
http://www.ousia.tk
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] MetaFun labels and xsized

2020-12-25 Thread Fabrice L
Hi,

> Le 25 déc. 2020 à 12:30, Pablo Rodriguez  a écrit :
> 
> Dear list,
> 
> I have this minimal MetaFun sample (the only one in my real document):
> 
>  \setupbodyfont[pagella]
>  \starttext
>  \startMPcode
>  pair a ; a := (1, 1) ;
>  pair b ; b := (1, 10) ;
>  pair c ; c := (10, 10) ;
>  pair d ; d := (10, 1) ;
>  draw (a--b--c--d--a) xsized .75TextWidth;
> 
>  draw thelabel.lft("α",a) ;
>  draw thelabel.lft("β",b) ;
>  draw thelabel.top("γ",c) ;
>  draw thelabel.rt("δ",d) ;
>  \stopMPcode
>  \stoptext
> 
> Is there a way to relate adapt the labels to the xsized positions used?

I’m sure somebody could find a more elegant solution, but here is a simple one:

 \setupbodyfont[pagella]
 \starttext
 \startMPcode
 pair a ; a := (1, 1) ;
 pair b ; b := (1, 10) ;
 pair c ; c := (10, 10) ;
 pair d ; d := (10, 1) ;
 path square ; 
 square := (a--b--c--d--cycle) xsized .75TextWidth ;
 
 draw square xsized .75TextWidth;

 draw thelabel.lft("α",point 0 of square) ;
 draw thelabel.lft("β",point 1 of square) ;
 draw thelabel.top("γ",point 2 of square) ;
 draw thelabel.rt("δ",point 3 of square) ;
 \stopMPcode
 \stoptext

Fabrice.

> 
> Many thanks for your help,
> 
> Pablo
> --
> http://www.ousia.tk
> ___
> If your question is of interest to others as well, please add an entry to the 
> Wiki!
> 
> maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
> webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
> archive  : https://bitbucket.org/phg/context-mirror/commits/
> wiki : http://contextgarden.net
> ___

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

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] MetaFun - "remove the paths of text" from a rectangle to let the background visible

2020-12-24 Thread Garulfo

Much more lean now thanks to your feedbacks.

I prefered to "remove the shapes of the letter"
rather than doubling the shading.


Wikified https://wiki.contextgarden.net/Cover_Pages#.22Empty.22_letters





\definecolor [ColorHighA] [h=c4a000]
\definecolor [ColorHighB] [h=602217]
\definecolor [ColorLow] [0.8(white)]

\startMPpage

%-- 



  picture tt ;
  tt := lmt_outline [
kind = "fillup",
text = "\definedfont[name:texgyrepagellabold*default]%
\framed[frame=off,offset=3mm,align=middle,strut=none]
{MetaPost\\is Fun !\\Aujourd'hui\\Today\\*§ 2020 §*}",
] xsized 12cm ;

  path bb ; bb := boundingbox tt;

%-- 



  path pp ; pp := bb enlarged 2cm ;
  fill pp
   withshademethod "linear"
   withshadedirection (2.,0.)
   withshadecolors (\MPcolor{ColorHighA}, \MPcolor{ColorHighB});

%-- 



  picture Paddmissing; Paddmissing := nullpicture;
  picture Pwoletters; Pwoletters := nullpicture;
  numeric testwithin ;

%-- 



  for i within tt :

if stroked i or filled i :
  testwithin :=0;

  for j within tt :
if stroked j or filled j:
  if (((xpart llcorner i) > (xpart llcorner j)) and
  ((ypart llcorner i) > (ypart llcorner j)) and
  ((xpart urcorner i) < (xpart urcorner j)) and
  ((ypart urcorner i) < (ypart urcorner j))) :
  testwithin :=1;
  fi;
fi;
  endfor;

  if testwithin == 1:
addto Paddmissing contour
  (pathpart i)
  withcolor \MPcolor{ColorLow};
  else:
addto Pwoletters contour
  (pathpart i)
  withpostscript "collect";
  fi;

fi ;
  endfor ;

%-- 



  addto Pwoletters contour
bb
withpostscript "evenodd"
withcolor \MPcolor{ColorLow};
  draw Pwoletters ;
  draw Paddmissing ;

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

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] MetaFun - "remove the paths of text" from a rectangle to let the background visible

2020-12-24 Thread Taco Hoekwater


> On 24 Dec 2020, at 00:14, Garulfo  wrote:
> 
> Thanks Taco,
> 
> I made some progress :
> https://wiki.contextgarden.net/Talk:Cover_Pages
> 
> I now have two additional questions ... ;-)
> 
> - How can I deal with "space" characters (because current solution
>  requires to explicitly add the ~ character)

Here’s what I would do (which is probably not the nicest way of doing it). Just
enable \obeyspaces while reading the argument to \EmptyLetters, then disable
it again immediately (that is needed if you have to go back to TeX from Lua):

\def\EmptyLetters
 {\obeyspaces\doEmptyLetters}

\def\doEmptyLetters#1%
  {\normalspaces
   ...
  }

and in \whatever you then need \doifinstringelse{ }{#1}

Best wishes,
Taco

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

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] MetaFun - "remove the paths of text" from a rectangle to let the background visible

2020-12-23 Thread Hans Hagen

On 12/24/2020 12:46 AM, Otared Kavian wrote:

Hi Garulfo,

Thank you for sharing your nice example: it typesets correctly with mkiv, but 
it seems to me that with LMTX the text does not appear (at least on my 
installation of the latest LMTX).

I admit that I had to trial and error this:

\startMPpage
picture tt ; tt := lmt_outline [
kind  = "fillup",
text  = "\strut foo f o o",
drawcolor = "white",
rulethickness = .2
] ysized 5cm ;

path bb ; bb := boundingbox tt;
path pp ; pp := bb enlarged 3cm ;

fill pp
withshademethod "linear"
withshadedirection down
withshadecolors (red, blue)
;

fill bb withcolor "darkgray" ;

for i within tt :
if stroked i :
nofill (pathpart i)
;
fi ;
dofill bb
withshademethod "linear"
withshadedirection down
withshadecolors (red, blue)
;
endfor ;
\stopMPpage

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

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] MetaFun - "remove the paths of text" from a rectangle to let the background visible

2020-12-23 Thread Hans Hagen

On 12/24/2020 12:14 AM, Garulfo wrote:

Thanks Taco,

I made some progress :
https://wiki.contextgarden.net/Talk:Cover_Pages

I now have two additional questions ... ;-)

- How can I deal with "space" characters (because current solution
   requires to explicitly add the ~ character)

- What would be the work to do in order to make this mechanism directly
   usable in metapost / metafun, within \startMPpage \stopMPpage,
   - to avoid switching between \start\stopMPdrawing and TeX
   - to have something like "draw followtext" in mp-blob.mpiv ?



Maybe pickup some tricks from this:

\starttext

\startMPpage
StartPage;

fill Page
   withshademethod "linear"
   withshadedirection(0,1)
   withshadecolors (red, blue) ;

picture p ; p := lmt_outline [
text  = "\strut foo f o o",
drawcolor = "white",
rulethickness = .2
] ysized 5cm ;

draw (p shifted - center p) shifted center Page;

StopPage;
\stopMPpage

\startuseMPgraphic{MyShade}
fill OverlayBox
   withshademethod "linear"
   withshadedirection(0,1)
   withshadecolors (red, blue) ;
\stopuseMPgraphic

\defineoverlay[MyShade][\useMPgraphic{MyShade}]

\setupbackgrounds[page][background=MyShade]

\startmakeup

\definedfont[SerifBold*default @ 50pt] \setupinterlinespace

\defineeffect[MyOutline][alternative=outer,rulethickness=1pt]

\startcolor[white]
\starteffect[MyOutline]
\input jojomayer
\stopeffect
\stopcolor

\stopmakeup

\stoptext

%-- 



\setuppapersize  [A4]

%-- 



\def\MyFont{\definedfont[name:%
texgyrepagellabold%
%exo2black%
%agaramondprobold%
*default at 55pt]}

%-- 



\startluacode

function document.outlinepaths(character)
     local chardata  = fonts.hashes.characters[true] -- by unicode
     local shapedata = fonts.hashes.shapes[true] -- by index
     local c = chardata[character]
     if c and c.index and shapedata then
     local shapeglyphs = shapedata.glyphs or { }
     local glyph   = shapeglyphs[c.index]
     if glyph and (glyph.segments or glyph.sequence) then
     local units  = shapedata.units or 1000
     local factor = 100/units
     return fonts.metapost.paths(glyph,factor)
     end
     end
     return { }
end

function document.defineoutline(char,target)
     local outlines = document.outlinepaths(char)
     local nofpaths = #outlines
     context("\\startMPdrawing") -- ADDED by 
garulfo

     context("path %s[] ;",target)
     context("numeric %sn ; %sn := %s ;",target,target,nofpaths)
     for i=1,nofpaths do
     context("%s[%i] := %s ; ",target,i,outlines[i])
     end
     context("\\stopMPdrawing")  -- ADDED by 
garulfo

end

\stopluacode

%-- 



\def\mpdefineoutlines#1#2{\ctxlua{document.defineoutline(\number`#1,"#2")}}

%-- 



\def\EmptyLetters#1%
{%
\resetMPdrawing
\MPtoks={}
%
\startMPdrawing
   picture pic[], pictA ;
   numeric wid[], len[], pos[], n ;
   wid[0] := len[0] := pos[0] := n := 0 ;
   numeric scaling;
   path pictB , frame ;
   pair shiftB ;
   picture monImageA; monImageA := nullpicture;
   picture monImageB; monImageB := nullpicture;
   color colorframe;  colorframe := 0.6white;
%
\stopMPdrawing
%
\MyFont\handletokens#1\with\whatever
%
\startMPdrawing
   frame :=  unitsquare
   xscaled ( (xpart urcorner monImageB - xpart llcorner 
monImageB) + 5mm )
   yscaled ( (ypart urcorner monImageB - ypart llcorner 
monImageB) + 5mm );

   frame := frame shifted (center monImageB - center frame);
   addto monImageB contour
     frame
     withpostscript "evenodd"
     withcolor transparent (1,1.,colorframe);
   draw monImageB ;
   draw monImageA ;
\stopMPdrawing
%
\MPdrawingdonetrue
\getMPdrawing}

%-- 



\def\whatever#1%
   {\appendtoks#1\to\MPtoks
    \setbox\MPbox=\hbox{\MyFont\the\MPtoks}%
    %
    \startMPdrawing
  n := n + 1 ; len[n] := \the\wd\MPbox ;
    \stopMPdrawing
    %
    \mpdefineoutlines{M}{MaLettre}
    %
    \startMPdrawing
    pictA := textext.drt("\MyFont M") ;
    pictB := MaLettre[1];
    scaling := bbheight pictA / bbheight pictB;
    \stopMPdrawing
    %
    \doifinstringelse{~}{#1}{}{%    HOW TO PROPERLY COPE 
WITH SPACES ?

    \mpdefineoutlines{#1}{MyGlyph}
    %
    \startMPdrawing
  string sb; sb := "i";
  pic[n] := textext.drt("\MyFont\setstrut\strut#1") ;
  %
  shiftB := - llcorner pic[n];
  

Re: [NTG-context] MetaFun - "remove the paths of text" from a rectangle to let the background visible

2020-12-23 Thread Otared Kavian
Hi Garulfo,

Thank you for sharing your nice example: it typesets correctly with mkiv, but 
it seems to me that with LMTX the text does not appear (at least on my 
installation of the latest LMTX).

Best regards: Otared

> On 24 Dec 2020, at 00:14, Garulfo  wrote:
> 
> Thanks Taco,
> 
> I made some progress :
> https://wiki.contextgarden.net/Talk:Cover_Pages
> 
> I now have two additional questions ... ;-)
> 
> - How can I deal with "space" characters (because current solution
>  requires to explicitly add the ~ character)
> 
> - What would be the work to do in order to make this mechanism directly
>  usable in metapost / metafun, within \startMPpage \stopMPpage,
>  - to avoid switching between \start\stopMPdrawing and TeX
>  - to have something like "draw followtext" in mp-blob.mpiv ?
> 
> 
> 
> %--
> 
> \setuppapersize  [A4]
> 
> %--
> 
> \def\MyFont{\definedfont[name:%
> texgyrepagellabold%
> %exo2black%
> %agaramondprobold%
> *default at 55pt]}
> 
> %--
> 
> \startluacode
> 
> function document.outlinepaths(character)
>local chardata  = fonts.hashes.characters[true] -- by unicode
>local shapedata = fonts.hashes.shapes[true] -- by index
>local c = chardata[character]
>if c and c.index and shapedata then
>local shapeglyphs = shapedata.glyphs or { }
>local glyph   = shapeglyphs[c.index]
>if glyph and (glyph.segments or glyph.sequence) then
>local units  = shapedata.units or 1000
>local factor = 100/units
>return fonts.metapost.paths(glyph,factor)
>end
>end
>return { }
> end
> 
> function document.defineoutline(char,target)
>local outlines = document.outlinepaths(char)
>local nofpaths = #outlines
>context("\\startMPdrawing") -- ADDED by garulfo
>context("path %s[] ;",target)
>context("numeric %sn ; %sn := %s ;",target,target,nofpaths)
>for i=1,nofpaths do
>context("%s[%i] := %s ; ",target,i,outlines[i])
>end
>context("\\stopMPdrawing")  -- ADDED by garulfo
> end
> 
> \stopluacode
> 
> %--
> 
> \def\mpdefineoutlines#1#2{\ctxlua{document.defineoutline(\number`#1,"#2")}}
> 
> %--
> 
> \def\EmptyLetters#1%
> {%
> \resetMPdrawing
> \MPtoks={}
> %
> \startMPdrawing
>  picture pic[], pictA ;
>  numeric wid[], len[], pos[], n ;
>  wid[0] := len[0] := pos[0] := n := 0 ;
>  numeric scaling;
>  path pictB , frame ;
>  pair shiftB ;
>  picture monImageA; monImageA := nullpicture;
>  picture monImageB; monImageB := nullpicture;
>  color colorframe;  colorframe := 0.6white;
> %
> \stopMPdrawing
> %
> \MyFont\handletokens#1\with\whatever
> %
> \startMPdrawing
>  frame :=  unitsquare
>  xscaled ( (xpart urcorner monImageB - xpart llcorner monImageB) + 
> 5mm )
>  yscaled ( (ypart urcorner monImageB - ypart llcorner monImageB) + 
> 5mm );
>  frame := frame shifted (center monImageB - center frame);
>  addto monImageB contour
>frame
>withpostscript "evenodd"
>withcolor transparent (1,1.,colorframe);
>  draw monImageB ;
>  draw monImageA ;
> \stopMPdrawing
> %
> \MPdrawingdonetrue
> \getMPdrawing}
> 
> %--
> 
> \def\whatever#1%
>  {\appendtoks#1\to\MPtoks
>   \setbox\MPbox=\hbox{\MyFont\the\MPtoks}%
>   %
>   \startMPdrawing
> n := n + 1 ; len[n] := \the\wd\MPbox ;
>   \stopMPdrawing
>   %
>   \mpdefineoutlines{M}{MaLettre}
>   %
>   \startMPdrawing
>   pictA := textext.drt("\MyFont M") ;
>   pictB := MaLettre[1];
>   scaling := bbheight pictA / bbheight pictB;
>   \stopMPdrawing
>   %
>   \doifinstringelse{~}{#1}{}{%HOW TO PROPERLY COPE WITH 
> SPACES ?
>   \mpdefineoutlines{#1}{MyGlyph}
>   %
>   \startMPdrawing
> string sb; sb := "i";
> pic[n] := textext.drt("\MyFont\setstrut\strut#1") ;
> %
> shiftB := - llcorner pic[n];
> pic[n] := pic[n] shifted shiftB ;
> %
> wid[n] := abs(xpart urcorner pic[n] - xpart llcorner pic[n]) ;
> pos[n] := len[n]-wid[n] ;
> %
> addto monImageB contour
>   ((MyGlyph[1] scaled scaling)
>   shifted ( (pos[n],0) +  shiftB))
>   withpostscript "collect";
> %
> if MyGlyphn > 1 :
>for ind=2 upto MyGlyphn :
>if (((xpart llcorner MyGlyph[ind]) > (xpart llcorner MyGlyph[1])) 
> and
>((ypart llcorner MyGlyph[ind]) > (ypart llcorner MyGlyph[1])) 
> and
>((xpart urcorner MyGlyph[ind]) < (xpart urcorner MyGlyph[1])) 
> and
>((ypart urcorner MyGlyph[ind]) < (ypart 

Re: [NTG-context] MetaFun - "remove the paths of text" from a rectangle to let the background visible

2020-12-23 Thread Garulfo

Thanks Taco,

I made some progress :
https://wiki.contextgarden.net/Talk:Cover_Pages

I now have two additional questions ... ;-)

- How can I deal with "space" characters (because current solution
  requires to explicitly add the ~ character)

- What would be the work to do in order to make this mechanism directly
  usable in metapost / metafun, within \startMPpage \stopMPpage,
  - to avoid switching between \start\stopMPdrawing and TeX
  - to have something like "draw followtext" in mp-blob.mpiv ?



%--

\setuppapersize  [A4]

%--

\def\MyFont{\definedfont[name:%
texgyrepagellabold%
%exo2black%
%agaramondprobold%
*default at 55pt]}

%--

\startluacode

function document.outlinepaths(character)
local chardata  = fonts.hashes.characters[true] -- by unicode
local shapedata = fonts.hashes.shapes[true] -- by index
local c = chardata[character]
if c and c.index and shapedata then
local shapeglyphs = shapedata.glyphs or { }
local glyph   = shapeglyphs[c.index]
if glyph and (glyph.segments or glyph.sequence) then
local units  = shapedata.units or 1000
local factor = 100/units
return fonts.metapost.paths(glyph,factor)
end
end
return { }
end

function document.defineoutline(char,target)
local outlines = document.outlinepaths(char)
local nofpaths = #outlines
context("\\startMPdrawing") -- ADDED by 
garulfo

context("path %s[] ;",target)
context("numeric %sn ; %sn := %s ;",target,target,nofpaths)
for i=1,nofpaths do
context("%s[%i] := %s ; ",target,i,outlines[i])
end
context("\\stopMPdrawing")  -- ADDED by 
garulfo

end

\stopluacode

%--

\def\mpdefineoutlines#1#2{\ctxlua{document.defineoutline(\number`#1,"#2")}}

%--

\def\EmptyLetters#1%
{%
\resetMPdrawing
\MPtoks={}
%
\startMPdrawing
  picture pic[], pictA ;
  numeric wid[], len[], pos[], n ;
  wid[0] := len[0] := pos[0] := n := 0 ;
  numeric scaling;
  path pictB , frame ;
  pair shiftB ;
  picture monImageA; monImageA := nullpicture;
  picture monImageB; monImageB := nullpicture;
  color colorframe;  colorframe := 0.6white;
%
\stopMPdrawing
%
\MyFont\handletokens#1\with\whatever
%
\startMPdrawing
  frame :=  unitsquare
  xscaled ( (xpart urcorner monImageB - xpart llcorner 
monImageB) + 5mm )
  yscaled ( (ypart urcorner monImageB - ypart llcorner 
monImageB) + 5mm );

  frame := frame shifted (center monImageB - center frame);
  addto monImageB contour
frame
withpostscript "evenodd"
withcolor transparent (1,1.,colorframe);
  draw monImageB ;
  draw monImageA ;
\stopMPdrawing
%
\MPdrawingdonetrue
\getMPdrawing}

%--

\def\whatever#1%
  {\appendtoks#1\to\MPtoks
   \setbox\MPbox=\hbox{\MyFont\the\MPtoks}%
   %
   \startMPdrawing
 n := n + 1 ; len[n] := \the\wd\MPbox ;
   \stopMPdrawing
   %
   \mpdefineoutlines{M}{MaLettre}
   %
   \startMPdrawing
   pictA := textext.drt("\MyFont M") ;
   pictB := MaLettre[1];
   scaling := bbheight pictA / bbheight pictB;
   \stopMPdrawing
   %
   \doifinstringelse{~}{#1}{}{%HOW TO PROPERLY COPE 
WITH SPACES ?

   \mpdefineoutlines{#1}{MyGlyph}
   %
   \startMPdrawing
 string sb; sb := "i";
 pic[n] := textext.drt("\MyFont\setstrut\strut#1") ;
 %
 shiftB := - llcorner pic[n];
 pic[n] := pic[n] shifted shiftB ;
 %
 wid[n] := abs(xpart urcorner pic[n] - xpart llcorner pic[n]) ;
 pos[n] := len[n]-wid[n] ;
 %
 addto monImageB contour
   ((MyGlyph[1] scaled scaling)
   shifted ( (pos[n],0) +  shiftB))
   withpostscript "collect";
 %
 if MyGlyphn > 1 :
for ind=2 upto MyGlyphn :
if (((xpart llcorner MyGlyph[ind]) > (xpart llcorner 
MyGlyph[1])) and
((ypart llcorner MyGlyph[ind]) > (ypart llcorner 
MyGlyph[1])) and
((xpart urcorner MyGlyph[ind]) < (xpart urcorner 
MyGlyph[1])) and
((ypart urcorner MyGlyph[ind]) < (ypart urcorner 
MyGlyph[1]))) :

%
addto monImageA contour
  (MyGlyph[ind] scaled scaling)
  shifted ( (pos[n],0) +  shiftB)
  withcolor transparent (1,1.,colorframe);
else :
addto monImageB contour
  (MyGlyph[ind] scaled scaling)
  shifted ( (pos[n],0) +  shiftB)
  withpostscript "collect";
fi;
  

Re: [NTG-context] MetaFun - "remove the paths of text" from a rectangle to let the background visible

2020-12-21 Thread Taco Hoekwater


> On 21 Dec 2020, at 16:09, Garulfo  wrote:
> 
> Hi,
> 
> 
> * I try to "remove the paths of text" from a metapost pictures to let
>  the background visible.
> 
> * Using
>  https://mailman.ntg.nl/pipermail/ntg-context/2018/thread.html#92725
> 
> * I was able to get the following with one glyph (MVE code below)
> 
>  https://wiki.contextgarden.net/images/d/d2/test_extract_glyphs.pdf
> 
> 
> 2 questions:
> 
> 1/ for some fonts (e.g. dejavu vs latin modern) the "encompassing" path
>   of the B glyph can switch from B[1] to B[Bn]. Is there a trick to
>   identify which id match with "the encompassing" path ?

What you get is the order of the paths as defined in the font, which is 
arbitrary, as you discovered.

A quick trick (that will not always work, but should work quite well for font 
variations of alphabetics) is to check the actual arclength of the paths. The 
longest one will typically be the outer one. 

But much depends on the font, so a generic solution is likely quite 
complicated. Consider an outline font’s colon glyph ;)


> 
> 2/ now, I would like to do the same, but for text... a kind of
>   derivative of "textext" or "outlinetext".
>   Would you please give me some guidelines ?
>   does it already exist ?
>   should I use something like \handletokens, \scantokens ?
>   do you have examples where I can get inspiration ?
> 
> 
> Thanks again for your help,
> Garulfo
> 
> 
> %==
> 
> 
> 
> 
> \starttext
> 
> %--
> 
> \startluacode
> 
> function document.outlinepaths(character)
>local chardata  = fonts.hashes.characters[true] -- by unicode
>local shapedata = fonts.hashes.shapes[true] -- by index
>local c = chardata[character]
>if c and c.index and shapedata then
>local shapeglyphs = shapedata.glyphs or { }
>local glyph   = shapeglyphs[c.index]
>if glyph and (glyph.segments or glyph.sequence) then
>local units  = shapedata.units or 1000
>local factor = 100/units
>return fonts.metapost.paths(glyph,factor)
>end
>end
>return { }
> end
> 
> function document.defineoutline(char,target)
>local outlines = document.outlinepaths(char)
>local nofpaths = #outlines
>context("path %s[] ;",target)
>context("numeric %sn ; %sn := %s ;",target,target,nofpaths)
>for i=1,nofpaths do
>context("%s[%i] := %s ; ",target,i,outlines[i])
>end
> end
> 
> \stopluacode
> 
> %--
> 
> \def\mpdefineoutlines#1#2{\ctxlua{document.defineoutline(\number`#1,"#2")}}
> 
> %--
> 
> \startMPpage
> 
> numeric dimA ; dimA := 20cm;
> 
> path pathbackground ;
> pathbackground :=  unitsquare scaled dimA ;
> fill pathbackground withshademethod "linear" withshadedirection(0,1) 
> withshadecolors (red,blue);
> 
> %--
> 
> \mpdefineoutlines{B}{B}
> 
> %--
> 
> numeric dimB  ; dimB := 2cm;
> numeric vratio ; vratio := 2;
> 
> path frame ;
> frame :=  unitsquare
>  xscaled (dimA - 2 * dimB)
>  yscaled (dimA / vratio)
>  shifted (dimB , (dimA - (dimA / vratio))/2 );
> 
> %--
> 
> pair shift ; shift := center frame;
> numeric scal ; scal := (0.9) * (10cm / (bbheight B[1])) ;
> 
> picture monImageB; monImageB := nullpicture;
> addto monImageB contour
>  (B[1] shifted (- center B[1]) scaled scal)
>  shifted shift
>  withpostscript "collect";
> 
> addto monImageB contour
>  frame
>  withpostscript "evenodd";
> 
> for i=2 upto Bn :
>  addto monImageB contour
>(B[i] shifted (- center B[1]) scaled scal)
>shifted shift;
> endfor ;
> 
> %--
> 
> draw monImageB withcolor white;
> 
> \stopMPpage
> 
> \stoptext
> ___
> If your question is of interest to others as well, please add an entry to the 
> Wiki!
> 
> maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
> webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
> archive  : https://bitbucket.org/phg/context-mirror/commits/
> wiki : http://contextgarden.net
> ___

Taco Hoekwater
Elvenkind BV




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

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/

Re: [NTG-context] Metafun: is it possible to redefine dotlabel to draw a square ?

2020-12-10 Thread Hans Hagen

On 12/10/2020 8:37 PM, Aditya Mahajan wrote:

On Thu, 10 Dec 2020, Hans Hagen wrote:


dotlabel uses a pen to draw the dot, and I am not sure why it uses that rather
than a path. Here is a (to me) simpler definition, where you can change the
shape:


just look in the pdf ... in your case the dot is a n point path while otherwise
it uses the default postscript pen (which is a dot)


Ah, that makes sense.


it surprised me that a math guru like you doesn't do this:

vardef dotlabel@#(expr s,z) text t_ =
% draw textext("$\bullet$") scaled (1/2) shifted z ;
% draw textext("$\blacktriangle$") scaled (1/4) shifted z ;
 draw textext("$\blacksquare$") scaled (1/4) shifted z ;
 label@#(s,z) t_ ;
enddef ;
\stopMPdefinitions


Ha! I know that you said this as a joke, but as someone who did try to use the old 
font-based picture environment in LaTeX back in the day, I would never try to use fonts 
for "drawing". Especially, math fonts, where every designer has a different 
idea of what the shape should look like.

ah pictex memories ... drawing lines with cmr5 periods ...

but actually, we can define a stable font with symbols in metafun and 
use that (quite efficient too) and then one can even cut'n'paste those 
tiny symbols (don't worry ... not much of a challenge so low on my list)


Hans


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

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] Metafun: is it possible to redefine dotlabel to draw a square ?

2020-12-10 Thread Aditya Mahajan
On Thu, 10 Dec 2020, Hans Hagen wrote:

> > dotlabel uses a pen to draw the dot, and I am not sure why it uses that 
> > rather
> > than a path. Here is a (to me) simpler definition, where you can change the
> > shape:
> 
> just look in the pdf ... in your case the dot is a n point path while 
> otherwise
> it uses the default postscript pen (which is a dot)

Ah, that makes sense. 

> it surprised me that a math guru like you doesn't do this:
> 
> vardef dotlabel@#(expr s,z) text t_ =
> % draw textext("$\bullet$") scaled (1/2) shifted z ;
> % draw textext("$\blacktriangle$") scaled (1/4) shifted z ;
> draw textext("$\blacksquare$") scaled (1/4) shifted z ;
> label@#(s,z) t_ ;
> enddef ;
> \stopMPdefinitions

Ha! I know that you said this as a joke, but as someone who did try to use the 
old font-based picture environment in LaTeX back in the day, I would never try 
to use fonts for "drawing". Especially, math fonts, where every designer has a 
different idea of what the shape should look like. 

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

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] Metafun: is it possible to redefine dotlabel to draw a square ?

2020-12-10 Thread Hans Hagen

On 12/10/2020 7:04 PM, Aditya Mahajan wrote:

On Thu, 10 Dec 2020, Otared Kavian wrote:


Hi Aditya,
Thank you very much !
That's great indeed, you gave me an elegant solution.
  
One more question, in order for me to understand a little more: when defining a new dotlabel as you do, might it not conflict with the internal definitions of dotlabel in Metafun in some other place?

Maybe it is safer for me to call it something like  « dotshapelabel » ?


In general, I agree. Redefining internal macros has the advantage that your 
code doesn't have to change. See, for example:


it depends a bit ... redefing dotlabel in a compatible way is kind of 
ok, but using/redefining \foo_bar_something_internal is a real bad idea 
as that is not part of the interface (okay, i know that there are macro 
packages out there where it's part of the concept to redefine low level 
stuff for styles but in context we should try to avoid it ... we should 
then adapt the high level interface to suport something)


it also depends who does it ... i know that aditya knows the internals 
well enough to deal with it


(one of my concerns is always that while we try to come up with 
efficient solutions it's easy to make things inefficient but that's not 
the case here ... unless of course we want to nurture the 'context is 
slow' meme)


Hans

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

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] Metafun: is it possible to redefine dotlabel to draw a square ?

2020-12-10 Thread Hans Hagen

On 12/10/2020 6:44 PM, Aditya Mahajan wrote:

On Thu, 10 Dec 2020, Otared Kavian wrote:


Hi all,

In Metafun when representing a point I woul dlike to have some dots represented 
by a square (or even by another scalable symbol): for instance in the following 
I would like the dot at the point B to be a square:

\starttext
\startMPcode
draw (2cm,3cm) -- (3cm,5cm) ;
dotlabel(textext("\switchtobodyfont[8pt]" & "A"), (2cm,3cm))
withpen pencircle scaled 12pt
withcolor transparent("exclusion",.5,red) ;

dotlabel(textext("\switchtobodyfont[8pt]" & "B"), (3cm,5cm))
withpen pencircle scaled 12pt
withcolor transparent("exclusion",.5,red) ;
\stopMPcode
\stoptext

I wonder whether it is possible to define something like « drawsquaredot » or « 
squaredotlabel » in order to do this.


dotlabel uses a pen to draw the dot, and I am not sure why it uses that rather 
than a path. Here is a (to me) simpler definition, where you can change the 
shape:


just look in the pdf ... in your case the dot is a n point path while 
otherwise it uses the default postscript pen (which is a dot)


actually fullcircle is pencircle so you can ponder why that is the case -)


\startMPdefinitions
newpath dotlabelshape;

dotlabelshape := fullcircle;

vardef dotlabel@#(expr s,z) text t_ =
 label@#(s,z) t_ ;
 fill (dotlabelshape scaled 2dotlabeldiam) shifted z t_;
enddef ;
\stopMPdefinitions

\starttext
\startMPcode
newpath p ;
p := (2cm, 3cm) -- (3cm, 5cm);
dotlabeldiam := 12pt;

% Default
draw p;
dotlabel(textext("\switchtobodyfont[8pt]" & "A"), point 0 of p)
 withcolor transparent("exclusion",.5,red) ;

dotlabel(textext("\switchtobodyfont[8pt]" & "B"), point 1 of p)
 withcolor transparent("exclusion",.5,red) ;

% Using a square "dot"
p := p shifted (5cm, 0);
dotlabelshape := fullsquare;

draw p;
dotlabel(textext("\switchtobodyfont[8pt]" & "A"), point 0 of p)
 withcolor transparent("exclusion",.5,red) ;

dotlabel(textext("\switchtobodyfont[8pt]" & "B"), point 1 of p)
 withcolor transparent("exclusion",.5,red) ;
\stopMPcode
\stoptext

These types of macros are also a good candidate for the new LMTX syntax, where 
we can make all components configurable via a key-value interface 
(labeldistance etc. as well).

it surprised me that a math guru like you doesn't do this:

vardef dotlabel@#(expr s,z) text t_ =
% draw textext("$\bullet$") scaled (1/2) shifted z ;
% draw textext("$\blacktriangle$") scaled (1/4) shifted z ;
draw textext("$\blacksquare$") scaled (1/4) shifted z ;
label@#(s,z) t_ ;
enddef ;
\stopMPdefinitions



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

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] Metafun: is it possible to redefine dotlabel to draw a square ?

2020-12-10 Thread Aditya Mahajan
On Thu, 10 Dec 2020, Otared Kavian wrote:

> Hi Aditya,
> Thank you very much !
> That's great indeed, you gave me an elegant solution.
>  
> One more question, in order for me to understand a little more: when defining 
> a new dotlabel as you do, might it not conflict with the internal definitions 
> of dotlabel in Metafun in some other place?
> Maybe it is safer for me to call it something like  « dotshapelabel » ?

In general, I agree. Redefining internal macros has the advantage that your 
code doesn't have to change. See, for example:

https://github.com/adityam/mp-sketch/blob/master/mp-sketch.mp

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

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] Metafun: is it possible to redefine dotlabel to draw a square ?

2020-12-10 Thread Otared Kavian
Hi Aditya,
Thank you very much !
That's great indeed, you gave me an elegant solution.
 
One more question, in order for me to understand a little more: when defining a 
new dotlabel as you do, might it not conflict with the internal definitions of 
dotlabel in Metafun in some other place?
Maybe it is safer for me to call it something like  « dotshapelabel » ?

Best regards and agin many thanks: Otared

> On 10 Dec 2020, at 18:44, Aditya Mahajan  wrote:
> 
> On Thu, 10 Dec 2020, Otared Kavian wrote:
> 
>> Hi all,
>> 
>> In Metafun when representing a point I woul dlike to have some dots 
>> represented by a square (or even by another scalable symbol): for instance 
>> in the following I would like the dot at the point B to be a square:
>> 
>> \starttext
>> \startMPcode
>> draw (2cm,3cm) -- (3cm,5cm) ;
>> dotlabel(textext("\switchtobodyfont[8pt]" & "A"), (2cm,3cm)) 
>>  withpen pencircle scaled 12pt 
>>  withcolor transparent("exclusion",.5,red) ;
>> 
>> dotlabel(textext("\switchtobodyfont[8pt]" & "B"), (3cm,5cm)) 
>>  withpen pencircle scaled 12pt 
>>  withcolor transparent("exclusion",.5,red) ;
>> \stopMPcode
>> \stoptext
>> 
>> I wonder whether it is possible to define something like « drawsquaredot » 
>> or « squaredotlabel » in order to do this.
> 
> dotlabel uses a pen to draw the dot, and I am not sure why it uses that 
> rather than a path. Here is a (to me) simpler definition, where you can 
> change the shape:
> 
> \startMPdefinitions
> newpath dotlabelshape;
> 
> dotlabelshape := fullcircle;
> 
> vardef dotlabel@#(expr s,z) text t_ =
>label@#(s,z) t_ ;
>fill (dotlabelshape scaled 2dotlabeldiam) shifted z t_;
> enddef ;
> \stopMPdefinitions
> 
> \starttext
> \startMPcode
> newpath p ; 
> p := (2cm, 3cm) -- (3cm, 5cm);
> dotlabeldiam := 12pt;
> 
> % Default
> draw p;
> dotlabel(textext("\switchtobodyfont[8pt]" & "A"), point 0 of p) 
>withcolor transparent("exclusion",.5,red) ;
> 
> dotlabel(textext("\switchtobodyfont[8pt]" & "B"), point 1 of p) 
>withcolor transparent("exclusion",.5,red) ;
> 
> % Using a square "dot"
> p := p shifted (5cm, 0);
> dotlabelshape := fullsquare;
> 
> draw p;
> dotlabel(textext("\switchtobodyfont[8pt]" & "A"), point 0 of p) 
>withcolor transparent("exclusion",.5,red) ;
> 
> dotlabel(textext("\switchtobodyfont[8pt]" & "B"), point 1 of p) 
>withcolor transparent("exclusion",.5,red) ;
> \stopMPcode
> \stoptext
> 
> These types of macros are also a good candidate for the new LMTX syntax, 
> where we can make all components configurable via a key-value interface 
> (labeldistance etc. as well).
> 
> Aditya
> 
> ___
> If your question is of interest to others as well, please add an entry to the 
> Wiki!
> 
> maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
> webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
> archive  : https://bitbucket.org/phg/context-mirror/commits/
> wiki : http://contextgarden.net
> ___

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

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] Metafun: is it possible to redefine dotlabel to draw a square ?

2020-12-10 Thread Aditya Mahajan
On Thu, 10 Dec 2020, Otared Kavian wrote:

> Hi all,
> 
> In Metafun when representing a point I woul dlike to have some dots 
> represented by a square (or even by another scalable symbol): for instance in 
> the following I would like the dot at the point B to be a square:
> 
> \starttext
> \startMPcode
> draw (2cm,3cm) -- (3cm,5cm) ;
> dotlabel(textext("\switchtobodyfont[8pt]" & "A"), (2cm,3cm)) 
>   withpen pencircle scaled 12pt 
>   withcolor transparent("exclusion",.5,red) ;
> 
> dotlabel(textext("\switchtobodyfont[8pt]" & "B"), (3cm,5cm)) 
>   withpen pencircle scaled 12pt 
>   withcolor transparent("exclusion",.5,red) ;
> \stopMPcode
> \stoptext
> 
> I wonder whether it is possible to define something like « drawsquaredot » or 
> « squaredotlabel » in order to do this.

dotlabel uses a pen to draw the dot, and I am not sure why it uses that rather 
than a path. Here is a (to me) simpler definition, where you can change the 
shape:

\startMPdefinitions
newpath dotlabelshape;

dotlabelshape := fullcircle;

vardef dotlabel@#(expr s,z) text t_ =
label@#(s,z) t_ ;
fill (dotlabelshape scaled 2dotlabeldiam) shifted z t_;
enddef ;
\stopMPdefinitions

\starttext
\startMPcode
newpath p ; 
p := (2cm, 3cm) -- (3cm, 5cm);
dotlabeldiam := 12pt;

% Default
draw p;
dotlabel(textext("\switchtobodyfont[8pt]" & "A"), point 0 of p) 
withcolor transparent("exclusion",.5,red) ;

dotlabel(textext("\switchtobodyfont[8pt]" & "B"), point 1 of p) 
withcolor transparent("exclusion",.5,red) ;

% Using a square "dot"
p := p shifted (5cm, 0);
dotlabelshape := fullsquare;

draw p;
dotlabel(textext("\switchtobodyfont[8pt]" & "A"), point 0 of p) 
withcolor transparent("exclusion",.5,red) ;

dotlabel(textext("\switchtobodyfont[8pt]" & "B"), point 1 of p) 
withcolor transparent("exclusion",.5,red) ;
\stopMPcode
\stoptext

These types of macros are also a good candidate for the new LMTX syntax, where 
we can make all components configurable via a key-value interface 
(labeldistance etc. as well).

Aditya

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

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] Metafun: how to draw a straight line past the end points

2020-12-09 Thread Hans Hagen

On 12/9/2020 9:38 PM, Aditya Mahajan wrote:


Or just redefine shortened to accept a pair!

\startMPdefinitions
primarydef p shortened d =
 reverse ( ( reverse (p enlonged -xpart paired(d)) ) enlonged -ypart 
paired(d) )
enddef ;
\stopMPdefinitions


patched but then also:

primarydef p enlonged len =
begingroup
if len == 0 :
p
elseif pair p :
...

in order to save some energy when one is zero

Hans

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

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] Metafun: how to draw a straight line past the end points

2020-12-09 Thread Otared Kavian
Thanks Aditya!
One can learn a lot with your answers !
In the Metafun manual I see enlonged but I did not know to use it.

Best regards: Otared

> On 9 Dec 2020, at 21:38, Aditya Mahajan  wrote:
> 
> On Wed, 9 Dec 2020, Otared Kavian wrote:
> 
>> Hi Aditya,
>> 
>> Thanks for the alternative method, which comes handy if one wishes to extend 
>> the straight line by a different amount at either end:
>> 
>> \starttext
>> \startMPcode
>>   z1 = (1cm,3cm) ;
>>   z2 = (5cm, 9cm) ;
>>   z3 = 1cm * dir(angle (z2 - z1)) shifted z2 ;
>>   z4 = -.5cm*dir(angle(z2 - z1)) shifted z1 ;
>>   draw z1 -- z3 ; 
>>   draw z4 -- z1 ;
>>   draw z1 -- z2 withcolor red ;
>> \stopMPcode
>> \stoptext
> 
> Or just redefine shortened to accept a pair! 
> 
> \startMPdefinitions
> primarydef p shortened d =
>reverse ( ( reverse (p enlonged -xpart paired(d)) ) enlonged -ypart 
> paired(d) )
> enddef ;
> \stopMPdefinitions
> 
> 
> 
> \starttext
> \startMPpage
> z1 = (1cm,3cm) ;
> z2 = (5cm, 9cm) ;
> draw (z1--z2) shortened (-1cm,-2cm)  withcolor blue ;
> draw (z1--z2) withcolor red ;
> 
> \stopMPpage
> \stoptext
> 
> Now that if you really want to shorten a path, then cutends works better than 
> shortened
> 
> \startMPdefinitions
> primarydef p shortened d =
>reverse ( ( reverse (p enlonged -xpart paired(d)) ) enlonged -ypart 
> paired(d) )
> enddef ;
> \stopMPdefinitions
> 
> 
> \starttext
> \startMPpage
> z1 = (1cm,3cm) ;
> z2 = (5cm, 9cm) ;
> path p, q;
> p := z1 {up} .. {right} z2;
> q := p shifted (6cm, 0);
> 
> draw p withcolor red ;
> draw p shortened (1cm,2cm)  withcolor blue ;
> 
> draw q withcolor green ;
> draw q cutends (1cm,2cm)  withcolor blue ;
> 
> \stopMPpage
> \stoptext
> 
> Aditya
> ___
> If your question is of interest to others as well, please add an entry to the 
> Wiki!
> 
> maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
> webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
> archive  : https://bitbucket.org/phg/context-mirror/commits/
> wiki : http://contextgarden.net
> ___

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

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] Metafun: how to draw a straight line past the end points

2020-12-09 Thread Aditya Mahajan
On Wed, 9 Dec 2020, Otared Kavian wrote:

> Hi Aditya,
> 
> Thanks for the alternative method, which comes handy if one wishes to extend 
> the straight line by a different amount at either end:
> 
> \starttext
> \startMPcode
>z1 = (1cm,3cm) ;
>z2 = (5cm, 9cm) ;
>z3 = 1cm * dir(angle (z2 - z1)) shifted z2 ;
>z4 = -.5cm*dir(angle(z2 - z1)) shifted z1 ;
>draw z1 -- z3 ; 
>draw z4 -- z1 ;
>draw z1 -- z2 withcolor red ;
> \stopMPcode
> \stoptext

Or just redefine shortened to accept a pair! 

\startMPdefinitions
primarydef p shortened d =
reverse ( ( reverse (p enlonged -xpart paired(d)) ) enlonged -ypart 
paired(d) )
enddef ;
\stopMPdefinitions



\starttext
\startMPpage
z1 = (1cm,3cm) ;
z2 = (5cm, 9cm) ;
draw (z1--z2) shortened (-1cm,-2cm)  withcolor blue ;
draw (z1--z2) withcolor red ;

\stopMPpage
\stoptext

Now that if you really want to shorten a path, then cutends works better than 
shortened

\startMPdefinitions
primarydef p shortened d =
reverse ( ( reverse (p enlonged -xpart paired(d)) ) enlonged -ypart 
paired(d) )
enddef ;
\stopMPdefinitions


\starttext
\startMPpage
z1 = (1cm,3cm) ;
z2 = (5cm, 9cm) ;
path p, q;
p := z1 {up} .. {right} z2;
q := p shifted (6cm, 0);

draw p withcolor red ;
draw p shortened (1cm,2cm)  withcolor blue ;

draw q withcolor green ;
draw q cutends (1cm,2cm)  withcolor blue ;

\stopMPpage
\stoptext

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

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] Metafun: how to draw a straight line past the end points

2020-12-09 Thread Otared Kavian
Hi Aditya,

Thanks for the alternative method, which comes handy if one wishes to extend 
the straight line by a different amount at either end:

\starttext
\startMPcode
   z1 = (1cm,3cm) ;
   z2 = (5cm, 9cm) ;
   z3 = 1cm * dir(angle (z2 - z1)) shifted z2 ;
   z4 = -.5cm*dir(angle(z2 - z1)) shifted z1 ;
   draw z1 -- z3 ; 
   draw z4 -- z1 ;
   draw z1 -- z2 withcolor red ;
\stopMPcode
\stoptext

Best regards: Otared

> On 9 Dec 2020, at 18:37, Aditya Mahajan  wrote:
> 
> On Wed, 9 Dec 2020, Otared Kavian wrote:
> 
>> Thanks a lot ! Indeed that does the job, which shows how wonderful Metafun 
>> is !
> 
> Or, if you want to use high school algebra:
> 
> \starttext
> \startMPcode
>z1 = (1cm,3cm) ;
>z2 = (5cm, 9cm) ;
>z3 = 1cm * dir(angle (z2 - z1)) shifted z2;
>draw z1 -- z3 ; 
>draw z1 -- z2 withcolor red;
> \stopMPcode
> \stoptext
> 
> Aditya
> ___
> If your question is of interest to others as well, please add an entry to the 
> Wiki!
> 
> maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
> webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
> archive  : https://bitbucket.org/phg/context-mirror/commits/
> wiki : http://contextgarden.net
> ___

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

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] Metafun: how to draw a straight line past the end points

2020-12-09 Thread Aditya Mahajan
On Wed, 9 Dec 2020, Otared Kavian wrote:

> Thanks a lot ! Indeed that does the job, which shows how wonderful Metafun is 
> !

Or, if you want to use high school algebra:

\starttext
\startMPcode
z1 = (1cm,3cm) ;
z2 = (5cm, 9cm) ;
z3 = 1cm * dir(angle (z2 - z1)) shifted z2;
draw z1 -- z3 ; 
draw z1 -- z2 withcolor red;
\stopMPcode
\stoptext

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

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] Metafun: how to draw a straight line past the end points

2020-12-09 Thread Otared Kavian
Hi Fabrice,

Thanks a lot ! Indeed that does the job, which shows how wonderful Metafun is !

Best regards: Otared

> On 9 Dec 2020, at 17:19, Fabrice L  wrote:
> 
> Hi,
> 
>> Le 9 déc. 2020 à 10:57, Otared Kavian  a écrit :
>> 
>> Hi,
>> 
>> I have a silly question: given two points in the plane
>>  z1 = (1cm,3cm) ;
>>  z2 = (5cm, 9cm) ;
>> the command
>>  draw z1 -- z2 withpen pencircle scaled .5pt ;
>> draws the line segment joining z1 and z2. How could I draw the line segment 
>> which goes a little further (say 1cm) than both the end points of this 
>> segment (that is in this example, a point before z1 and a point after z2 on 
>> the straight line) .
>> Indeed it is possible to write the equation of the line and then compute by 
>> hand the coordinates of the new end points, but I think there is a simpler 
>> way in Metafun to do this.
> 
> The shortened operation is the solution ! See MetaFun manual section 1.18
> 
> \starttext
> \startMPpage
> z1 = (1cm,3cm) ;
> z2 = (5cm, 9cm) ;
> draw (z1--z2) shortened -1cm  withcolor blue ;
> draw (z1--z2) withcolor red ;
> 
> \stopMPpage
> \stoptext
>   
> Fabrice.
> 
>> 
>> Thanks for any help: Otared
>> 
>> 
>> ___
>> If your question is of interest to others as well, please add an entry to 
>> the Wiki!
>> 
>> maillist : ntg-context@ntg.nl / 
>> http://www.ntg.nl/mailman/listinfo/ntg-context
>> webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
>> archive  : https://bitbucket.org/phg/context-mirror/commits/
>> wiki : http://contextgarden.net
>> ___
> 
> ___
> If your question is of interest to others as well, please add an entry to the 
> Wiki!
> 
> maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
> webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
> archive  : https://bitbucket.org/phg/context-mirror/commits/
> wiki : http://contextgarden.net
> ___

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

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] Metafun: how to draw a straight line past the end points

2020-12-09 Thread Fabrice L
Hi,

> Le 9 déc. 2020 à 10:57, Otared Kavian  a écrit :
> 
> Hi,
> 
> I have a silly question: given two points in the plane
>   z1 = (1cm,3cm) ;
>   z2 = (5cm, 9cm) ;
> the command
>   draw z1 -- z2 withpen pencircle scaled .5pt ;
> draws the line segment joining z1 and z2. How could I draw the line segment 
> which goes a little further (say 1cm) than both the end points of this 
> segment (that is in this example, a point before z1 and a point after z2 on 
> the straight line) .
> Indeed it is possible to write the equation of the line and then compute by 
> hand the coordinates of the new end points, but I think there is a simpler 
> way in Metafun to do this.

The shortened operation is the solution ! See MetaFun manual section 1.18

\starttext
\startMPpage
z1 = (1cm,3cm) ;
z2 = (5cm, 9cm) ;
draw (z1--z2) shortened -1cm  withcolor blue ;
draw (z1--z2) withcolor red ;

\stopMPpage
\stoptext

Fabrice.

> 
> Thanks for any help: Otared
> 
> 
> ___
> If your question is of interest to others as well, please add an entry to the 
> Wiki!
> 
> maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
> webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
> archive  : https://bitbucket.org/phg/context-mirror/commits/
> wiki : http://contextgarden.net
> ___

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

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] metafun 2

2019-09-08 Thread Aditya Mahajan

On Sun, 8 Sep 2019, Otared Kavian wrote:


Hi Aditya,

I wanted also to point out a typo on that page (two occurrences), namely 
"ploles" instead of "poles", in the explanations before the actual code.


Thanks. Fixed.

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

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] metafun 2

2019-09-08 Thread Otared Kavian
Hi Aditya,

As usual you show us a very nice and very clear example to taech nice features 
of ConTeXt: thank you so much!

I wanted also to point out a typo on that page (two occurrences), namely 
"ploles" instead of "poles", in the explanations before the actual code.

Best regard: 

> On 8 Sep 2019, at 10:42, Aditya Mahajan  wrote:
> 
> On Wed, 14 Aug 2019, Hans Hagen wrote:
> 
>> Hi,
>> 
>> In the process of providing an additional (more abstract) interface to some 
>> of the old and also new MetaFun code we wonder what kind of features users 
>> would like to see.
>> 
>> http://www.pragma-ade.com/general/magazines/mag-1104-mkiv.pdf
> 
> Finally got around to playing around with the new interface. Here is an 
> example of how to define new key-value driven macros in metapost:
> 
> https://adityam.github.io/context-blog/post/new-metafun-interface/
> 
> Aditya
> ___
> If your question is of interest to others as well, please add an entry to the 
> Wiki!
> 
> maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
> webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
> archive  : https://bitbucket.org/phg/context-mirror/commits/
> wiki : http://contextgarden.net
> ___

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

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] metafun 2

2019-09-08 Thread Aditya Mahajan

On Wed, 14 Aug 2019, Hans Hagen wrote:


Hi,

In the process of providing an additional (more abstract) interface to 
some of the old and also new MetaFun code we wonder what kind of 
features users would like to see.


http://www.pragma-ade.com/general/magazines/mag-1104-mkiv.pdf


Finally got around to playing around with the new interface. Here is an 
example of how to define new key-value driven macros in metapost:


https://adityam.github.io/context-blog/post/new-metafun-interface/

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

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] metafun 2

2019-08-19 Thread Jorge Manuel

Thanks a lot for the new features.


In my system this code don’t work.

macOS Mojave

This is LuaMetaTeX, Version 2.00.0
open source > level 1, order 1, name 'cont-yes.mkiv'
system  >
system  > ConTeXt  ver: 2019.08.17 12:16 MKIV beta  fmt: 2019.8.19  
int: English/English




\startMPcode{doublefun}
draw lmt_function [

xmin =  0, xmax = 10, xstep = .05,
ymin = -2, ymax =  2,

xticks = "bottom", xsmall = 80, xlarge = 20,
yticks = "left",   ysmall = 40, ylarge =  4,

code = "1.5 * math.cosd(240 * math.sqrt(x))",

xlabels = "yes",
ylabels = "yes",

ycaption = "\strut\tfd \rotate[rotation=90]{vertical}",
xcaption = "\strut\tfd horizontal",

pointsymbol = "dot", pointsize = 4, pointcolor = "orange",

sx = 2mm, sy = 4mm, linewidth = .025mm, offset = .1mm,
]
xsized 8cm
;
\stopMPcode

The output error:

loading metafun, including plain.mp version 1.004 for metafun iv and xl


pages   > flushing realpage 9, userpage 8, subpage 9
metapost log> ! Missing ':' has been inserted.
metapost log> 
metapost log>addto
metapost log> draw->addto
metapost log>
.currentpicture.if.picture(EXPR0):also(EXPR0)else:doublepath(EXPR…









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

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] metafun 2

2019-08-17 Thread Adam Reviczky
Hi Hans, Alan,

This is really cool! Not sure how I missed this feature, works exactly for
my use-case.

Thanks a lot for pointing this out, I was able to find it in the MAPS as
well.

Cheers,
Adam

On Sat, Aug 17, 2019 at 9:52 AM Hans Hagen  wrote:

> On 8/17/2019 3:27 AM, Alan Braslau wrote:
> > We have eofill in MP (in pdf/ps in fact) and that likely will do what
> you need.
> You forgot the MWD (Minimal Working Demo):
>
> \starttext
>
> \startMPpage
> path p ; p := fullcircle scaled 1cm ;
> path q ; q := fullcircle scaled .5cm ;
>
> nofill p ;
> eofill q ;
> \stopMPpage
>
> \stoptext
>
> -
>Hans Hagen | PRAGMA ADE
>Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
> tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
> -
>
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] metafun 2

2019-08-17 Thread Hans Hagen

On 8/17/2019 3:27 AM, Alan Braslau wrote:

We have eofill in MP (in pdf/ps in fact) and that likely will do what you need.

You forgot the MWD (Minimal Working Demo):

\starttext

\startMPpage
path p ; p := fullcircle scaled 1cm ;
path q ; q := fullcircle scaled .5cm ;

nofill p ;
eofill q ;
\stopMPpage

\stoptext

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

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] metafun 2

2019-08-16 Thread Alan Braslau
We have eofill in MP (in pdf/ps in fact) and that likely will do what you need.

Alan


On Sat, 17 Aug 2019 00:31:38 +0100
Adam Reviczky  wrote:

> Hi Hans,
> 
> One MetaPost feature that I was looking forward to is the ability to create
> a fill between two shapes.
> Something like a difference function of two path's.
> 
> For logos I use the workaround with creating a path alongside the excluded
> areas but it is always cumbersome.
> 
> I have briefly mentioned it back here:
> https://mailman.ntg.nl/pipermail/ntg-context/2011/056910.html
> 
> Just for illustration purposes, if I wanted to fill the area in between two
> circles:
> 
> *path p ;
> **p := fullcircle scaled 1cm ;
> **path q ;
> **q := fullcircle scaled .5cm ;
> *
> 
> Instead of creating a new path along both circles with:
> 
> 
> *r := p -- reverse q -- cycle ;*
> 
> It would be nice to have something like:
> 
> *fill p excluding q ;*
> 
> or something like that.
> 
> I mainly have use-cases for differences in shapes, but filling the
> intersection of two shapes would be the same idea.
> 
> Thanks,
> Adam
> 
> 
> On Wed, Aug 14, 2019 at 10:57 AM Hans Hagen  wrote:
> 
> > Hi,
> >
> > In the process of providing an additional (more abstract) interface to
> > some of the old and also new MetaFun code we wonder what kind of
> > features users would like to see.
> >
> > http://www.pragma-ade.com/general/magazines/mag-1104-mkiv.pdf
> >
> > As a teaser I uploaded a MyWay document that shows some of what is
> > coming. All is experimental but it shows the direction. We're talking
> > ConTeXt LMTX here. For instance,
> >
> >  draw lmt_outline [
> >  content   = "hello",
> >  kind  = "reverse",
> >  fillcolor = "darkred",
> >  drawcolor = "darkblue",
> >  rulethickness = 1/2,
> >  ] ysized h shifted (3.75h,-1.25h) ;
> >
> > Wraps all the outline drawing in one macro with a set of options (there
> > will be xml interface definitions for that). Or take:
> >
> >  draw lmt_followtext [
> >  content = "How well does it work {\bf 1}! ",
> >  path= (fullcircle scaled 4cm),
> >  trace   = true,
> >  spread  = true,
> >  ] ysized 5cm ;
> >
> > which is an easier interface to text along a curve. Arrows can be drawn
> > with
> >
> >  draw lmt_arrow [
> >  kind= "draw",
> >  location= "middle",
> >  alternative = "curved",
> >  path= fullcircle
> >  scaled  3cm
> >  shifted (3.5cm,0cm),
> >  ] withcolor "darkblue" ;
> >
> > but of course the low level interface with its many variables for
> > tweaking stays around. Other examples are shown in the mentioned document.
> >
> > So the question is: What do you miss in metapost support? Of course it
> > should fit within the concept, so 'artistic freehand drawings' is not
> > something that is likely to get interfaced. We are particularly
> > interested in educational applications, if only because ConTeXt started
> > out that way.
> >
> > Hans
> >
> >
> >
> > -
> >Hans Hagen | PRAGMA ADE
> >Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
> > tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
> > -
> >
> > ___
> > If your question is of interest to others as well, please add an entry to
> > the Wiki!
> >
> > maillist : ntg-context@ntg.nl /
> > http://www.ntg.nl/mailman/listinfo/ntg-context
> > webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
> > archive  : https://bitbucket.org/phg/context-mirror/commits/
> > wiki : http://contextgarden.net
> >
> > ___
> >  

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

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] metafun 2

2019-08-16 Thread Adam Reviczky
Hi Hans,

One MetaPost feature that I was looking forward to is the ability to create
a fill between two shapes.
Something like a difference function of two path's.

For logos I use the workaround with creating a path alongside the excluded
areas but it is always cumbersome.

I have briefly mentioned it back here:
https://mailman.ntg.nl/pipermail/ntg-context/2011/056910.html

Just for illustration purposes, if I wanted to fill the area in between two
circles:

*path p ;
**p := fullcircle scaled 1cm ;
**path q ;
**q := fullcircle scaled .5cm ;
*

Instead of creating a new path along both circles with:


*r := p -- reverse q -- cycle ;*

It would be nice to have something like:

*fill p excluding q ;*

or something like that.

I mainly have use-cases for differences in shapes, but filling the
intersection of two shapes would be the same idea.

Thanks,
Adam


On Wed, Aug 14, 2019 at 10:57 AM Hans Hagen  wrote:

> Hi,
>
> In the process of providing an additional (more abstract) interface to
> some of the old and also new MetaFun code we wonder what kind of
> features users would like to see.
>
> http://www.pragma-ade.com/general/magazines/mag-1104-mkiv.pdf
>
> As a teaser I uploaded a MyWay document that shows some of what is
> coming. All is experimental but it shows the direction. We're talking
> ConTeXt LMTX here. For instance,
>
>  draw lmt_outline [
>  content   = "hello",
>  kind  = "reverse",
>  fillcolor = "darkred",
>  drawcolor = "darkblue",
>  rulethickness = 1/2,
>  ] ysized h shifted (3.75h,-1.25h) ;
>
> Wraps all the outline drawing in one macro with a set of options (there
> will be xml interface definitions for that). Or take:
>
>  draw lmt_followtext [
>  content = "How well does it work {\bf 1}! ",
>  path= (fullcircle scaled 4cm),
>  trace   = true,
>  spread  = true,
>  ] ysized 5cm ;
>
> which is an easier interface to text along a curve. Arrows can be drawn
> with
>
>  draw lmt_arrow [
>  kind= "draw",
>  location= "middle",
>  alternative = "curved",
>  path= fullcircle
>  scaled  3cm
>  shifted (3.5cm,0cm),
>  ] withcolor "darkblue" ;
>
> but of course the low level interface with its many variables for
> tweaking stays around. Other examples are shown in the mentioned document.
>
> So the question is: What do you miss in metapost support? Of course it
> should fit within the concept, so 'artistic freehand drawings' is not
> something that is likely to get interfaced. We are particularly
> interested in educational applications, if only because ConTeXt started
> out that way.
>
> Hans
>
>
>
> -
>Hans Hagen | PRAGMA ADE
>Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
> tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
> -
>
> ___
> If your question is of interest to others as well, please add an entry to
> the Wiki!
>
> maillist : ntg-context@ntg.nl /
> http://www.ntg.nl/mailman/listinfo/ntg-context
> webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
> archive  : https://bitbucket.org/phg/context-mirror/commits/
> wiki : http://contextgarden.net
>
> ___
>
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] metafun 2

2019-08-15 Thread Arthur Reutenauer
On Wed, Aug 14, 2019 at 10:18:19PM +1200, Henri Menke wrote:
> I just wanted to ask, will LMTX and MetaFun remain valid implementations
> of TeX and MetaPost or do we have to expect incompatibilities?

  If you mean “will luametatex pass the trip test”, the answer is
probably no: LuaTeX already diverged from Knuth’s TeX in small ways, for
example by allowing the first word of a paragraph to be hyphenated.

Best,

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

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] metafun 2

2019-08-14 Thread Hans Hagen

On 8/14/2019 4:58 PM, Mikael P. Sundqvist wrote:

1) 3d support. This is of course a very big request, but it would also 
be useful for many people.


yes ... Alan and I are thinking of some (not that we came far yet)

2) About graphing, it would be nice to be able to do contour polots and 
density plots. I know I asked for contour plots some time ago, and there 
were some examples, but I don't think there was ever some built in 
support for it. Maybe that can be done "easy" with help of lua? I guess 
there exist good algorithms.


spec needed ... as 'code' can be any function it's mostly a matter of 
what to pipe back to mp


3) (small) The possibility to have arrows in coordinate axes. I have not 
had the possibility to test the new features today, and maybe this is 
already built in (drawarrow?), but I mention it since I did not see it 
in the pdf.


no, but that is rather trivial to add


Again, it is very nice that you work on extending MetaPost/MetaFun further!!

wel, mp is ... fun (and these extension are somewhat challenging)

Hans

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

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] metafun 2

2019-08-14 Thread Hans Hagen

On 8/14/2019 4:58 PM, Otared Kavian wrote:



On 14 Aug 2019, at 16:53, Aditya Mahajan  wrote:

[…]
This looks like a typical .. vs -- issue. I think there is a way to change how 
the points are connected, but I'll have to look at the code again.

Aditya



Indeed, this seems the right explanation.
@ Hans: would it be possible to change the connecting mechanism from .. to -- ? 
(Possibly by adding an option?)


shape = "line"


Thanks for your attention,
Best regards: OK
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___




--

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

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] metafun 2

2019-08-14 Thread Wolfgang Schuster

Otared Kavian schrieb am 14.08.2019 um 16:58:

On 14 Aug 2019, at 16:53, Aditya Mahajan  wrote:

[…]
This looks like a typical .. vs -- issue. I think there is a way to change how 
the points are connected, but I'll have to look at the code again.

Aditya

Indeed, this seems the right explanation.
@ Hans: would it be possible to change the connecting mechanism from .. to -- ? 
(Possibly by adding an option?)

draw lmt_function [ shape = "line", ... ] ;

The argument for shape doesn't matter because only 'shape = "contour"' 
is checked to use .. as connector.


Wolfgang

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

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] metafun 2

2019-08-14 Thread Mikael P. Sundqvist
On Wed, Aug 14, 2019 at 11:55 AM Hans Hagen  wrote:

> Hi,
>
> In the process of providing an additional (more abstract) interface to
> some of the old and also new MetaFun code we wonder what kind of
> features users would like to see.
>
> http://www.pragma-ade.com/general/magazines/mag-1104-mkiv.pdf
>
> As a teaser I uploaded a MyWay document that shows some of what is
> coming. All is experimental but it shows the direction. We're talking
> ConTeXt LMTX here. For instance,
>
>  draw lmt_outline [
>  content   = "hello",
>  kind  = "reverse",
>  fillcolor = "darkred",
>  drawcolor = "darkblue",
>  rulethickness = 1/2,
>  ] ysized h shifted (3.75h,-1.25h) ;
>
> Wraps all the outline drawing in one macro with a set of options (there
> will be xml interface definitions for that). Or take:
>
>  draw lmt_followtext [
>  content = "How well does it work {\bf 1}! ",
>  path= (fullcircle scaled 4cm),
>  trace   = true,
>  spread  = true,
>  ] ysized 5cm ;
>
> which is an easier interface to text along a curve. Arrows can be drawn
> with
>
>  draw lmt_arrow [
>  kind= "draw",
>  location= "middle",
>  alternative = "curved",
>  path= fullcircle
>  scaled  3cm
>  shifted (3.5cm,0cm),
>  ] withcolor "darkblue" ;
>
> but of course the low level interface with its many variables for
> tweaking stays around. Other examples are shown in the mentioned document.
>
> So the question is: What do you miss in metapost support? Of course it
> should fit within the concept, so 'artistic freehand drawings' is not
> something that is likely to get interfaced. We are particularly
> interested in educational applications, if only because ConTeXt started
> out that way.
>
> Hans
>
>
>
> -
>Hans Hagen | PRAGMA ADE
>Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
> tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
> -
>
> ___
> If your question is of interest to others as well, please add an entry to
> the Wiki!
>
> maillist : ntg-context@ntg.nl /
> http://www.ntg.nl/mailman/listinfo/ntg-context
> webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
> archive  : https://bitbucket.org/phg/context-mirror/commits/
> wiki : http://contextgarden.net
>
> ___
>

Hi,

this looks very promising!!

Since you ask for feature requests:

1) 3d support. This is of course a very big request, but it would also be
useful for many people.
2) About graphing, it would be nice to be able to do contour polots and
density plots. I know I asked for contour plots some time ago, and there
were some examples, but I don't think there was ever some built in support
for it. Maybe that can be done "easy" with help of lua? I guess there exist
good algorithms.
3) (small) The possibility to have arrows in coordinate axes. I have not
had the possibility to test the new features today, and maybe this is
already built in (drawarrow?), but I mention it since I did not see it in
the pdf.

Again, it is very nice that you work on extending MetaPost/MetaFun further!!

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

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] metafun 2

2019-08-14 Thread Otared Kavian

> On 14 Aug 2019, at 16:53, Aditya Mahajan  wrote:
> 
> […]
> This looks like a typical .. vs -- issue. I think there is a way to change 
> how the points are connected, but I'll have to look at the code again.
> 
> Aditya


Indeed, this seems the right explanation.
@ Hans: would it be possible to change the connecting mechanism from .. to -- ? 
(Possibly by adding an option?)

Thanks for your attention, 
Best regards: OK
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] metafun 2

2019-08-14 Thread Aditya Mahajan

On Wed, 14 Aug 2019, Otared Kavian wrote:


Hi Hans,

Thank you very much for the new features! I haven't yet read all the 
mag-1104-mkiv.pdf where you explain some of them, but after modifying one of 
your examples, I noticed that some funtions get a strange graph, which is 
probably due to the fact that metafun2 is interpolating between points in a way 
which is not correct.
For instance, in the following example (which is a slight modification of 
yours), the curve drawn is not a graph, in the sense that for some values of x 
it seems to be two or more values of y.

How does metafun 2 traces the curve between two discretization points?

Best regards: OK

%%% begin draw-2.tex

\starttext
\startMPcode{doublefun}
draw lmt_function [
xmin =  1.0, xmax = 2.5066283, xstep = .1,
ymin = -2, ymax =  2,
%   xticks = "bottom", xsmall = 80, xlarge = 20,
%   yticks = "left", ysmall = 40, ylarge = 4,
code = "1.5 * math.sin(2*x^2)",
xlabels = "yes",
ylabels = "yes",
ycaption = "\strut\tfd \rotate[rotation=90]{vertical}",
xcaption = "\strut\tfd horizontal",
pointsymbol = "dot", pointsize = 4, pointcolor = "orange",
sx = 2mm, sy = 4mm, linewidth = .025mm, offset = .1mm,
]
xsized 8cm ;
\stopMPcode

\stoptext


This looks like a typical .. vs -- issue. I think there is a way to change 
how the points are connected, but I'll have to look at the code again.


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

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] metafun 2

2019-08-14 Thread Hans Hagen

On 8/14/2019 4:22 PM, Otared Kavian wrote:

Hi Hans,

Thank you very much for the new features! I haven't yet read all the 
mag-1104-mkiv.pdf where you explain some of them, but after modifying one of 
your examples, I noticed that some funtions get a strange graph, which is 
probably due to the fact that metafun2 is interpolating between points in a way 
which is not correct.
For instance, in the following example (which is a slight modification of 
yours), the curve drawn is not a graph, in the sense that for some values of x 
it seems to be two or more values of y.

How does metafun 2 traces the curve between two discretization points?


it doesn't, it just connects the dots, so, just use a smaller step, like

xstep = .01

(The upcoming luagraph module will provide some interpolators so at some 
point we can hook these in.)


(btw, there are a lot of extra math functions, also or complex numbers)


Best regards: OK

%%% begin draw-2.tex

\starttext
\startMPcode{doublefun}
draw lmt_function [
xmin =  1.0, xmax = 2.5066283, xstep = .1,
ymin = -2, ymax =  2,
%   xticks = "bottom", xsmall = 80, xlarge = 20,
%   yticks = "left", ysmall = 40, ylarge = 4,
code = "1.5 * math.sin(2*x^2)",
xlabels = "yes",
ylabels = "yes",
ycaption = "\strut\tfd \rotate[rotation=90]{vertical}",
xcaption = "\strut\tfd horizontal",
pointsymbol = "dot", pointsize = 4, pointcolor = "orange",
sx = 2mm, sy = 4mm, linewidth = .025mm, offset = .1mm,
]
xsized 8cm ;
\stopMPcode

\stoptext

%%% end draw-2.tex


Hans

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

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] metafun 2

2019-08-14 Thread Otared Kavian
Hi Hans,

Thank you very much for the new features! I haven't yet read all the 
mag-1104-mkiv.pdf where you explain some of them, but after modifying one of 
your examples, I noticed that some funtions get a strange graph, which is 
probably due to the fact that metafun2 is interpolating between points in a way 
which is not correct.
For instance, in the following example (which is a slight modification of 
yours), the curve drawn is not a graph, in the sense that for some values of x 
it seems to be two or more values of y.

How does metafun 2 traces the curve between two discretization points?

Best regards: OK

%%% begin draw-2.tex

\starttext
\startMPcode{doublefun} 
draw lmt_function [
xmin =  1.0, xmax = 2.5066283, xstep = .1,
ymin = -2, ymax =  2,
%   xticks = "bottom", xsmall = 80, xlarge = 20, 
%   yticks = "left", ysmall = 40, ylarge = 4,
code = "1.5 * math.sin(2*x^2)", 
xlabels = "yes",
ylabels = "yes",
ycaption = "\strut\tfd \rotate[rotation=90]{vertical}",
xcaption = "\strut\tfd horizontal",
pointsymbol = "dot", pointsize = 4, pointcolor = "orange",
sx = 2mm, sy = 4mm, linewidth = .025mm, offset = .1mm, 
]
xsized 8cm ;
\stopMPcode

\stoptext

%%% end draw-2.tex



draw-2.pdf
Description: Adobe PDF document


> On 14 Aug 2019, at 11:54, Hans Hagen  wrote:
> 
> Hi,
> 
> In the process of providing an additional (more abstract) interface to some 
> of the old and also new MetaFun code we wonder what kind of features users 
> would like to see.
> 
> http://www.pragma-ade.com/general/magazines/mag-1104-mkiv.pdf
> 
> As a teaser I uploaded a MyWay document that shows some of what is coming. 
> All is experimental but it shows the direction. We're talking ConTeXt LMTX 
> here. For instance,
> 
>draw lmt_outline [
>content   = "hello",
>kind  = "reverse",
>fillcolor = "darkred",
>drawcolor = "darkblue",
>rulethickness = 1/2,
>] ysized h shifted (3.75h,-1.25h) ;
> 
> Wraps all the outline drawing in one macro with a set of options (there will 
> be xml interface definitions for that). Or take:
> 
>draw lmt_followtext [
>content = "How well does it work {\bf 1}! ",
>path= (fullcircle scaled 4cm),
>trace   = true,
>spread  = true,
>] ysized 5cm ;
> 
> which is an easier interface to text along a curve. Arrows can be drawn with
> 
>draw lmt_arrow [
>kind= "draw",
>location= "middle",
>alternative = "curved",
>path= fullcircle
>scaled  3cm
>shifted (3.5cm,0cm),
>] withcolor "darkblue" ;
> 
> but of course the low level interface with its many variables for tweaking 
> stays around. Other examples are shown in the mentioned document.
> 
> So the question is: What do you miss in metapost support? Of course it should 
> fit within the concept, so 'artistic freehand drawings' is not something that 
> is likely to get interfaced. We are particularly interested in educational 
> applications, if only because ConTeXt started out that way.
> 
> Hans
> 
> 
> 
> -
>  Hans Hagen | PRAGMA ADE
>  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
>   tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
> -
> ___
> If your question is of interest to others as well, please add an entry to the 
> Wiki!
> 
> maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
> webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
> archive  : https://bitbucket.org/phg/context-mirror/commits/
> wiki : http://contextgarden.net
> ___

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

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] metafun 2

2019-08-14 Thread Hans Hagen

On 8/14/2019 1:31 PM, Floris van Manen wrote:

where can i find the steps to install lmtx next to my current context
luatex ?

http://pragma-ade.nl/install.htm

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

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] metafun 2

2019-08-14 Thread Floris van Manen
where can i find the steps to install lmtx next to my current context
luatex ?

.F


pEpkey.asc
Description: application/pgp-keys
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] metafun 2

2019-08-14 Thread Hans Hagen

On 8/14/2019 12:18 PM, Henri Menke wrote:

Dear Hans,

I just wanted to ask, will LMTX and MetaFun remain valid implementations
of TeX and MetaPost or do we have to expect incompatibilities?
It depends on how you define 'valid' ... we're downward compatible ... 
but LMTX will use features available in luametatex, so when that is the 
case some code will only be available in LMTX (unless i decide to 
backport some). Wrr the TeX part: LMTX is mostly MKIV but it might 
provide extra things (or different implementations). Wrr metapost: lmtx 
can do more advanced things. There is a split context code base.


I expect most users to move on to lmtx anyway at some point. Maybe at 
some point the existing mkiv will be like mkii: frozen.


Hans

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

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] metafun 2

2019-08-14 Thread Henri Menke
Dear Hans,

I just wanted to ask, will LMTX and MetaFun remain valid implementations
of TeX and MetaPost or do we have to expect incompatibilities?

Cheers, Henri

On 14/08/19 9:54 PM, Hans Hagen wrote:
> Hi,
> 
> In the process of providing an additional (more abstract) interface to 
> some of the old and also new MetaFun code we wonder what kind of 
> features users would like to see.
> 
> http://www.pragma-ade.com/general/magazines/mag-1104-mkiv.pdf
> 
> As a teaser I uploaded a MyWay document that shows some of what is 
> coming. All is experimental but it shows the direction. We're talking 
> ConTeXt LMTX here. For instance,
> 
>  draw lmt_outline [
>  content   = "hello",
>  kind  = "reverse",
>  fillcolor = "darkred",
>  drawcolor = "darkblue",
>  rulethickness = 1/2,
>  ] ysized h shifted (3.75h,-1.25h) ;
> 
> Wraps all the outline drawing in one macro with a set of options (there 
> will be xml interface definitions for that). Or take:
> 
>  draw lmt_followtext [
>  content = "How well does it work {\bf 1}! ",
>  path= (fullcircle scaled 4cm),
>  trace   = true,
>  spread  = true,
>  ] ysized 5cm ;
> 
> which is an easier interface to text along a curve. Arrows can be drawn 
> with
> 
>  draw lmt_arrow [
>  kind= "draw",
>  location= "middle",
>  alternative = "curved",
>  path= fullcircle
>  scaled  3cm
>  shifted (3.5cm,0cm),
>  ] withcolor "darkblue" ;
> 
> but of course the low level interface with its many variables for 
> tweaking stays around. Other examples are shown in the mentioned document.
> 
> So the question is: What do you miss in metapost support? Of course it 
> should fit within the concept, so 'artistic freehand drawings' is not 
> something that is likely to get interfaced. We are particularly 
> interested in educational applications, if only because ConTeXt started 
> out that way.
> 
> Hans
> 
> 
> 
> -
>Hans Hagen | PRAGMA ADE
>Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
> tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
> -
> ___
> If your question is of interest to others as well, please add an entry to the 
> Wiki!
> 
> maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
> webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
> archive  : https://bitbucket.org/phg/context-mirror/commits/
> wiki : http://contextgarden.net
> ___
> 

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

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] MetaFun: how to check the number of arguments

2019-01-16 Thread Jeong Dal
Dear Hans,

> vardef textlength(text t) =
>save n ; n := 0 ;
>for i = t :
>   n := n + 1 ;
>endfor;
>n
> enddef;
> 

Thank you for a  good method!
It can be used in another program.

Best regards,

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

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___

Re: [NTG-context] MetaFun: how to check the number of arguments

2019-01-16 Thread Hans Hagen

On 1/16/2019 12:53 AM, Jeong Dal wrote:

Dear Hans,

Thank you for a solution.

In my memory, it is possible to check the argument in Lua, so I hope 
that there is a similar method in MetaFun.

It may be easier to draw grid using lines instead of squares.


vardef textlength(text t) =
save n ; n := 0 ;
for i = t :
n := n + 1 ;
endfor;
n
enddef;

def drawGridF (expr nb) (text s) =
if textlength(s) = 0 :
   draw textext("A grid!");
else :
   path p ;
   picture pic ;
   numeric n;
p := unitsquare scaled wu;
n:= 0;
for m = s:
i:= n mod nb;
j:= n div nb;
pic := image (draw p; label(textext(m), center p); );
draw pic shifted (i*wu, j*wu);
n:= n+ 1;
endfor;
fi ;
enddef;



Thank you again.

Best regards,

Dalyoung

2019. 1. 16. 오전 2:04, Hans Hagen > 작성:


On 1/14/2019 10:44 PM, Jeong Dal wrote:

Dear all,
In the following sample, it draws squares with label which is given.
I’d like to know how to check the number of elements in the second 
argument?

If it is 0, then I just draw grids only.
Thank you for reading.
Best regards,
Dalyoung

\startbuffer[defs]
def drawGridF (expr nb) (text s) =
p := unitsquare scaled wu;
n:= 0;
for m = s:
i:= n mod nb;
j:= n div nb;
pic := image (draw p; label(textext(m), center p); );
draw pic shifted (i*wu, j*wu);
n:= n+ 1;
endfor;
enddef;
\stopbuffer
\startbuffer[3x3b]
wu := \MPvar{width};
drawGridF (3)  (1,2,3,0,1, 1,4,5,8);
\stopbuffer
\starttext
\setupMPvariables[width=30pt]
\processMPbuffer[defs,3x3b]
\stoptext



\startbuffer[defs]
def drawGridF (expr nb) (text s) =
   path p ;
   picture pic ;
   numeric n;
p := unitsquare scaled wu;
n:= 0;
for m = s:
i:= n mod nb;
j:= n div nb;
pic := image (draw p; label(textext(m), center p); );
draw pic shifted (i*wu, j*wu);
n:= n+ 1;
endfor;
   if n == 0 :
   draw textext("A grid!");
   fi ;
enddef;
\stopbuffer

\startbuffer[3x3b]
wu := \MPvar{width};
drawGridF (3)  (1,2,3,0,1, 1,4,5,8);
currentpicture := currentpicture shifted (bbwidth(currentpicture),0);
drawGridF (3)  ();
\stopbuffer

\setupMPvariables[width=30pt]
\processMPbuffer[defs,3x3b]




2019. 1. 14. 오후 8:00, ntg-context-requ...@ntg.nl 
 작성:


Send ntg-context mailing list submissions to
ntg-context@ntg.nl 

To subscribe or unsubscribe via the World Wide Web, visit
https://mailman.ntg.nl/mailman/listinfo/ntg-context
or, via email, send a message with subject or body 'help' to
ntg-context-requ...@ntg.nl

You can reach the person managing the list at
ntg-context-ow...@ntg.nl

When replying, please edit your Subject line so it is more specific
than "Re: Contents of ntg-context digest..."


Today's Topics:

  1. Re: Manipulating the left blank page when chapter starts on
 the right page (Wolfgang Schuster)
  2. Re: Footnotes in float combinations missing in output
 (Wolfgang Schuster)
  3. Re: Manipulating the left blank page when chapter starts on
 the right page (Jan U. Hasecke)


--

Message: 1
Date: Sun, 13 Jan 2019 16:56:40 +0100
From: Wolfgang Schuster 
To: mailing list for ConTeXt users , "Jan U.
Hasecke" 
Subject: Re: [NTG-context] Manipulating the left blank page when
chapter starts on the right page
Message-ID: 
Content-Type: text/plain; charset=utf-8; format=flowed

Jan U. Hasecke schrieb am 12.01.19 um 22:08:

Hi Aditya,

Am 12.01.19 um 20:11 schrieb Aditya Mahajan:

On Sat, 12 Jan 2019, Jan U. Hasecke wrote:


Hi all,

in my document \startchapter and \starttitle starts a new chapter 
on the
right (odd) page. So sometimes, there is a blank even page just 
before a

new chapter.

I would like to manipulate this blank even page.

There are several things I would like to do, eg. having no 
headers and
footers, setting the background color to a named color, placing 
an image

or some graphics on the page.

Is there a way to define such a page, name it and call it in
\startchapter so that it is placed on the left side.

See https://tex.stackexchange.com/q/457428/323
Thanks a lot, but I wasn't looking for a way to just delete page 
numbers

but to style the empty page in arbitrary ways.

Maybe it is better to do this manually.

I would let chapter open on even pages too and just insert a styled 
page

by hand.


Here is a example which shows how you can change the background color
of a empty page before the chapter title.

\setuppagenumbering
  [alternative=doublesided]

\startsetups [chapter:before]
  \doifoddpageelse
{}
{\pushbackground[page]
 \setupbackgrounds[page][background=color,backgroundcolor=black]
 \page[empty,right]
 \popbackground}
\stopsetups

\setuphead
  [chapter]
  [page=yes,
   before=\directsetup{chapter:before}]

\starttext

\startchapter[title={Knuth}]
\dorecurse{10}{\samplefile{knuth}}
\stopchapter


Re: [NTG-context] MetaFun: how to check the number of arguments

2019-01-15 Thread Jeong Dal
Dear Hans,

Thank you for a solution.

In my memory, it is possible to check the argument in Lua, so I hope that there 
is a similar method in MetaFun.
It may be easier to draw grid using lines instead of squares.

Thank you again.

Best regards,

Dalyoung

> 2019. 1. 16. 오전 2:04, Hans Hagen  작성:
> 
> On 1/14/2019 10:44 PM, Jeong Dal wrote:
>> Dear all,
>> In the following sample, it draws squares with label which is given.
>> I’d like to know how to check the number of elements in the second argument?
>> If it is 0, then I just draw grids only.
>> Thank you for reading.
>> Best regards,
>> Dalyoung
>> 
>> \startbuffer[defs]
>> def drawGridF (expr nb) (text s) =
>>  p := unitsquare scaled wu;
>>  n:= 0;
>>  for m = s:
>>  i:= n mod nb;
>>  j:= n div nb;
>>  pic := image (draw p; label(textext(m), center p); );
>>  draw pic shifted (i*wu, j*wu);
>>  n:= n+ 1;
>>  endfor;
>> enddef;
>> \stopbuffer
>> \startbuffer[3x3b]
>> wu := \MPvar{width};
>> drawGridF (3)  (1,2,3,0,1, 1,4,5,8);
>> \stopbuffer
>> \starttext
>> \setupMPvariables[width=30pt]
>> \processMPbuffer[defs,3x3b]
>> \stoptext
> 
> 
> \startbuffer[defs]
> def drawGridF (expr nb) (text s) =
>path p ;
>picture pic ;
>numeric n;
>   p := unitsquare scaled wu;
>   n:= 0;
>   for m = s:
>   i:= n mod nb;
>   j:= n div nb;
>   pic := image (draw p; label(textext(m), center p); );
>   draw pic shifted (i*wu, j*wu);
>   n:= n+ 1;
>   endfor;
>if n == 0 :
>draw textext("A grid!");
>fi ;
> enddef;
> \stopbuffer
> 
> \startbuffer[3x3b]
> wu := \MPvar{width};
> drawGridF (3)  (1,2,3,0,1, 1,4,5,8);
> currentpicture := currentpicture shifted (bbwidth(currentpicture),0);
> drawGridF (3)  ();
> \stopbuffer
> 
> \setupMPvariables[width=30pt]
> \processMPbuffer[defs,3x3b]
> 
> 
> 
> 
>>> 2019. 1. 14. 오후 8:00, ntg-context-requ...@ntg.nl 작성:
>>> 
>>> Send ntg-context mailing list submissions to
>>> ntg-context@ntg.nl
>>> 
>>> To subscribe or unsubscribe via the World Wide Web, visit
>>> https://mailman.ntg.nl/mailman/listinfo/ntg-context
>>> or, via email, send a message with subject or body 'help' to
>>> ntg-context-requ...@ntg.nl
>>> 
>>> You can reach the person managing the list at
>>> ntg-context-ow...@ntg.nl
>>> 
>>> When replying, please edit your Subject line so it is more specific
>>> than "Re: Contents of ntg-context digest..."
>>> 
>>> 
>>> Today's Topics:
>>> 
>>>   1. Re: Manipulating the left blank page when chapter starts on
>>>  the right page (Wolfgang Schuster)
>>>   2. Re: Footnotes in float combinations missing in output
>>>  (Wolfgang Schuster)
>>>   3. Re: Manipulating the left blank page when chapter starts on
>>>  the right page (Jan U. Hasecke)
>>> 
>>> 
>>> --
>>> 
>>> Message: 1
>>> Date: Sun, 13 Jan 2019 16:56:40 +0100
>>> From: Wolfgang Schuster 
>>> To: mailing list for ConTeXt users , "Jan U.
>>> Hasecke" 
>>> Subject: Re: [NTG-context] Manipulating the left blank page when
>>> chapter starts on the right page
>>> Message-ID: 
>>> Content-Type: text/plain; charset=utf-8; format=flowed
>>> 
>>> Jan U. Hasecke schrieb am 12.01.19 um 22:08:
 Hi Aditya,
 
 Am 12.01.19 um 20:11 schrieb Aditya Mahajan:
> On Sat, 12 Jan 2019, Jan U. Hasecke wrote:
> 
>> Hi all,
>> 
>> in my document \startchapter and \starttitle starts a new chapter on the
>> right (odd) page. So sometimes, there is a blank even page just before a
>> new chapter.
>> 
>> I would like to manipulate this blank even page.
>> 
>> There are several things I would like to do, eg. having no headers and
>> footers, setting the background color to a named color, placing an image
>> or some graphics on the page.
>> 
>> Is there a way to define such a page, name it and call it in
>> \startchapter so that it is placed on the left side.
> See https://tex.stackexchange.com/q/457428/323
 Thanks a lot, but I wasn't looking for a way to just delete page numbers
 but to style the empty page in arbitrary ways.
 
 Maybe it is better to do this manually.
 
 I would let chapter open on even pages too and just insert a styled page
 by hand.
>>> 
>>> Here is a example which shows how you can change the background color
>>> of a empty page before the chapter title.
>>> 
>>> \setuppagenumbering
>>>   [alternative=doublesided]
>>> 
>>> \startsetups [chapter:before]
>>>   \doifoddpageelse
>>> {}
>>> {\pushbackground[page]
>>>  \setupbackgrounds[page][background=color,backgroundcolor=black]
>>>  \page[empty,right]
>>>  \popbackground}
>>> \stopsetups
>>> 
>>> \setuphead
>>>   [chapter]
>>>   [page=yes,
>>>before=\directsetup{chapter:before}]
>>> 
>>> \starttext
>>> 
>>> 

Re: [NTG-context] MetaFun: how to check the number of arguments

2019-01-15 Thread Hans Hagen

On 1/14/2019 10:44 PM, Jeong Dal wrote:

Dear all,

In the following sample, it draws squares with label which is given.

I’d like to know how to check the number of elements in the second argument?
If it is 0, then I just draw grids only.

Thank you for reading.
Best regards,

Dalyoung


\startbuffer[defs]
def drawGridF (expr nb) (text s) =
p := unitsquare scaled wu;
n:= 0;
for m = s:
i:= n mod nb;
j:= n div nb;
pic := image (draw p; label(textext(m), center p); );
draw pic shifted (i*wu, j*wu);
n:= n+ 1;
endfor;
enddef;
\stopbuffer

\startbuffer[3x3b]
wu := \MPvar{width};
drawGridF (3)  (1,2,3,0,1, 1,4,5,8);
\stopbuffer

\starttext
\setupMPvariables[width=30pt]
\processMPbuffer[defs,3x3b]
\stoptext



\startbuffer[defs]
def drawGridF (expr nb) (text s) =
path p ;
picture pic ;
numeric n;
p := unitsquare scaled wu;
n:= 0;
for m = s:
i:= n mod nb;
j:= n div nb;
pic := image (draw p; label(textext(m), center p); );
draw pic shifted (i*wu, j*wu);
n:= n+ 1;
endfor;
if n == 0 :
draw textext("A grid!");
fi ;
enddef;
\stopbuffer

\startbuffer[3x3b]
wu := \MPvar{width};
drawGridF (3)  (1,2,3,0,1, 1,4,5,8);
currentpicture := currentpicture shifted (bbwidth(currentpicture),0);
drawGridF (3)  ();
\stopbuffer

\setupMPvariables[width=30pt]
\processMPbuffer[defs,3x3b]





2019. 1. 14. 오후 8:00, ntg-context-requ...@ntg.nl 작성:

Send ntg-context mailing list submissions to
ntg-context@ntg.nl

To subscribe or unsubscribe via the World Wide Web, visit
https://mailman.ntg.nl/mailman/listinfo/ntg-context
or, via email, send a message with subject or body 'help' to
ntg-context-requ...@ntg.nl

You can reach the person managing the list at
ntg-context-ow...@ntg.nl

When replying, please edit your Subject line so it is more specific
than "Re: Contents of ntg-context digest..."


Today's Topics:

   1. Re: Manipulating the left blank page when chapter starts on
  the right page (Wolfgang Schuster)
   2. Re: Footnotes in float combinations missing in output
  (Wolfgang Schuster)
   3. Re: Manipulating the left blank page when chapter starts on
  the right page (Jan U. Hasecke)


--

Message: 1
Date: Sun, 13 Jan 2019 16:56:40 +0100
From: Wolfgang Schuster 
To: mailing list for ConTeXt users , "Jan U.
Hasecke" 
Subject: Re: [NTG-context] Manipulating the left blank page when
chapter starts on the right page
Message-ID: 
Content-Type: text/plain; charset=utf-8; format=flowed

Jan U. Hasecke schrieb am 12.01.19 um 22:08:

Hi Aditya,

Am 12.01.19 um 20:11 schrieb Aditya Mahajan:

On Sat, 12 Jan 2019, Jan U. Hasecke wrote:


Hi all,

in my document \startchapter and \starttitle starts a new chapter on the
right (odd) page. So sometimes, there is a blank even page just before a
new chapter.

I would like to manipulate this blank even page.

There are several things I would like to do, eg. having no headers and
footers, setting the background color to a named color, placing an image
or some graphics on the page.

Is there a way to define such a page, name it and call it in
\startchapter so that it is placed on the left side.

See https://tex.stackexchange.com/q/457428/323

Thanks a lot, but I wasn't looking for a way to just delete page numbers
but to style the empty page in arbitrary ways.

Maybe it is better to do this manually.

I would let chapter open on even pages too and just insert a styled page
by hand.


Here is a example which shows how you can change the background color
of a empty page before the chapter title.

\setuppagenumbering
   [alternative=doublesided]

\startsetups [chapter:before]
   \doifoddpageelse
 {}
 {\pushbackground[page]
  \setupbackgrounds[page][background=color,backgroundcolor=black]
  \page[empty,right]
  \popbackground}
\stopsetups

\setuphead
   [chapter]
   [page=yes,
before=\directsetup{chapter:before}]

\starttext

\startchapter[title={Knuth}]
\dorecurse{10}{\samplefile{knuth}}
\stopchapter

\startchapter[title={Zapf}]
\dorecurse{10}{\samplefile{zapf}}
\stopchapter

\startchapter[title={Ward}]
\dorecurse{10}{\samplefile{ward}}
\stopchapter

\stoptext

Wolfgang



--

Message: 2
Date: Sun, 13 Jan 2019 21:06:42 +0100
From: Wolfgang Schuster 
To: mailing list for ConTeXt users , Lars

Subject: Re: [NTG-context] Footnotes in float combinations missing in
output
Message-ID: 
Content-Type: text/plain; charset=utf-8; format=flowed

Lars schrieb am 09.01.19 um 23:01:

Hi there, hi Hans,

I just want to let you know that footnotes insterted in
float-combinations don't get rendered properly, i. e. only the last
footnote is placed in the output. MWE:

\starttext
 

Re: [NTG-context] Metafun scaling problem

2018-10-02 Thread Hans Hagen

On 10/2/2018 1:05 PM, Lutz Haseloff wrote:

xsized was the solution.
I wonder why xscaled worked for me for years.
because we used a 1bp image at that time (was needed in two-pass 
approach) ... we don't have that limitation now (and 1bp is pretty 
inaccurate anyway)


Hans


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

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___

Re: [NTG-context] Metafun scaling problem

2018-10-02 Thread Lutz Haseloff
xsized was the solution.
I wonder why xscaled worked for me for years.

Thanks for the fast help.

Lutz

Am 2. Oktober 2018 11:10:04 MESZ schrieb Hans Hagen :
>On 10/2/2018 7:03 AM, Lutz Haseloff wrote:
>> Hi Hans, hi all,
>> 
>> I think, that recent context has a problem with scaling included pdf
>files.
>> My minimal file:
>> 
>> \startMPpage
>> draw externalfigure "cow.pdf" ;
>> \stopMPpage
>> 
>> The resulting pdf is, as the original, 97x70.6 mm, all ok.
>> 
>> If I try to scale to the original size, i get arithmetic overflow
>error.
>> 
>> \startMPpage
>> draw externalfigure "cow.pdf" xscaled 97mm yscaled 70.6mm ;
>> \stopMPpage
>don't use xscaled, use xsized
>
>if you have
>
>path p ; p := fullcircls scaled 1cm ;
>
>and then do
>
>draw p xscaled 97pt ;
>
>you multiply with a number and only get 97pt width when your p has 1 bp
>
>width
>
>externalfigure has the original dimensions (so no width 1 bp here)
>
>Hans
>
>-
>   Hans Hagen | PRAGMA ADE
>   Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
>tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
>-
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___

Re: [NTG-context] Metafun scaling problem

2018-10-02 Thread luigi scarso
On Tue, Oct 2, 2018 at 7:03 AM Lutz Haseloff 
wrote:

> Hi Hans, hi all,
>
> I think, that recent context has a problem with scaling included pdf files.
>
>
>
Metapost traditional scaled math has a limited range, you can use doublefun
or decimalfun (not more binaryfun)

\starttext
\startTEXpage
\startMPcode{doublefun}
draw externalfigure "cow.pdf" xscaled 97mm yscaled 70.6mm ;
\stopMPcode
\stopTEXpage
\stoptext

Page size:  13999.8 x 7410.6 pts



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

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___

Re: [NTG-context] Metafun scaling problem

2018-10-02 Thread Hans Hagen

On 10/2/2018 7:03 AM, Lutz Haseloff wrote:

Hi Hans, hi all,

I think, that recent context has a problem with scaling included pdf files.
My minimal file:

\startMPpage
draw externalfigure "cow.pdf" ;
\stopMPpage

The resulting pdf is, as the original, 97x70.6 mm, all ok.

If I try to scale to the original size, i get arithmetic overflow error.

\startMPpage
draw externalfigure "cow.pdf" xscaled 97mm yscaled 70.6mm ;
\stopMPpage

don't use xscaled, use xsized

if you have

path p ; p := fullcircls scaled 1cm ;

and then do

draw p xscaled 97pt ;

you multiply with a number and only get 97pt width when your p has 1 bp 
width


externalfigure has the original dimensions (so no width 1 bp here)

Hans

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

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___

Re: [NTG-context] Metafun scaling problem

2018-10-02 Thread luigi scarso
On Tue, Oct 2, 2018 at 8:19 AM Lutz Haseloff 
wrote:

> On Windows, I got it working again with current Context (20180404) and
> current luatex from win32tex
> (1.07 development ID 6686)
>
> On linux-armhf I did a fresh "./first-setup.sh --engine=luatex" and got:
>
> mtx-context | ConTeXt Process Management 1.02
> mtx-context |
> mtx-context | main context file:
> /usr/local/context/tex/texmf-context/tex/context/base/mkiv/context.mkiv
> mtx-context | current version: 2018.09.30 19:32
>
> and:
>
> This is LuaTeX, Version 1.09.0 (TeX Live 2019/dev)
>
> The LuaTeX team is Hans Hagen, Hartmut Henkel, Taco Hoekwater, Luigi
> Scarso.
>
> LuaTeX merges and builds upon (parts of) the code from these projects:
>
> tex : Donald Knuth
> etex : Peter Breitenlohner, Phil Taylor and friends
> omega : John Plaice and Yannis Haralambous
> aleph : Giuseppe Bilotta
> pdftex : Han The Thanh and friends
> kpathsea : Karl Berry, Olaf Weber and others
> lua : Roberto Ierusalimschy, Waldemar Celes and Luiz Henrique de Figueiredo
> metapost : John Hobby, Taco Hoekwater, Luigi Scarso, Hans Hagen and friends
> pplib : Paweł Jackowski
> fontforge : George Williams (partial)
> luajit : Mike Pall (used in LuajitTeX)
>
> Compiled with libpng 1.6.35; using 1.6.35
> Compiled with lua version 5.3.5
> Compiled with mplib version 2.00
> Compiled with zlib 1.2.11; using 1.2.11
>
> Development id: 6930
>
> No experimental, i think.
>
right, it's trunk.

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

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___

  1   2   3   >