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

[NTG-context] Metafun : save memory content ?

2022-07-18 Thread 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).

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 ? 

Thanks for any help !
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] MetaPost label font size

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


> Le 5 juill. 2022 à 19:00, Henning Hraban Ramm via ntg-context 
>  a écrit :
> 
> How can I change the font size of labels within one picture?
> 
> Hraban
> 
> \startMPpage
> defaultfont := "\truefontname{Sans}";
> defaultfontsize := \the\bodyfontsize;
> 
> label.top(defaultfontsize, (0,0));
> 
> defaultfontsize := 4bp;
> 
> label.top(defaultfontsize, (50,0));
> % shows that the variable changed,
> % but font size is the same
> 
> \stopMPpage

Here are slightly different syntax that could be useful perhaps ? In the second 
one, the scaled parameter can be replaced easily with a variable, so you can 
decide and change the size of the label during the course of a picture.

\starttext

\startMPpage
defaultfont := "\truefontname{Sans}";
defaultfontsize := \the\bodyfontsize;

defaultscale := 0.5;
label.top("small label", (-10,0));

defaultscale := 1.0;
label.top("normal label", (50,5));
label.top("another normal label", (50,-5));

defaultscale := 2.0;
label.top("Huge label", (10,-25));

\stopMPpage

\startMPpage

 draw textext.top("small label") scaled 0.5 
shifted (-10,0) ;
 draw textext.top("normal label") scaled 1 
shifted (50,5) ;
 draw textext.top("second normal label") scaled 1 
shifted (50,-5) ;
 draw textext.top("Huge label") scaled 2 
shifted (10,-25) ;

\stopMPpage

\stoptext

Fabrice.


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

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


Re: [NTG-context] Importing pdf into MPpage

2022-06-11 Thread Fabrice L via ntg-context


> Le 11 juin 2022 à 11:30, Stefan Nedeljkovic  a écrit :
> 
> That's it, but how do I center it on (0, 0)?

Sorry, I misunderstood the question. Here is a solution (perhaps there is a 
simpler solution !):

\startMPpage
picture TheImage ; 
TheImage := image(
draw externalfigure "cow.pdf";
);
TheImage := TheImage shifted -center(TheImage);
draw TheImage ;
draw (0,0) withpen pencircle scaled .2in withcolor magenta ;
\stopMPpage

Fabrice.

> 
> On Sat, Jun 11, 2022 at 4:46 PM Fabrice L  <mailto:fabrice.al...@gmail.com>> wrote:
> Dear Stephan,
> 
>> Le 11 juin 2022 à 08:57, Stefan Nedeljkovic via ntg-context 
>> mailto:ntg-context@ntg.nl>> a écrit :
>> 
>> Dear list,
>> 
>> I would like to place a pdf file at (0, 0), centered at original size on a 
>> MPpage, and draw over it. But using the input command doesn't work. How 
>> should I approach this?
> 
> Like this ?
> 
> \startMPpage
>draw externalfigure "thefile.pdf";
>(… other commands…) 
> \stopMPpage
> 
> 
>> 
>> Sincerely,
>> Stefan
> 
> Fabrice.
> 
>> ___
>> If your question is of interest to others as well, please add an entry to 
>> the Wiki!
>> 
>> maillist : ntg-context@ntg.nl <mailto:ntg-context@ntg.nl> / 
>> http://www.ntg.nl/mailman/listinfo/ntg-context 
>> <http://www.ntg.nl/mailman/listinfo/ntg-context>
>> webpage  : http://www.pragma-ade.nl <http://www.pragma-ade.nl/> / 
>> http://context.aanhet.net <http://context.aanhet.net/>
>> archive  : https://bitbucket.org/phg/context-mirror/commits/ 
>> <https://bitbucket.org/phg/context-mirror/commits/>
>> wiki : http://contextgarden.net <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] Importing pdf into MPpage

2022-06-11 Thread Fabrice L via ntg-context
Dear Stephan,

> Le 11 juin 2022 à 08:57, Stefan Nedeljkovic via ntg-context 
>  a écrit :
> 
> Dear list,
> 
> I would like to place a pdf file at (0, 0), centered at original size on a 
> MPpage, and draw over it. But using the input command doesn't work. How 
> should I approach this?

Like this ?

\startMPpage
   draw externalfigure "thefile.pdf";
   (… other commands…) 
\stopMPpage


> 
> Sincerely,
> Stefan

Fabrice.

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

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

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


Re: [NTG-context] Problem with a defined colour in MetaFun

2022-04-28 Thread Fabrice L via ntg-context
Sorry, I was a little too enthusiastic, here here is the code :

> Le 28 avr. 2022 à 08:41, Fabrice L  a écrit :
> 
> Hi Keith,
> 
>> Le 28 avr. 2022 à 06:05, Keith McKay via ntg-context > <mailto:ntg-context@ntg.nl>> a écrit :
>> 
>> Hi,
>> 
>> In the MWE below I define an rgb colour, myColor1, using random numbers for 
>> the r, g and b components. I then use it to fill a unitsquare the size of 
>> the page, which works as expected. In the loop that follows I then use the 
>> defined colour, myColor1, along with white and the variable r to create 
>> shades of myColor1 as in the MWE below. However, myColor1 is not recognised 
>> in the loop and seems to be replaced by black, although if I use a 
>> predefined colour, in this case BurntSienna from the crayola collection, it 
>> works as expected.  I have tried a number of ways to get this to work as 
>> shown in the code but without success. I would be grateful for any 
>> suggestions.
>> 
>> Best Wishes
>> 
>> Keith McKay
>> 
>> MWE%
>> \setuppapersize[A4,portrait]
>> \usecolors[crayola]
>> \starttext
>> \dorecurse{10}{
>> \startMPpage
>> StartPage;
>> \definecolor[name="myColor1", r =  uniformdeviate(1), g = uniformdeviate(1), 
>> b = uniformdeviate(1) ] ;
>> fill unitsquare xscaled PaperWidth yscaled PaperHeight withcolor  "myColor1";
>> for i =2 step 2 until 10:
>> r := i/10;
>> fill unitsquare xscaled 5cm yscaled .5cm shifted (1cm,i*cm) 
>> withcolor(r[\MPcolor{BurntSienna},white]);
>> fill unitsquare xscaled 5cm yscaled .5cm shifted (7cm,i*cm) 
>> withcolor(r[\MPcolor{myColor1}, white]);
>> fill unitsquare xscaled 5cm yscaled .5cm shifted (13cm,i*cm) 
>> withcolor(r[\MPcolor{"myColor1"}, white]);
>> %fill unitsquare xscaled 5cm yscaled .5cm shifted (13cm,i*cm) 
>> withcolor(r[myColor1 ,  white]); This line causes an error.
>> endfor;
>> StopPage;
>> \stopMPpage
>> }
>> 
>> \stoptext
>> %%%end MWE%%%
>> 
> 
> Here is a solution, with works here, defining in another way the color «  
> myColor »:
> 
> \setuppapersize[A4,portrait]
> \usecolors[crayola]
> \starttext
> \dorecurse{2}{
> \startMPpage
> StartPage;
> color myColor ;
> myColor := (uniformdeviate(1),uniformdeviate(1),uniformdeviate(1));
> fill unitsquare xscaled PaperWidth yscaled PaperHeight withcolor myColor;
> for i =2 step 2 until 10:
> r := i/10;
> fill unitsquare xscaled 5cm yscaled .5cm shifted (1cm,i*cm) 
> withcolor(r[\MPcolor{BurntSienna},white]);
> fill unitsquare xscaled 5cm yscaled .5cm shifted (7cm,i*cm) 
> withcolor(r[\MPcolor{myColor1}, white]);
> fill unitsquare xscaled 5cm yscaled .5cm shifted (13cm,i*cm) 
> withcolor(r[\MPcolor{"myColor1"}, white]);
> %fill unitsquare xscaled 5cm yscaled .5cm shifted (13cm,i*cm) 
> withcolor(r[myColor1 ,  white]); This line causes an error.
> endfor;
> StopPage;
> \stopMPpage
> }
> 
> \stoptext

I forgot to remove « myColor1 » from the others parts of the code. 
\setuppapersize[A4,portrait]
\usecolors[crayola]
\starttext
\dorecurse{10}{
\startMPpage
StartPage;
color myColor ;
myColor := (uniformdeviate(1),uniformdeviate(1),uniformdeviate(1));
fill unitsquare xscaled PaperWidth yscaled PaperHeight withcolor myColor;
for i =2 step 2 until 10:
r := i/10;
fill unitsquare xscaled 5cm yscaled .5cm shifted (1cm,i*cm) 
withcolor(r[\MPcolor{BurntSienna},white]);
fill unitsquare xscaled 5cm yscaled .5cm shifted (7cm,i*cm) 
withcolor(r[myColor, white]);
fill unitsquare xscaled 5cm yscaled .5cm shifted (13cm,i*cm) 
withcolor(r[myColor, white]);
%fill unitsquare xscaled 5cm yscaled .5cm shifted (13cm,i*cm) 
withcolor(r[myColor1 ,  white]); This line causes an error.
endfor;
StopPage;
\stopMPpage
}

\stoptext


> 
> Fabrice.
>> 
>> 
>> ___
>> If your question is of interest to others as well, please add an entry to 
>> the Wiki!
>> 
>> maillist : ntg-context@ntg.nl <mailto:ntg-context@ntg.nl> / 
>> http://www.ntg.nl/mailman/listinfo/ntg-context 
>> <http://www.ntg.nl/mailman/listinfo/ntg-context>
>> webpage  : http://www.pragma-ade.nl <http://www.pragma-ade.nl/> / 
>> http://context.aanhet.net <http://context.aanhet.net/>
>> archive  : https://bitbucket.org/phg/context-mirror/commits/ 
>> <https://bitbucket.org/phg/context-mirror/commits/>
>> wiki : http://contextgarden.net <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] Problem with a defined colour in MetaFun

2022-04-28 Thread Fabrice L via ntg-context
Hi Keith,

> Le 28 avr. 2022 à 06:05, Keith McKay via ntg-context  a 
> écrit :
> 
> Hi,
> 
> In the MWE below I define an rgb colour, myColor1, using random numbers for 
> the r, g and b components. I then use it to fill a unitsquare the size of the 
> page, which works as expected. In the loop that follows I then use the 
> defined colour, myColor1, along with white and the variable r to create 
> shades of myColor1 as in the MWE below. However, myColor1 is not recognised 
> in the loop and seems to be replaced by black, although if I use a predefined 
> colour, in this case BurntSienna from the crayola collection, it works as 
> expected.  I have tried a number of ways to get this to work as shown in the 
> code but without success. I would be grateful for any suggestions.
> 
> Best Wishes
> 
> Keith McKay
> 
> MWE%
> \setuppapersize[A4,portrait]
> \usecolors[crayola]
> \starttext
> \dorecurse{10}{
> \startMPpage
> StartPage;
> \definecolor[name="myColor1", r =  uniformdeviate(1), g = uniformdeviate(1), 
> b = uniformdeviate(1) ] ;
> fill unitsquare xscaled PaperWidth yscaled PaperHeight withcolor  "myColor1";
> for i =2 step 2 until 10:
> r := i/10;
> fill unitsquare xscaled 5cm yscaled .5cm shifted (1cm,i*cm) 
> withcolor(r[\MPcolor{BurntSienna},white]);
> fill unitsquare xscaled 5cm yscaled .5cm shifted (7cm,i*cm) 
> withcolor(r[\MPcolor{myColor1}, white]);
> fill unitsquare xscaled 5cm yscaled .5cm shifted (13cm,i*cm) 
> withcolor(r[\MPcolor{"myColor1"}, white]);
> %fill unitsquare xscaled 5cm yscaled .5cm shifted (13cm,i*cm) 
> withcolor(r[myColor1 ,  white]); This line causes an error.
> endfor;
> StopPage;
> \stopMPpage
> }
> 
> \stoptext
> %%%end MWE%%%
> 

Here is a solution, with works here, defining in another way the color «  
myColor »:

\setuppapersize[A4,portrait]
\usecolors[crayola]
\starttext
\dorecurse{2}{
\startMPpage
StartPage;
color myColor ;
myColor := (uniformdeviate(1),uniformdeviate(1),uniformdeviate(1));
fill unitsquare xscaled PaperWidth yscaled PaperHeight withcolor myColor;
for i =2 step 2 until 10:
r := i/10;
fill unitsquare xscaled 5cm yscaled .5cm shifted (1cm,i*cm) 
withcolor(r[\MPcolor{BurntSienna},white]);
fill unitsquare xscaled 5cm yscaled .5cm shifted (7cm,i*cm) 
withcolor(r[\MPcolor{myColor1}, white]);
fill unitsquare xscaled 5cm yscaled .5cm shifted (13cm,i*cm) 
withcolor(r[\MPcolor{"myColor1"}, white]);
%fill unitsquare xscaled 5cm yscaled .5cm shifted (13cm,i*cm) 
withcolor(r[myColor1 ,  white]); This line causes an error.
endfor;
StopPage;
\stopMPpage
}

\stoptext

Fabrice.
> 
> 
> ___
> If your question is of interest to others as well, please add an entry to the 
> Wiki!
> 
> maillist : ntg-context@ntg.nl <mailto:ntg-context@ntg.nl> / 
> http://www.ntg.nl/mailman/listinfo/ntg-context 
> <http://www.ntg.nl/mailman/listinfo/ntg-context>
> webpage  : http://www.pragma-ade.nl <http://www.pragma-ade.nl/> / 
> http://context.aanhet.net <http://context.aanhet.net/>
> archive  : https://bitbucket.org/phg/context-mirror/commits/ 
> <https://bitbucket.org/phg/context-mirror/commits/>
> wiki : http://contextgarden.net <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] Font too small with a macro

2022-04-23 Thread Fabrice Couvreur via ntg-context
Hi,
I didn't know that \exp was already defined.
Thanks
Fabrice

Le sam. 23 avr. 2022 à 15:28, Mikael Sundqvist via ntg-context <
ntg-context@ntg.nl> a écrit :

> On Sat, Apr 23, 2022 at 12:11 PM Fabrice Couvreur via ntg-context
>  wrote:
> >
> > Hello,
> > If I compile with context the expected result is correct but with lmtx
> the font under the square root is smaller.
> > Thank you
> > Fabrice
> >
> > \protected\def\exp{\text{\normal exp}}
> >
> > \starttext
> > \startformula
> >\sqrt{\exp(x)}=\exp\left(\frac{x}{2}\right).
> > \stopformula
> > \stoptext
>
> Hi,
>
> without your redefinition of \exp it looks fine (exp is already
> defined). Does that solve your problem, or are you doing something
> else, and this exp was just an example?
>
> Best, 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
>
> ___
>
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

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


[NTG-context] Font too small with a macro

2022-04-23 Thread Fabrice Couvreur via ntg-context
Hello,
If I compile with context the expected result is correct but with lmtx the
font under the square root is smaller.
Thank you
Fabrice

\protected\def\exp{\text{\normal exp}}

\starttext
\startformula
   \sqrt{\exp(x)}=\exp\left(\frac{x}{2}\right).
\stopformula
\stoptext
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

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


[NTG-context] the resolver databases are not present or outdated

2022-03-05 Thread Fabrice Couvreur via ntg-context
Hello,
Some files no longer compile, I tried updating lmtx but I get this.
Thank you
Fabrice

viserion@archlinux LMTX]$ install install.sh
install: opérande de fichier cible manquant après 'install.sh'
Saisissez « install --help » pour plus d'informations.
[viserion@archlinux LMTX]$ sh install.sh
mtxrun  | forcing cache reload
resolvers   | resolving | looking for regular 'texmfcnf.lua' on given
path '/home/viserion/texmf/web2c' from specification 'home:texmf/web2c'
resolvers   | resolving | looking for regular 'texmfcnf.lua' on given
path '/home/viserion/texmf-local/web2c' from specification
'selfautoparent:/texmf-local/web2c'
resolvers   | resolving | looking for regular 'texmfcnf.lua' on given
path '/home/viserion/texmf-context/web2c' from specification
'selfautoparent:/texmf-context/web2c'
resolvers   | resolving | looking for regular 'texmfcnf.lua' on given
path '/home/viserion/texmf-dist/web2c' from specification
'selfautoparent:/texmf-dist/web2c'
resolvers   | resolving | looking for regular 'texmfcnf.lua' on given
path '/home/viserion/texmf/web2c' from specification
'selfautoparent:/texmf/web2c'
resolvers   | resolving | looking for fallback 'contextcnf.lua' on
given path '/home/viserion/texmf/web2c' from specification
'home:texmf/web2c'
resolvers   | resolving | looking for fallback 'contextcnf.lua' on
given path '/home/viserion/texmf-local/web2c' from specification
'selfautoparent:/texmf-local/web2c'
resolvers   | resolving | looking for fallback 'contextcnf.lua' on
given path '/home/viserion/texmf-context/web2c' from specification
'selfautoparent:/texmf-context/web2c'
resolvers   | resolving | looking for fallback 'contextcnf.lua' on
given path '/home/viserion/texmf-dist/web2c' from specification
'selfautoparent:/texmf-dist/web2c'
resolvers   | resolving | looking for fallback 'contextcnf.lua' on
given path '/home/viserion/texmf/web2c' from specification
'selfautoparent:/texmf/web2c'
resolvers   | resolving |
resolvers   | resolving | warning: no lua configuration files found
resolvers   | resolving | no texmf paths are defined (using TEXMF)
resolvers   | resolving |
mtxrun  | the resolver databases are not present or outdated
mtx-install | provide valid server and instance
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

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

2022-01-15 Thread Fabrice Couvreur via ntg-context
Hi Hans
I just updated lmtx and this macro does not work although it did before. On
the other hand, no problem with context.
Thanks.
Fabrice

 \protected\def\e#1{\math{{\rm e}^{#1}}\autoinsertnextspace}

\starttext
\startformula
\e{a+b}
\stopformula
\stoptext


Le sam. 15 janv. 2022 à 16:14, Hans Hagen via ntg-context <
ntg-context@ntg.nl> a écrit :

> On 1/15/2022 3:52 PM, Alexandre Christe via ntg-context wrote:
> > Just came across a weird behavior with the latest upload.
> >
> > The following doesn't print as it should
> > \startformula 4^{2x} - 4^x - 25 = 0 \stopformula
> >
> > I don't think it's normal (I see the spacing to make room for anything
> > that comes after the first character in the exposant, but it is not
> > printed).
> i'll fix it ...
>
>
>
> -
>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] Conditional text appearing in a fixed vertical space

2022-01-11 Thread Fabrice L via ntg-context

> Le 11 janv. 2022 à 17:56, Gavin via ntg-context  a écrit :
> 
> Thanks Hans! This is great. I made a slight change to add an additional 
> feature. By moving the “mysolution” definition out of \startmode[solution], I 
> can now use mysolution in either mode. I’d use this if I want to give my 
> solution to one of the problems, as an example, on the handout.
> 
> -Gavin


I have similar problem for my courses. The solution I use, different than the 
one offered, is to write in a « special » color the text I want to hide from 
the students. This permits me to have hidden texts in figures for exemple. 
Also, I do not calculate space required, this is automated !  Here is MWE :

\enablemode[solution]

\doifmode{solution}{
 \definecolor[solcolor][magenta]
} 
\doifnotmode{solution}{
 \definecolor[solcolor][white]
} 
\definedescription[solution]
[color=solcolor]

\starttext

How many roads? \startcolor[solcolor] Professor note.\stopcolor
 \startsolution
   42 roads.
 \stopsolution

How much wood?
 \startsolution
   Alotta wood!
 \stopsolution

No more questions.

\stoptext

So the color used when solutions are hidden are white on white, we can not see 
the text;  but of course, if you change the background, you see the hidden 
text. So there is another step to the process (I usually do this only once a 
term); open the file in Acrobat, and find the option to delete hidden text. The 
text for which the color is the same as the background is really deleted. You 
can try to select the text in any pdf view/editor, the text is gone !  

Fabrice.


> 
> 
> % \enablemode[solution]
> 
> % Define "mysolution” for use independent of solution mode.
> \definenarrower[mysolution]
>  [before=\blank\it,
>   after=\blank]
> 
> % If in solution mode, define "solution" to use "mysolution"
> \startmode[solution]
>   \tolerant\protected\def\startsolution[#1]%
> {\startmysolution}
>   \protected\def\stopsolution
> {\stopmysolution}
> \stopmode
> 
> % If NOT in solution mode, define "solution" to produce a blank space
> \startnotmode[solution]
>   \tolerant\protected\def\startsolution[#1]%
> {\doifelsenothing{#1}{\blank[1in]}{\blank[#1]}
>  \gobbleuntil\stopsolution}
>   \protected\def\stopsolution
> {}
> \stopnotmode
> 
> 
> \starttext
> 
> How many roads?
>  \startsolution
>42 roads.
>  \stopsolution
> 
> How much wood?
>  \startsolution[1.5in]
>Alotta wood!
>  \stopsolution
> 
> No more questions.
> 
> \stoptext
> 
> 
>> On Jan 11, 2022, at 1:13 PM, Hans Hagen  wrote:
>> 
>> On 1/11/2022 8:50 PM, Gavin via ntg-context wrote:
>>> Hello List,
>>> I am making problem sets for a physics class. Solutions use the style 
>>> defined in the example below, and only appear if the “solution” mode is 
>>> enabled. I am struggling to get a vertical space for the solution which is 
>>> the same whether or not the solution is printed. Different problems require 
>>> different amounts of space, so this should be an argument or key-value.
>>> In the example below, the first solution has the desired behavior. The 
>>> second solution has the syntax I’d like, but it doesn’t make the space 
>>> without a solution.
>>> Any ideas would be welcome! I am still pretty new to ConTeXt, so I struggle 
>>> mixing things like the plain tex \vbox and ConTeXt \start…\stop concepts.
>>> Thanks,
>>> Gavin
>>> \definemode[solution][yes] % yes to enable solutions, no to disable
>>> \definebuffer  [solution] % Captures solution in a buffer that isn't used
>>> \startmode[solution] % If in solution mode, redefine 
>>> \startsolution...\stopsolution
>>> \definedelimitedtext[solution][ % Solution italic and indented
>>>  spacebefore=medium,
>>>  spaceafter=medium,
>>>  style=\rm\it,
>>>  leftmargin=standard, % Indents block on the left
>>>  rightmargin=yes, % Indents block on the right
>>>  indentnext=no,
>>>  before=\vbox to 1in\bgroup,
>>>  after=\egroup,
>>> ]
>>> \stopmode
>>> \starttext
>>> How many roads? (The 1-inch space below appears whether or not it contains 
>>> a solution.)
>>> \vbox to 1in{%
>>>  \startsolution
>>>42 roads.
>>>  \stopsolution
>>> }
>>> How much wood? (I would like to define solution so this to behaves like the 
>>> previous question.)
>>> \startsolution[1in]
>>>  Alotta wood!
>>> \stopsolution
>>> No more questions.
>>> \stoptext
>> a mix between big and low level
>> 
>> % \

Re: [NTG-context] Documentation about CTX installation on MacOS X

2022-01-02 Thread Fabrice L via ntg-context
Hi,

> Le 2 janv. 2022 à 21:26, Jean-Pierre Delange via ntg-context 
>  a écrit :
> 
> First of all : Happy New Year everybody (despite some difficulties due to 
> public policies against the epidemic !
> 
> Now my question : I want to try CTX (ConTeXt  ver: 2021.12.30) on MacOS X 
> (currently 10.13  High Sierra), while I was formerly working with old 
> versions on Linux and Windows based systems. Among other difficulties (like 
> how to export OSFONDIR permanently), I don’t find the clever command . 
> setuptex, which made possible a bunch of other commands (like context —make 
> and context —generate). Even if a lot of things on MacOS X seem to share with 
> Unix-like systems, I am looking for detailed documentation concerning a well 
> done installation of CTX on MacOS X. 
> Thank you very much for your help !
> JP  

On MacOS, I usually follow with success this page of the wiki :
https://wiki.contextgarden.net/Installing_ConTeXt_LMTX_on_MacOS

Regarding modules, on MacOS, the script described here (again on the wiki) 
works well for me:
https://wiki.contextgarden.net/Modules#ConTeXt_LMTX

Finally, I use TexPad as my context/metafun editor, and if you need some help 
to set it up, I can describe my setup in details. 
Fabrice.



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

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

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


[NTG-context] Strange behavior with \startbodymatter ... \stopbodymatter

2021-12-28 Thread Fabrice Couvreur via ntg-context
Hi,
In my file cours_premiere.tex if I indicate

 \startbodymatter
\component[probabilites.tex]
 \stopbodymatter

I get the following error message

tex error   > tex error on line 49 in file ./cours_premiere.tex:
Undefined control sequence \pgfmath@settrigformat


\pgfmath@settrigformat
\pgfmath@settrigformat \pgfmath@settrigformat

\stopbodymatter

39[criterium=all,
40interaction=all,
41 alternative=c]
42
43   \stoptitle
44
45 \stopfrontmatter
46
47 \startbodymatter
48 \component[probabilites.tex]
49 >>  \stopbodymatter
50
51
52 \stopproduct
The control sequence at the end of the top line of your error message was
never
\def'ed. You can just continue as I'll forget about whatever was undefined.
mtx-context | fatal error: return code: 1

TeX Output exited abnormally with code 1 at Tue Dec 28 15:31:31


On the other hand, if I indicate

\component[probabilites.tex]

 the file compiles without error.
Thanks
Fabrice
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

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


Re: [NTG-context] MP: problem connecting paths.

2021-12-20 Thread Fabrice L via ntg-context
Dear Mikael,

> Le 20 déc. 2021 à 12:14, Mikael Sundqvist  a écrit :
> 
> Hi,
> 
> I will try again. What if you do
> 
> newcircleA := newcircleA scrutinized 2;
> 
> after your definition of newcircleA?

Once I understood I had to compile with LMTX, this works like magic ! I spent 
hours to find a solution… but here is a solution ! 
Thanks a lot ! 
> 
> /Mikael

Fabrice.
> 
> 
> On Mon, Dec 20, 2021 at 3:45 PM Fabrice L  wrote:
>> 
>> Thanks Mikael,
>> 
>> Le 20 déc. 2021 à 02:21, Mikael Sundqvist via ntg-context 
>>  a écrit :
>> 
>> Hi,
>> 
>> would it be an option for you to do
>> 
>> newcircleA := circleA cutbefore P1 cutafter P2 -- cycle ;
>> 
>> In that case you avoid extra points.
>> 
>> 
>> You are right, in this simple case, your solution avoid the problem, and is 
>> applicable in some of my cases (I have to rethink the code). Thanks for the 
>> proposition !
>> But in others cases this is not possible (I think). Imagine I wish to do a « 
>> partial moon » from the two circles in my minimal example (see bottom right 
>> of the attached pdf):
>> 
>> 
>> newcircleA := circleA cutbefore P1 cutafter P2 .. reverse(circleB cutbefore 
>> P1 cutafter P2)  .. cycle;
>> 
>> I need 10 points to define the shape, but as my connections are duplicated, 
>> I have 12 points.
>> 
>> The solution (I thought) would be to use the « & » operator :
>> newcircleA := circleA cutbefore P1 cutafter P2 & reverse(circleB cutbefore 
>> P1 cutafter P2) & cycle ;
>> 
>> But this does not work (same reason as before: "! Paths don't touch; `&' 
>> will be changed to `..'.").
>> 
>> The compete minimal code (if somebody wants to plus with it) is here :
>> 
>> % ———
>> \startMPpage
>> path circleA , circleB ;
>> pair P[];
>> defaultscale := 0.4 ;
>> 
>> circleA := fullcircle scaled 1in randomized 3 ;
>> circleB := fullcircle scaled 1in randomized 3 shifted(0.3in,0.3in) ;
>> 
>> draw circleA withcolor blue ;
>> draw circleB withcolor red ;
>> 
>> P[1] := circleA intersectionpoint circleB ;
>> dotlabel.lft("$P_1$",P[1]) ;
>> dotlabel.rt("$\blue\tfx P_0^A$",point 0 of circleA) ;
>> P[2] := reverse(circleA) intersectionpoint circleB ;
>> dotlabel.rt("$P_2$",P[2]) ;
>> dotlabel.rt("$\red\tfx P_0^B$",point 0 of circleB) ;
>> 
>> path newcircleA , newcircleB ;
>> % newcircleA := (circleA cutbefore P1 cutafter P2 ) & (P2 -- P1) & cycle  ;
>> % previous line gives an error :
>> % "! Paths don't touch; `&' will be changed to `..'."
>> newcircleA := circleA cutbefore P1 cutafter P2 -- (P2 -- P1) -- cycle  ;
>> newcircleA := newcircleA xshifted 2in ;
>> draw newcircleA  withcolor darkgreen ;
>> 
>> newcircleB := (circleB cutafter P1)  -- (P1 -- P2) -- (circleB cutbefore P2 
>> ) & cycle ;
>> newcircleB := newcircleB xshifted 2in ;
>> draw newcircleB withcolor black ;
>> drawpoints newcircleA ; drawpointlabels newcircleA ;
>> 
>> % Mikael solution
>> newcircleA := circleA cutbefore P1 cutafter P2 -- cycle ;
>> newcircleA := newcircleA yshifted -1.5in ;
>> draw newcircleA  withcolor darkgreen ;
>> drawpoints newcircleA ; drawpointlabels newcircleA ;
>> 
>> % partial moon
>> newcircleA := circleA cutbefore P1 cutafter P2
>> .. reverse(circleB cutbefore P1 cutafter P2) .. cycle;
>> % & (reverse(circleB) cutbefore P2 cutafter P1) & cycle;
>> newcircleA := newcircleA shifted(2in,-1.5in) ;
>> draw newcircleA  withcolor magenta ;
>> drawpoints newcircleA ; drawpointlabels newcircleA ;
>> 
>> \stopMPpage
>> % ———
>> 
>> Thanks for any help !
>> Fabrice.
>> 
>> 
>> /Mikael
>> 
>> On Mon, Dec 20, 2021 at 5:30 AM Fabrice L via ntg-context
>>  wrote:
>> 
>> 
>> Dear list,
>> 
>> I have a problem connecting path with the operator « & » (page 16 Metafun 
>> manual). The problem is illustrated by the code (and the joined PDF) which 
>> follows.
>> 
>> I draw random cycled  forms (left part of the figure) and when they 
>> interact, they are modified to « fit together » (right part of the figure) . 
>> When building these new forms, I connect paths (usually two or three 
>> depending on position 0 of the path); the last point a path is the same as 
>> the first point of the next path ; for exemple, to modify the blue circle, 
>

Re: [NTG-context] MP: problem connecting paths.

2021-12-20 Thread Fabrice L via ntg-context
Thanks Mikael,Le 20 déc. 2021 à 02:21, Mikael Sundqvist via ntg-context <ntg-context@ntg.nl> a écrit :Hi,would it be an option for you to donewcircleA := circleA cutbefore P1 cutafter P2 -- cycle ;In that case you avoid extra points.You are right, in this simple case, your solution avoid the problem, and is applicable in some of my cases (I have to rethink the code). Thanks for the proposition ! But in others cases this is not possible (I think). Imagine I wish to do a « partial moon » from the two circles in my minimal example (see bottom right of the attached pdf): 

test.pdf
Description: Adobe PDF document
newcircleA := circleA cutbefore P1 cutafter P2 .. reverse(circleB cutbefore P1 cutafter P2)  .. cycle; I need 10 points to define the shape, but as my connections are duplicated, I have 12 points. The solution (I thought) would be to use the « & » operator :newcircleA := circleA cutbefore P1 cutafter P2 & reverse(circleB cutbefore P1 cutafter P2) & cycle ; But this does not work (same reason as before: "! Paths don't touch; `&' will be changed to `..'."). The compete minimal code (if somebody wants to plus with it) is here :% ———\startMPpagepath circleA , circleB ;pair P[];defaultscale := 0.4 ;circleA := fullcircle scaled 1in randomized 3 ;circleB := fullcircle scaled 1in randomized 3 shifted(0.3in,0.3in) ;draw circleA withcolor blue ;draw circleB withcolor red ;P[1] := circleA intersectionpoint circleB ;dotlabel.lft("$P_1$",P[1]) ;dotlabel.rt("$\blue\tfx P_0^A$",point 0 of circleA) ;P[2] := reverse(circleA) intersectionpoint circleB ;dotlabel.rt("$P_2$",P[2]) ;dotlabel.rt("$\red\tfx P_0^B$",point 0 of circleB) ;path newcircleA , newcircleB ;% newcircleA := (circleA cutbefore P1 cutafter P2 ) & (P2 -- P1) & cycle  ;% previous line gives an error :% "! Paths don't touch; `&' will be changed to `..'."newcircleA := circleA cutbefore P1 cutafter P2 -- (P2 -- P1) -- cycle  ;newcircleA := newcircleA xshifted 2in ;draw newcircleA  withcolor darkgreen ;newcircleB := (circleB cutafter P1)  -- (P1 -- P2) -- (circleB cutbefore P2 ) & cycle ; newcircleB := newcircleB xshifted 2in ;draw newcircleB withcolor black ;drawpoints newcircleA ; drawpointlabels newcircleA ;% Mikael solution newcircleA := circleA cutbefore P1 cutafter P2 -- cycle ;newcircleA := newcircleA yshifted -1.5in ;draw newcircleA  withcolor darkgreen ;drawpoints newcircleA ; drawpointlabels newcircleA ;% partial moon newcircleA := circleA cutbefore P1 cutafter P2 	.. reverse(circleB cutbefore P1 cutafter P2) .. cycle; %	& (reverse(circleB) cutbefore P2 cutafter P1) & cycle; newcircleA := newcircleA shifted(2in,-1.5in) ;draw newcircleA  withcolor magenta ;drawpoints newcircleA ; drawpointlabels newcircleA ;\stopMPpage% ———Thanks for any help ! Fabrice./MikaelOn Mon, Dec 20, 2021 at 5:30 AM Fabrice L via ntg-context<ntg-context@ntg.nl> wrote:Dear list,I have a problem connecting path with the operator « & » (page 16 Metafun manual). The problem is illustrated by the code (and the joined PDF) which follows.I draw random cycled  forms (left part of the figure) and when they interact, they are modified to « fit together » (right part of the figure) . When building these new forms, I connect paths (usually two or three depending on position 0 of the path); the last point a path is the same as the first point of the next path ; for exemple, to modify the blue circle, named « circleA », I take the circle A from P1 to P2, then a segment from P2 to P1 and cycle to have a closed path. So I should be able to do :newcircleA := circleA cutbefore P1 cutafter P2 & (P2 -- P1) & cycle  ;The « & » operator is supposed to work (if I understand correctly) in this case, but I have this error message :"! Paths don't touch; `&' will be changed to `..’."Which I do not understand since the paths « touch ». There was a similar question last year, without a clear answer («METAPOST subpath rounding issue »https://www.mail-archive.com/ntg-context@ntg.nl/msg94294.html).A solution is to ignore the repeating points :newcircleA := circleA cutbefore P1 cutafter P2 -- (P2 -- P1) -- cycle  ;but this new shape has 9 points instead of 7. The problem is that I do these operations a number of times, and the length of a path (in the number of points) is increasing and cause trouble when I look for intersections with others shapes.Here is the MWE:\startMPpagepath circleA , circleB ;pair P[];circleA := fullcircle scaled 1in randomized 3 ;circleB := fullcircle scaled 1in randomized 3 shifted(0.3in,0.3in) ;draw circleA withcolor blue ;draw circleB withcolor red ;P[1] := circleA intersectionpoint circleB ;dotlabel.lft("$P_1$",P[1]) ;dotlabel.rt("$\blue\tfx P_0^A$",point 0 of circleA) ;P[2] := reverse(circleA) intersectionpoint circleB ;dotlabel.rt("$P_2$",P[2]) ;dotlabel.rt(

[NTG-context] MP: problem connecting paths.

2021-12-19 Thread Fabrice L via ntg-context
Dear list,

I have a problem connecting path with the operator « & » (page 16 Metafun 
manual). The problem is illustrated by the code (and the joined PDF) which 
follows. 

I draw random cycled  forms (left part of the figure) and when they interact, 
they are modified to « fit together » (right part of the figure) . When 
building these new forms, I connect paths (usually two or three depending on 
position 0 of the path); the last point a path is the same as the first point 
of the next path ; for exemple, to modify the blue circle, named « circleA », I 
take the circle A from P1 to P2, then a segment from P2 to P1 and cycle to have 
a closed path. So I should be able to do :

newcircleA := circleA cutbefore P1 cutafter P2 & (P2 -- P1) & cycle  ;

The « & » operator is supposed to work (if I understand correctly) in this 
case, but I have this error message :

"! Paths don't touch; `&' will be changed to `..’."

Which I do not understand since the paths « touch ». There was a similar 
question last year, without a clear answer (« 
METAPOST subpath rounding issue 
»https://www.mail-archive.com/ntg-context@ntg.nl/msg94294.html). 

A solution is to ignore the repeating points :
newcircleA := circleA cutbefore P1 cutafter P2 -- (P2 -- P1) -- cycle  ;
but this new shape has 9 points instead of 7. The problem is that I do these 
operations a number of times, and the length of a path (in the number of 
points) is increasing and cause trouble when I look for intersections with 
others shapes.

Here is the MWE:

\startMPpage
path circleA , circleB ;
pair P[];

circleA := fullcircle scaled 1in randomized 3 ;
circleB := fullcircle scaled 1in randomized 3 shifted(0.3in,0.3in) ;

draw circleA withcolor blue ;
draw circleB withcolor red ;

P[1] := circleA intersectionpoint circleB ;
dotlabel.lft("$P_1$",P[1]) ;
dotlabel.rt("$\blue\tfx P_0^A$",point 0 of circleA) ;
P[2] := reverse(circleA) intersectionpoint circleB ;
dotlabel.rt("$P_2$",P[2]) ;
dotlabel.rt("$\red\tfx P_0^B$",point 0 of circleB) ;

path newcircleA , newcircleB ;
% newcircleA := circleA cutbefore P1 cutafter P2 & (P2 -- P1) & cycle  ;
% previous line gives an error :
% "! Paths don't touch; `&' will be changed to `..'."
newcircleA := circleA cutbefore P1 cutafter P2 -- (P2 -- P1) -- cycle  ;
newcircleA := newcircleA xshifted 2in ;
draw newcircleA  withcolor darkgreen ;

newcircleB := (circleB cutafter P1)  -- (P1 -- P2) -- (circleB cutbefore P2 ) & 
cycle ; 
newcircleB := newcircleB xshifted 2in ;
draw newcircleB withcolor black ;
drawpoints newcircleA ; drawpointlabels newcircleA ;

\stopMPpage



test.pdf
Description: Adobe PDF document



I would appreciate any help ! Thanks ! 
Fabrice. 

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

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


Re: [NTG-context] Status of Asymptote

2021-12-06 Thread Fabrice L via ntg-context
Dear Gavin,

> Le 6 déc. 2021 à 10:11, Gavin via ntg-context  a écrit :
> 
> Hi Alex,
> 
> I don’t know the status of Asymptote. I am using TikZ and pgfplots for 3D, 
> with satisfactory results (example below). However, it is slow, so use the 
> buffer mechanism to prevent redrawing with every run.
> 
> TIkZ/pgfplots is the best short term solution for diagrams I need right now. 
> I am concerned that TikZ will eventually not work with ConTeXt, so for a long 
> term solution I am trying to make diagrams with Metapost, using Lua to do the 
> heavy computational work. This is not easy, but the diagrams are super fast, 
> and I think they will always work.

I would be very interested to see an example of a Metafun drawing made with the 
help of LuaTeX to speed up some calculations. 
Thanks ! 

> Hope that helps.
> Gavin

Fabrice.


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

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


Re: [NTG-context] Blocks inside a conditional mode.

2021-11-29 Thread Fabrice L via ntg-context
Dear Hans,

> Le 29 nov. 2021 à 03:54, Hans Hagen  a écrit :
> 
> On 11/29/2021 2:54 AM, Fabrice L via ntg-context wrote:
> 
>> The only inconvenient of this solution if that I have to define 15 blocks 
>> (one for each week of the term): ComplementOne, ComplementTwo, 
> \defineblock[example]
> 
> \starttext
> 
>   \beginexample[Two]
>   Last course, we have seen A.
>   \endexample
> 
>   \beginexample[Three]
>   Last course, we have seen B….
>   \endexample
> 
>   \beginexample[Three]
>   Last course, we have seen C….
>   \endexample
> 
>\useblocks[example][Two]
> % \useblocks[example][Three]
> 
> \stoptext
> 
> %


Thanks (again). ConTeXt is always full of ressource ! I did not know we could 
do this, even if I realized now that there is a similar example in the wiki. 

For the list, in case in the future this would be useful for another user, 
below is the complete minimal example using this approach.


% - Minimal working example :

\setuppapersize[S5][S5]
\enablemode[Professor]

\defineblock[Complement]
\setupblock[Complement][

before={\page[yes]\setuppagenumber[state=stop]\setupheadertexts[]\setupbackgrounds[page][background=color,backgroundcolor=red]},
after={\page[yes]\setuppagenumber[state=start]}]

\starttext

% Let's process the summaries  ;
\beginComplement[Two]
Last course, we have seen A.
\endComplement

\beginComplement[Three]
Last course, we have seen B….
\endComplement

\beginComplement[Three]
Last course, we have seen C….
\endComplementThree

\beginComplement[Four]
Last course, we have seen D….
\endComplementFour
\beginComplement
and E !
\endComplementFour
%  summaries: end   ;

Let's begin course 1. 
This is course 1 : a lot of pages here about A! 
\page[yes]

Let's begin course 2. 
\doifmode{Professor} {
\useblocks[Complement][Two]
}

This is course 2 : a lot of pages here about B and C! 

\page[yes]
Let's begin course 3. 
\doifmode{Professor} {
\useblocks[Complement][Three]
}   

This is course 3 : a lot of pages here about D... ! 
\doifmode{Professor} {
\useblocks[Complement][Four]
}   

    The course 4 ! 
\stoptext

% - Minimal working example  : end 


Fabrice.

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

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


Re: [NTG-context] Blocks inside a conditional mode.

2021-11-28 Thread Fabrice L via ntg-context
Thanks Hraban for your answer, 

> Le 28 nov. 2021 à 15:42, Henning Hraban Ramm via ntg-context 
>  a écrit :
> 
> Am 28.11.21 um 19:39 schrieb Fabrice L via ntg-context:
>> I have an error when I try to insert a block inside a conditional mode (but 
>> there is two nested conditional mode.. is this the problem ?).
> 
> You can’t nest modes in \startmode ... \stopmode.
> I don’t know what are the limitations of \doifmode.

According to the wiki, we cannot nest several \startmode …\stopmode, but there 
is no limitation with \doifmode.

> 
> Maybe it helps to use additional grouping with {}, \bgroup .. \egroup or 
> \start .. \stop.

Following your advice, I tried with several {}, but no luck. 
> 
>> In my courses notes, I insert some blocks (named «  Complement » in the 
>> minimal exemple below) when in « Professor » mode. This works fine, as shown 
>> in the first «  \beginComplement … \endComplement  » of my example below.
> 
> Maybe you can work with buffers or (ConTeXt) blocks (the latter were recently 
> discussed here, it’s a quite unknown mechanism).

I already use blocks, but following your message, I tried to think differently. 
One solution would be to define a block for each course. Something like this (a 
working minimal example, redone in order this would be more easier to 
understand (I hope!) what I’m trying to do):

% —
\setuppapersize[S5][S5]
\enablemode[Professor]

\defineblock[ComplementTwo]
\defineblock[ComplementThree]

\setupblock[ComplementTwo,ComplementThree][

before={\page[yes]\setuppagenumber[state=stop]\setupheadertexts[]\setupbackgrounds[page][background=color,backgroundcolor=red]},
after={\page[yes]\setuppagenumber[state=start]}]
\starttext

% Let's process the summaries  ;
\beginComplementTwo
Last course, we have seen A.
\endComplementTwo

\beginComplementThree
Last course, we have seen B….
\endComplementThree

\beginComplementThree
Last course, we have seen C….
\endComplementThree
%  

Let's begin course 1. 
This is course 1 : a lot of pages here about A! 
\page[yes]

Let's begin course 2. 
\doifmode{Professor} {
\useblocks[ComplementTwo]
}

This is course 2 : a lot of pages here about B and C! 

\page[yes]
Let's begin course 3. 
\doifmode{Professor} {
\useblocks[ComplementThree]
}   

This is course 3 : a lot of pages here about D... ! 

\stoptext

%— 

The only inconvenient of this solution if that I have to define 15 blocks (one 
for each week of the term): ComplementOne, ComplementTwo, .., 
ComplementFithteen… Another drawback of this is difficult to move one block 
form one week to another if I change something. Each block here correspond in 
fact to a summary of the previous course. So I have typically around 10 pages 
of summary for each course. The challenge is that the content of each course is 
not exactly the same form one term to another, so I have to move a page to the 
summary from one course to the other one, like in a given term, if teach about 
subject C in course 3 :

\beginComplementThree
Last course, we have seen C….
\endComplementThree

, but next term in course 4:

\beginComplementFour
Last course, we have seen C….
\\beginComplementFour

I have to manually change \beginComplementThree … \endComplementThree to 
\beginComplementFour … \beginComplementFour.

But I will do this if I do not find another solution. 
Thanks again Hraban.
Fabrice. 

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

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

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


[NTG-context] Blocks inside a conditional mode.

2021-11-28 Thread Fabrice L via ntg-context
Dear list,

I have an error when I try to insert a block inside a conditional mode (but 
there is two nested conditional mode.. is this the problem ?).  

In my courses notes, I insert some blocks (named «  Complement » in the minimal 
exemple below) when in « Professor » mode. This works fine, as shown in the 
first «  \beginComplement … \endComplement  » of my example below. 

But now I have to use another condition for some blocks, depending of the 
number of the current course. So I insert my block with a condition, here « 
CourseOne » :

\enablemode[CourseOne]
\doifmode{CourseOne}{
\beginComplement
Another complementary slide. 
\endComplement
}

But this does not work :

% 
tex error   > tex error on line 1 in file 
/Users/fabricel/context/tex/texmf-context/tex/context/base/mkiv/cont-yes.mkiv: 
! TeX capacity exceeded, sorry [input stack size=5]
% 

The problem can be summarized in this minimal non working example : 

% — MWE —
\setuppapersize[S5][S5]
\enablemode[Professor]

\defineblock[Complement]
\setupblock[Complement][

before={\page[yes]\setuppagenumber[state=stop]\setupheadertexts[]\setupbackgrounds[page][background=color,backgroundcolor=red]},
after={\page[yes]\setuppagenumber[state=start]}]
\doifallmodes{Professor} {
\keepblocks[Complement]
}

\starttext

page 1

\beginComplement
A complementary slide. 
\endComplement

page 2

\enablemode[CourseOne]
\doifmode{CourseOne}{
\beginComplement
Another complementary slide but only for course number 1. 
\endComplement
}
\disablemode[CourseOne]

page 3

\enablemode[CourseTwo]
\doifmode{CourseTwo}{
\beginComplement
Another complementary slide but only for course number 2. 
\endComplement
}
\disablemode[CourseTwo]

\stoptext
\stoptext

% — MWE —

Blocks and modes usually works fine for me, but here, I do not understand my 
error.
Thanks for any help ! 

Fabrice. 


Note : in case this way of doing things seems a bit silly, here are more 
explanations. I do use mode « CourseOne »  here because in the real life, the 
content in the condition «  \doifmode{CourseOne}{ …} » is read in an external 
file, containing material for « CourseOne », « CourseTwo », etc. The setup is 
then, in the main file :

% Main file : begin 

Bla bla bla ...

\enablemode[CourseOne]
\input ComplementMaterial.tex
\disablemode[CourseOne]

Bla bla bla ...

\enablemode[CourseOne]
\input ComplementMaterial.tex
\disablemode[CourseOne]

% Main file : end 

And in the « ComplementMaterial.tex » there is :

% ComplementMaterial.tex —

\doifmode{CourseOne}{
\beginComplement
A complementary slide but only for course number 1. 
\endComplement

\beginComplement
Another complementary slide but only for course number 1. 
\endComplement
}

\doifmode{CourseTwo}{
\beginComplement
A complementary slide but only for course number 2. 
\endComplement

\beginComplement
Another complementary slide but only for course number 2. 
\endComplement
}
% ComplementMaterial.tex —

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

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


[NTG-context] Compilation error with the new version of lmtx

2021-10-16 Thread Fabrice Couvreur via ntg-context
Hi,
The latest version of lmtx does not allow me to compile the following file
although there was no problem before.
Thank you
Fabrice

\startproduct[expertes-manual]

  \startfrontmatter

\setuppagenumbering
   [location=]

\definefont
  [ChapterTextStyle]
  [SansBold*default sa 2.2]

\setuphead
  [title]
  [style=ChapterTextStyle,
   align=flushright]

\setuplist
   [chapter]
   [style=bold,
alternative=b,
width=1em]

\setuplist
   [section]
   [margin=1em,
width=1.75em]

\setuplist
   [subsection]
   [margin=2.75em,
width=2em,
distance=\spaceamount]


\starttitle[title=Table des matières]

 \placelist
   [chapter,section,subsection]
   [criterium=all,
   interaction=all,
alternative=c]

  \stoptitle

\stopfrontmatter

\startbodymatter
\component[chapter_1]
\component[chapter_2]
\stopbodymatter


\stopproduct

##
tex error   > tex error on line 1 in file ./expertes.tex: Undefined
control sequence \undefined




\relax
 \p_maxwidth
\dostarttagged \t!listcontent \empty \clf_listtitle {\currentlist
}\currentlistindex \relax
\dostoptagged
 \strc_lists_limitated_text
#1->\edef \p_maxwidth {\listparameter \c!maxwidth }\ifempty \p_maxwidth
\listparameter \c!textcommand {#1}
\else \listparameter \c!textcommand {\limitatetext {#1}\p_maxwidth
{\splitsymbol {\listparameter \c!limittext }}}\fi
 \22>:140>:abc
...rence_attribute \v!text \strc_lists_set_style_color \c!textstyle
\c!textcolor \v!text \the \t_lists_every_renderingtext \the
\t_lists_every_renderingsynchronize \setstrut \begstrut
\strc_lists_limitated_text \currentlistentrytitle
\endstrut \en ...
 \currentlistextra
...\begingroup \ifempty \m_strc_list_alternative \edef
\currentlistalternative {\listparameter \c!alternative }\else \let
\currentlistalternative \m_strc_list_alternative \fi \directsetup
{\listalternativeparameter \c!renderingsetup }
\relax \endgr ...
 ...


alternative=c]

 1 >>  \startproduct[expertes-manual]
 2
 3   \startfrontmatter
 4
 5 \setuppagenumbering
 6[location=]
 7
 8 \definefont
 9   [ChapterTextStyle]
10   [SansBold*default sa 2.2]
11
The control sequence at the end of the top line of your error message was
never
\def'ed. You can just continue as I'll forget about whatever was undefined.
mtx-context | fatal error: return code: 256

TeX Output exited abnormally with code 1 at Sat Oct 16 19:28:21
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

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


[NTG-context] Framedtext : text out of frame

2021-09-26 Thread Fabrice Couvreur via ntg-context
Hi,
How to fix the small problem in the code below where the text goes out of
the frame ?
Thanks
Fabrice

\usecolors[x11]

\starttext
  \startframedtext[frame=off,width=\textwidth,
align={broad,right},indenting={yes},background=color,backgroundcolor=navajowhite1]
  \startitemize[columns,three,n]
\startitem
 Une quantité constante est une quantité déterminée, qui conserve
toujours la même valeur.
\stopitem\par
\startitem
  Une quantité variable est une quantité indéterminée, ou, si l'on
veut, une quantité universelle, qui comprend toutes les valeurs déterminées.
\stopitem\par
\startitem
  Une quantité variable devient déterminée, lorsqu'on lui attribue
une valeur déterminée quelconque.
\stopitem\par
\startitem
  Une fonction de quantité variable est une expression analytique
composée, de quelque manière que ce soit, de cette même quantité & de
nombres, ou de quantités constantes.

  Par exemple, \m{a+3z} ; \m{az-4zz} ;

  \m{az+b\sqrt{aa-zz}} , cz ; \m{etc}. sont des

  fonctions de \m{z}.
\stopitem\par
\startitem
  Une fonction de variable est

  donc aussi une quantité variable.
\stopitem\par
  \stopitemize
\stopframedtext
\stoptext1
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

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

2021-09-13 Thread Fabrice Couvreur via ntg-context
Hi Wolfgang,
I had done the same thing but I thought this solution was not the most
elegant, and I wanted to know what the specialists were going to do.
Thank you.
Fabrice

Le dim. 12 sept. 2021 à 16:50, Wolfgang Schuster via ntg-context <
ntg-context@ntg.nl> a écrit :

> Fabrice Couvreur via ntg-context schrieb am 12.09.2021 um 12:10:
>
> Hi Wolfgang,
> That's what I understood but the problem is that if I reduce the margin,
> the logo is too small in my opinion : what would you do ?
>
>
> Place the logo with a layer or shift is inwards.
>
> \setuplayout
>   [width=middle,
>height=middle]
>
> \setupfootertexts
>   [margin]
>   []
>   [{\offset[x=-1cm,y=\strutdp]{\externalfigure[logo.pdf][factor=max]}}]
>   []
>   [{\offset[x=1cm,y=\strutdp]{\externalfigure[logo.pdf][factor=max]}}]
>
> %\showframe
>
> \starttext
> \dorecurse{8}{\samplefile{knuth}}
> \stoptext
>
> 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] Image cropped

2021-09-12 Thread Fabrice Couvreur via ntg-context
Hi Wolfgang,
That's what I understood but the problem is that if I reduce the margin,
the logo is too small in my opinion : what would you do ?
Indeed the line is green but you will have understood: =)
Fabrice

Le sam. 11 sept. 2021 à 19:17, Wolfgang Schuster via ntg-context <
ntg-context@ntg.nl> a écrit :

> Fabrice Couvreur via ntg-context schrieb am 11.09.2021 um 17:52:
>
> Hi Wolfgang,
> The red frame is the print area ?
>
>
> The *green* frame are the margins of the A4 paper which is positioned in
> the middle of the A3 paper.
>
> The larger paper allows you to the see the part of the margins which are
> outside of the printable area.
>
> 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] Image cropped

2021-09-11 Thread Fabrice Couvreur via ntg-context
Hi Wolfgang,
The red frame is the print area ?

Le sam. 11 sept. 2021 à 16:43, Wolfgang Schuster via ntg-context <
ntg-context@ntg.nl> a écrit :

> Fabrice Couvreur via ntg-context schrieb am 11.09.2021 um 16:32:
>
> Hello,
> I like to put a logo on my statements but I noticed that the image is
> cropped on the edge.
> I tried to change the printer's print settings but was unsuccessful.
>
>
> Add these settings to your example and you see the problem.
>
> \setuppapersize[A4][A3]
>
> \setuplayout[location=middle]
>
> \setuplayout[width=middle,height=middle]
>
> \setupfootertexts
>[margin]
>[]
>[{\offset[y=\strutdp]{\externalfigure[logo.pdf][factor=max]}}]
>[]
>[{\offset[y=\strutdp]{\externalfigure[logo.pdf][factor=max]}}]
>
> \showframe
>
> \starttext
> \dorecurse{8}{\input knuth}
> \stoptext
>
>
> 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
___


[NTG-context] Image cropped

2021-09-11 Thread Fabrice Couvreur via ntg-context
Hello,
I like to put a logo on my statements but I noticed that the image is
cropped on the edge.
I tried to change the printer's print settings but was unsuccessful.
Thanks
Fabrice

\setuplayout[width=middle,height=middle]

\setupfootertexts
   [margin]
   []
   [{\offset[y=\strutdp]{\externalfigure[logo.pdf][factor=max]}}]
   []
   [{\offset[y=\strutdp]{\externalfigure[logo.pdf][factor=max]}}]

\showframe

\starttext
\dorecurse{8}{\input knuth}
\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] getting line numbers

2021-09-05 Thread Fabrice Couvreur via ntg-context
Hi,
I am trying to test this file but without success.
I just do context test.tex but I suspect that is not it.
When you say

> We compile and run:
>

Which command is it with ?
Thanks
Fabrice

Le ven. 3 sept. 2021 à 18:26, Hans Hagen via ntg-context 
a écrit :

> On 9/3/2021 3:53 PM, Aditya Mahajan via ntg-context wrote:
> > On Fri, 3 Sep 2021, Thierry Horsin via ntg-context wrote:
> >
> >> Hi everybody
> >>
> >> Is there a way to have an automatic access to the current line number
> of a specific place inside a tex file ? To be more precise, here is what I
> would like to do.
> >
> > Also look at the filter module.
> >
> >  https://github.com/adityam/filter
> >
> > Behind the scenes, it works by saving the content in an external file
> and then
> > running it through any external program. It also allows for caching the
> > result, and has many options for customizing the behavior.
> you forgot to mention that it also makes sure that you only process when
> there has been a change (after all calling gcc comes at a price)
>
> 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] Test for displaying a header

2021-08-26 Thread Fabrice Couvreur via ntg-context
Hi,
Using this (but it's not exactly what I want) it works

test-1.tex %%

\setuppagenumbering
  [alternative=doublesided,location=]

\definelayout
  [1]
  [header=10mm]

\setuplayout
  [header=0pt,
   height=middle]

\setupbackgrounds
   [header]
   [text]
   [frame=off,bottomframe=on,
 framecolor=lightgray,rulethickness=1pt]


\starttext
\dorecurse{5}{\samplefile{lorem}}
%\dorecurse{1}{\samplefile{lorem}}
\stoptext

%%ù

Using this (almost what I'm trying to do) without success

test-2.tex %
\setuppagenumbering
  [alternative=doublesided,location=]

\setupbackgrounds
  [header]
  [text]
  [frame=off,bottomframe=on,
   framecolor=lightgray,rulethickness=1pt]

\startsetups[header]
  \doifelse{\totalnumberofpages}{1}
{\setupheadertexts[\setups{header}]}
{}
\stopsetups


\starttext
\dorecurse{5}{\samplefile{lorem}}
%\dorecurse{1}{\samplefile[lorem]r}
\stoptext

%%%

Fabrice


Le jeu. 26 août 2021 à 17:56, Wolfgang Schuster via ntg-context <
ntg-context@ntg.nl> a écrit :

> Taco Hoekwater via ntg-context schrieb am 26.08.2021 um 16:34:
> >
> > Hi,
> >
> >> On 26 Aug 2021, at 16:07, Fabrice Couvreur via ntg-context <
> ntg-context@ntg.nl> wrote:
> >>
> >> Hi,
> >> I know I asked the question a few years ago, but I don't remember !
> >> The idea is to test whether the document contains only one page or not.
> >
> > Perhaps not the nicest solution, but this works:
> >
> > \doifvalueelse
> >{\lastpage}
> >{1}
> >{\message{true}}
> >{\message{false}}
>
>
> Same solution but better counter name:
>
> \doifelse{\totalnumberofpages}{1}{...}{...}
>
> 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
___


[NTG-context] Test for displaying a header

2021-08-26 Thread Fabrice Couvreur via ntg-context
Hi,
I know I asked the question a few years ago, but I don't remember !
The idea is to test whether the document contains only one page or not.
If it contains only one page, the header is enabled.
If it contains several pages, the header is enabled only on the first page
but not on the others.
Thanks
Fabrice
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

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


[NTG-context] Place a logo at the bottom of the page with a layer

2021-08-24 Thread Fabrice Couvreur via ntg-context
Hi,
I want to insert a logo at the bottom of the page on the right on the first
page, on the left on the second, on the right on the third ...
With the key repeat=yes, the logo is always at the bottom right
Thanks
Fabrice

\useMPlibrary[dum]

\definelayer
   [MyLogo]
   [x=0mm, y=0mm,
width=\paperwidth,
height=\paperheight,
repeat=yes]


\setupbackgrounds[page][background=MyLogo]

\setlayer
  [MyLogo]
  [hoffset=\dimexpr\textwidth+\backspace+\rightmargindistance\relax,
   voffset=\dimexpr\topspace+\textheight+\footerheight\relax]
   {\externalfigure[dum][width=\rightmarginwidth,height=\headerheight]}

\showframe

\starttext
\dorecurse{20}{\samplefile{lorem}}
\stoptext
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

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


[NTG-context] Adjustment for header and footer

2021-08-22 Thread Fabrice Couvreur via ntg-context
Hi,
In the file below (not minimal, sorry!) I am using commands from Wolfgang
in different threads. We can see that the top frame overflows into the
text: how to correct this ?
I would also like the top and bottom stroke to be adjusted to the width of
the paper.
Thanks
Fabrice

\useMPlibrary[dum]

\setuplayout
   [topspace=1cm,
backspace=3cm,
cutspace=3cm,
leftmargin=.75cm,
leftmargindistance=.5cm,
rightmargin=1.25cm,
rightmargindistance=1cm,
header=20mm,
headerdistance=1cm,
footer=20mm,
footerdistance=1cm,
width=middle,
height=middle,
location=middle]

\setupbodyfont
   [newcomputermodern-book,11pt]

\definefont
   [TextStyle]
   [SansBold*default sa 1.2]


\defineframed
  [headerframed]
  [frame=off,
   height=fit,
   width=fit,
  ]

\setupbackgrounds [header] [text]
   [frame=off,bottomframe=on,width=\widthpaper,
framecolor=darkred,rulethickness=1pt]

\setupbackgrounds [footer] [text]
   [frame=off,bottomframe=on,width=max,
   framecolor=darkred,rulethickness=1pt]

 \setupfootertexts
  [margin]
  []
  [{\offset[y=\strutdp]{\externalfigure[dum][factor=max]}}]
  []
  [{\offset[y=\strutdp]{\externalfigure[dum][factor=max]}}]

\startsetups [headertext]

\setupheadertexts
[{
\startframed [headerframed]
[foregroundstyle=TextStyle,align=middle]
\getvariable{headertext}{location}\\
 Spécialité mathématiques\\
\getvariable{headertext}{title} n\high{\tfxx \bf
o}\,\getvariable{headertext}{number}
\stopframed
}]

\setupheadertexts
[{
\startframed [headerframed]
[align=flushleft,foregroundstyle=\ssx]
Lycée LA SALLE\\
Durée : \getvariable{headertext}{time}\\

\date[d=\getvariable{headertext}{day},m=\getvariable{headertext}{month},y=\getvariable{headertext}{year}]
\stopframed
}]
[{
\startframed [headerframed]
[align=flushright,foregroundstyle=\ssx]
  \externalfigure[dum] [factor=max]
\stopframed
}]

\stopsetups

\setvariable{headertext}{set}{\directsetup{headertext}}


\setvariables
  [headertext]
  [title={Devoir maison},
   number={2},
   day={22},
   month={08},
   year={2021},
   location={Terminale},
   time={2 heures}]


\starttext
\samplefile{lorem}
\stoptext
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

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


[NTG-context] Strange behavior of a macro

2021-08-16 Thread Fabrice Couvreur via ntg-context
Hello,
I don't understand why this macro works with this simple example but return
the following error if I use it for chapters in my book.
Thanks
Fabrice


\setupbodyfont
   [newcomputermodern-book,11pt]

\unexpanded\def\N{\math{\mathbb{N}}\autoinsertnextspace}

\defineenumeration
   [test]
   [title=yes,
text={Test},
style=italic]

\starttext
\N
\starttest
\m{\forall n \in \N}
\stoptest
\stoptext


tex error   > tex error on line 64 in file ./terminale_suites_2.tex:
Use of \N doesn't match its definition




  Soient \u, \v deux suites définies sur \N,
 \m{l} et \m{l'} deux réels.

54 \startitem
55   \u converge vers \m{l},
56 \stopitem
57   \stopitemize
58   alors \m{l\geqslant 0}.
59 \stopproposition
60 \startremarque
61   Nous retiendrons que le passage à la limite sur une
inégalité stricte restitue une inégalité large.
62 \stopremarque
63 \startcorollaire
64 >>Soient \u, \v deux suites définies sur \N, \m{l} et \m{l'}
deux réels.
65
66   Si
67
68   \startitemize
69 \startitem
70   les suites \u et \v convergent respectivement vers
\m{l} et \m{l'},
71 \stopitem
72 \startitem
73   \m{\forall n \in\mathbb{N}, \thinspace u_n>v_n},
74 \stopitem
If you say, e.g., '\def\a1{...}', then you must always put '1' after '\a',
since control sequence names are made up of letters only. The macro here
has not
been followed by the required stuff, so I'm ignoring it.
mtx-context | fatal error: return code: 256

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

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/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] How not to display the header of the chapter page on the page with the table of contents ?

2021-08-16 Thread Fabrice Couvreur via ntg-context
Hi Wolfgang,
Pablo's solution works, but I tried yours without success. Here are the
main lines of my project

 begin product
\startproduct[terminale-manual]

\project[terminale-environment]

\startdocument

\startfrontmatter
...
\stopfrontmatter

\startbodymatter
\component[terminale_recurrence]
...
\stopbodymatter

\stopdocument

\stopproduct
 end product

 begin project
\startproject[terminale-environment]

\environment[terminale-style]
 ...
\stopproject
 end project

 begin component
\project[terminale-environment]

\startcomponent[terminale_recurrence]
...
\endcomponent
 end component

 begin environment
\startenvironment[terminale-style]
...
\startsetups [section:chapter]

\setuphead
   [chapter]
   [align=flushright,
textcommand=\groupedcommand{\blank[medium]}{},
numbercolor=darkgray,
textstyle=ChapterTextStyle,
numberstyle=ChapterNumberStyle,
before=\startChapterFrame,
after=\stopChapterFrame,
header=high]

\stopsetups

\startsectionblockenvironment [bodypart]
 \directsetup{section:chapter}
\stopsectionblockenvironment

\doifmode{*component}{\directsetup{section:chapter}}

...
\endenvironment
 end environment

Le dim. 15 août 2021 à 19:03, Wolfgang Schuster via ntg-context <
ntg-context@ntg.nl> a écrit :

> Pablo Rodriguez via ntg-context schrieb am 15.08.2021 um 18:33:
> > On 8/15/21 6:02 PM, Fabrice Couvreur via ntg-context wrote:
> >> A small note : this method works if I compile the project but if I
> >> compile only one chapter, the header no longer appears.
> > Hi Fabrice,
> >
> > I have never used projects and chapters (or whatever the right name is).
> >
> > I’m not sure I get what you’re experiencing: with a single chapter, do
> > you have the fancy layout or not?
> >
> > It would make sense that the fancy chapter doesn’t appear only compiling
> > a chapter. I guess there is no \startbodymatter...\stopbodymatter
> > wrapping it.
> >
> > Another approach would be:
> >
> > [...]
>
> Setting values for \title is a way to avoid the chapter setup for the
> table of contents etc.
> but there is a way to set values which are used only when you process a
> component file.
>
> To make it work one has to load the environment file after
> \startcomponent because you
> can use the *component mode to check whether the parent file is a
> product or a component.
>
>  begin product
> \startproduct [*]
>
> \environment [...]
>
> \startfrontmatter
> ...
> \stopfrontmatter
>
> \startbodymatter
> \component [...]
> \stopbodymatter
>
> \stopproduct
>  end product
>
>  begin component
> \startcomponent [*]
>
> \environment [...]
>
> ...
>
> \stopcomponent
>  end component
>
>  begin environment
> \startenvironment [*]
>
> \startsetups [section:chapter]
>
>  \setuphead
>  [chapter]
>  [...]
>
> \stopsetups
>
> \startsectionblockenvironment [bodypart]
>  \directsetup{section:chapter}
> \stopsectionblockenvironment
>
> \doifmode{*component}{\directsetup{section:chapter}}
>
> \stopenvironment
>  end environment
>
> 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
___


[NTG-context] Adjustment in the table of contents

2021-08-16 Thread Fabrice Couvreur via ntg-context
Hi,
I wish to have the table of contents as the attached image. The result is
almost as expected except for the margin of the subsection.

 \setuplist
   [chapter,section,subsection]
   [width=fit,distance=\spaceamount]

 \setuplist
   [chapter]
   [alternative=b]

 \setuplist [chapter][style=bold]


 \setuplist [section][margin=1em]
 \setuplist [subsection] [margin=2.75em]

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

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


Re: [NTG-context] How not to display the header of the chapter page on the page with the table of contents ?

2021-08-15 Thread Fabrice Couvreur via ntg-context
Hi Pablo,
The second solution works as I want it to
Thanks
Fabrice

Le dim. 15 août 2021 à 18:33, Pablo Rodriguez via ntg-context <
ntg-context@ntg.nl> a écrit :

> On 8/15/21 6:02 PM, Fabrice Couvreur via ntg-context wrote:
> > A small note : this method works if I compile the project but if I
> > compile only one chapter, the header no longer appears.
>
> Hi Fabrice,
>
> I have never used projects and chapters (or whatever the right name is).
>
> I’m not sure I get what you’re experiencing: with a single chapter, do
> you have the fancy layout or not?
>
> It would make sense that the fancy chapter doesn’t appear only compiling
> a chapter. I guess there is no \startbodymatter...\stopbodymatter
> wrapping it.
>
> Another approach would be:
>
> \setuphead
>[chapter]
>[align=flushright,
> textcommand=\groupedcommand{\blank[medium]}{},
> numbercolor=darkgray,
> textstyle=ChapterTextStyle,
> numberstyle=ChapterNumberStyle,
> before=\startChapterFrame,
> after=\stopChapterFrame,
> header=high]
>
> \setuphead
>   [title]
>   [header=empty,
>align=,
>textcommand=,
>textstyle=,
>style=\tfc,
>before={\blank[2*big]},
>after={\blank[2*big]}]
>
> I hope it helps,
>
> Pablo
>
> --
> http://www.ousia.tk
>
> ___
> If your question is of interest to others as well, please add an entry to
> the Wiki!
>
> maillist : ntg-context@ntg.nl /
> http://www.ntg.nl/mailman/listinfo/ntg-context
> webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
> archive  : https://bitbucket.org/phg/context-mirror/commits/
> wiki : http://contextgarden.net
>
> ___
>
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/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] How not to display the header of the chapter page on the page with the table of contents ?

2021-08-15 Thread Fabrice Couvreur via ntg-context
A small note : this method works if I compile the project but if I compile
only one chapter, the header no longer appears.

Le dim. 15 août 2021 à 17:01, Fabrice Couvreur 
a écrit :

> Hi Pablo,
> Thanks, it works.
> Fabrice
>
> Le dim. 15 août 2021 à 16:20, Pablo Rodriguez via ntg-context <
> ntg-context@ntg.nl> a écrit :
>
>> On 8/15/21 12:49 PM, Fabrice Couvreur via ntg-context wrote:
>> > Hello,
>> > Wolfgang created a
>> > heading https://mailman.ntg.nl/pipermail/ntg-context/2021/102870.html
>> > for the chapters of my book.
>> > How can I prevent this header from appearing on the page with the table
>> > of contents ?
>>
>> Hi Fabrice,
>>
>> a simple way would be:
>>
>>   \startsectionblockenvironment[bodypart]
>> \setuphead
>>[chapter]
>>[align=flushright,
>> textcommand=\groupedcommand{\blank[medium]}{},
>> numbercolor=darkgray,
>> textstyle=ChapterTextStyle,
>> numberstyle=ChapterNumberStyle,
>> before=\startChapterFrame,
>> after=\stopChapterFrame,
>> header=high]
>>   \stopsectionblockenvironment
>>
>> Then use frontmatter and bodymatter.
>>
>> Just in case it might 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] How not to display the header of the chapter page on the page with the table of contents ?

2021-08-15 Thread Fabrice Couvreur via ntg-context
Hi Pablo,
Thanks, it works.
Fabrice

Le dim. 15 août 2021 à 16:20, Pablo Rodriguez via ntg-context <
ntg-context@ntg.nl> a écrit :

> On 8/15/21 12:49 PM, Fabrice Couvreur via ntg-context wrote:
> > Hello,
> > Wolfgang created a
> > heading https://mailman.ntg.nl/pipermail/ntg-context/2021/102870.html
> > for the chapters of my book.
> > How can I prevent this header from appearing on the page with the table
> > of contents ?
>
> Hi Fabrice,
>
> a simple way would be:
>
>   \startsectionblockenvironment[bodypart]
> \setuphead
>[chapter]
>[align=flushright,
> textcommand=\groupedcommand{\blank[medium]}{},
> numbercolor=darkgray,
> textstyle=ChapterTextStyle,
> numberstyle=ChapterNumberStyle,
> before=\startChapterFrame,
> after=\stopChapterFrame,
> header=high]
>   \stopsectionblockenvironment
>
> Then use frontmatter and bodymatter.
>
> Just in case it might 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
___


[NTG-context] How not to display the header of the chapter page on the page with the table of contents ?

2021-08-15 Thread Fabrice Couvreur via ntg-context
Hello,
Wolfgang created a heading
https://mailman.ntg.nl/pipermail/ntg-context/2021/102870.html for the
chapters of my book.
How can I prevent this header from appearing on the page with the table of
contents ?
Thanks
Fabrice
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

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


Re: [NTG-context] Create an enumeration style

2021-08-11 Thread Fabrice Couvreur via ntg-context
I forgot this : how to reduce the font size for the exponents "er", "e" ?
Thanks
Fabrice

Le mer. 11 août 2021 à 12:41, Fabrice Couvreur 
a écrit :

> Hi Wolfgang,
> Many thanks
> Fabrice
>
> Le mer. 11 août 2021 à 10:23, Hans Hagen via ntg-context <
> ntg-context@ntg.nl> a écrit :
>
>> On 8/11/2021 10:09 AM, Otared Kavian via ntg-context wrote:
>> >
>> >
>> >> On 9 Aug 2021, at 18:10, Wolfgang Schuster via ntg-context <
>> ntg-context@ntg.nl> wrote:
>> >> (…)
>> >> core-con.lua (line 1155):
>> >>
>> >> local ordinals = {
>> >>  [...]
>> >>  french = function(n)
>> >>  if n == 1 then
>> >>  return "er"
>> >> +   else
>> >> +   return "e"
>> >>  end
>> >>  end,
>> >> }
>> >
>> > Hi Wolfgang,
>> >
>> > Thanks for the example and the fix, but I would rather think that the «
>> french » part of ordinals should be
>> >
>> >   french = function(n)
>> >   if n == 1 then
>> >   return « er"
>> >   else
>> >return « ème"
>> >   end
>> >   end,
>> >
>> > Now if this were not accepted as a fix in core-con.lua, is there a way
>> for a user to change the default to the above choice in his document ?
>>
>> it is no problem to fix if you all can agree on what/how to fix ...
>>
>> 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] Create an enumeration style

2021-08-11 Thread Fabrice Couvreur via ntg-context
Hi Wolfgang,
Many thanks
Fabrice

Le mer. 11 août 2021 à 10:23, Hans Hagen via ntg-context 
a écrit :

> On 8/11/2021 10:09 AM, Otared Kavian via ntg-context wrote:
> >
> >
> >> On 9 Aug 2021, at 18:10, Wolfgang Schuster via ntg-context <
> ntg-context@ntg.nl> wrote:
> >> (…)
> >> core-con.lua (line 1155):
> >>
> >> local ordinals = {
> >>  [...]
> >>  french = function(n)
> >>  if n == 1 then
> >>  return "er"
> >> +   else
> >> +   return "e"
> >>  end
> >>  end,
> >> }
> >
> > Hi Wolfgang,
> >
> > Thanks for the example and the fix, but I would rather think that the «
> french » part of ordinals should be
> >
> >   french = function(n)
> >   if n == 1 then
> >   return « er"
> >   else
> >return « ème"
> >   end
> >   end,
> >
> > Now if this were not accepted as a fix in core-con.lua, is there a way
> for a user to change the default to the above choice in his document ?
>
> it is no problem to fix if you all can agree on what/how to fix ...
>
> 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
___


[NTG-context] Create an enumeration style

2021-08-08 Thread Fabrice Couvreur via ntg-context
Hello,
Is it possible to create an enumeration style to get this :
1 ^ {er} exemple
2 ^ {e}  exemple
3 ^ {e} exemple 
Thanks
Fabrice
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

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


Re: [NTG-context] Question about \groupedcommand{}{}

2021-07-28 Thread Fabrice Couvreur via ntg-context
Hi Wolfgang,
Thank you for this nice solution.
Fabrice

Le mar. 27 juil. 2021 à 21:31, Wolfgang Schuster via ntg-context <
ntg-context@ntg.nl> a écrit :

> Fabrice Couvreur via ntg-context schrieb am 27.07.2021 um 18:57:
> > Hi,
> > The name of the environment must always end with a dot both with a title
> > and without title. How to do ?
> > Thanks
> > Fabrice
> >
> > [...]
>
>
> You can create simple dummy environments to test the parameters.
>
> \defineenumeration
>[grouptest]
>[title=yes,
>  text={dummy text},
> titleleft=,
>titleright=,
>   headcommand=\groupedcommand{[}{]},
> numbercommand=\groupedcommand{(}{)},
>  titlecommand=\groupedcommand{<}{>}]
>
> \starttext
>
> \startgrouptest [title={dummy title}]
> \unknown
> \stopgrouptest
>
> \startgrouptest
> \unknown
> \stopgrouptest
>
> \blank[2*line]
>
> \setupenumeration
>[grouptest]
>[number=no]
>
> \startgrouptest [title={dummy title}]
> \unknown
> \stopgrouptest
>
> \startgrouptest
> \unknown
> \stopgrouptest
>
> \stoptext
>
> 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
___


[NTG-context] Question about \groupedcommand{}{}

2021-07-27 Thread Fabrice Couvreur via ntg-context
Hi,
The name of the environment must always end with a dot both with a title
and without title. How to do ?
Thanks
Fabrice

\setupenumerations
  [before={\blank},
   after={\blank},
   alternative=serried,
   title=yes,
   titleleft={(},
   titleright={)},
   titlestyle=normal,
   titlecommand=\groupedcommand{}{\bf.},
   width=broad]

\defineenumeration
   [definition]
   [text=Définition,
number=no,
headcommand=\groupedcommand{}{},
style=italic]

\starttext
\startdefinition{With a title}
\samplefile{lorem}
\stopdefinition
Without title but no dot after the name of the environment.
\startdefinition
\samplefile{lorem}
\stopdefinition
\stoptext
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

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


[NTG-context] Macro that does not work in an environment

2021-07-27 Thread Fabrice Couvreur via ntg-context
Hello,
How to make the macro work in the environment definition ?
Thank you
Fabrice


\unexpanded\def\card#1{\math{\text{Card}\thinspace#1}}

\defineenumeration
   [definition]
   [text=Définition,
number=no,
headcommand=\groupedcommand{}{.},
style=italic]

\starttext

 \startdefinition
   Soit E un ensemble fini. Le cardinal de E, noté \card{E}, est le nombre
d'éléments de E.

   En particulier, nous avons  \m{\card{\emptyset}=0}.
 \stopdefinition

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

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


[NTG-context] Adjust the length of a frame

2021-07-27 Thread Fabrice Couvreur via ntg-context
-- Forwarded message -
De : Fabrice Couvreur 
Date: lun. 26 juil. 2021 à 13:13
Subject: Texte source 30 / 5000 Résultats de traduction Adjust the length
of a frame
To: mailing list for ConTeXt users 


Hello,
Following on from my previous questions for writing my book (thanks again
Wolfgang), I have to create a solution environment like the attached image.
My problem is adjusting the length of the frame.
Thank you.
Fabrice

\setupbodyfont[newcomputermodern-book,11pt]

\defineframed
   [ACFRAME]
   [frame=off,
width=fit,
align=flushleft,
location=low,
background=color,
backgroundcolor=lightgray,
foregroundcolor=,
foregroundstyle=]


\setupenumerations
  [before={\blank},
   after={\blank},
   alternative=top,
   title=yes,
   titleleft={},
   titleright={},
   titlestyle=bold,
   width=broad]

\defineenumeration
   [exercice]
   [text=Exercice,
number=yes,
numbercommand=\groupedcommand{}{.},
style=italic]

\defineenumeration
   [solution]
   [text=Solution,
headcommand=\ACFRAME,
number=no,
numbercommand=\groupedcommand{}{},
style=normal]

\starttext

\startexercice{Le nombre d'or est irrationnel}
  Le nombre d'or, noté \m{\phi}, est tel que
\m{\phi=\dfrac{1+\sqrt{5}}{2}}. Montrer que \m{\phi} est irrationnel.
\stopexercice

\startsolution
  Nous raisonnons par l'absurde en supposant que \m{\phi} est rationnel.
\stopsolution

\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] Adjust the length of a frame

2021-07-27 Thread Fabrice Couvreur via ntg-context
Le lun. 26 juil. 2021 à 13:13, Fabrice Couvreur 
a écrit :

> Hello,
> Following on from my previous questions for writing my book (thanks again
> Wolfgang), I have to create a solution environment like the attached image.
> My problem is adjusting the length of the frame.
> Thank you.
> Fabrice
>
> \setupbodyfont[newcomputermodern-book,11pt]
>
> \defineframed
>[ACFRAME]
>[frame=off,
> width=fit,
> align=flushleft,
> location=low,
> background=color,
> backgroundcolor=lightgray,
> foregroundcolor=,
> foregroundstyle=]
>
>
> \setupenumerations
>   [before={\blank},
>after={\blank},
>alternative=top,
>title=yes,
>titleleft={},
>titleright={},
>titlestyle=bold,
>width=broad]
>
> \defineenumeration
>[exercice]
>[text=Exercice,
> number=yes,
> numbercommand=\groupedcommand{}{.},
> style=italic]
>
> \defineenumeration
>[solution]
>[text=Solution,
> headcommand=\ACFRAME,
> number=no,
> numbercommand=\groupedcommand{}{},
> style=normal]
>
> \starttext
>
> \startexercice{Le nombre d'or est irrationnel}
>   Le nombre d'or, noté \m{\phi}, est tel que
> \m{\phi=\dfrac{1+\sqrt{5}}{2}}. Montrer que \m{\phi} est irrationnel.
> \stopexercice
>
> \startsolution
>   Nous raisonnons par l'absurde en supposant que \m{\phi} est rationnel.
> \stopsolution
>
> \stoptext
>
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

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


[NTG-context] Texte source 30 / 5000 Résultats de traduction Adjust the length of a frame

2021-07-26 Thread Fabrice Couvreur via ntg-context
Hello,
Following on from my previous questions for writing my book (thanks again
Wolfgang), I have to create a solution environment like the attached image.
My problem is adjusting the length of the frame.
Thank you.
Fabrice

\setupbodyfont[newcomputermodern-book,11pt]

\defineframed
   [ACFRAME]
   [frame=off,
width=fit,
align=flushleft,
location=low,
background=color,
backgroundcolor=lightgray,
foregroundcolor=,
foregroundstyle=]


\setupenumerations
  [before={\blank},
   after={\blank},
   alternative=top,
   title=yes,
   titleleft={},
   titleright={},
   titlestyle=bold,
   width=broad]

\defineenumeration
   [exercice]
   [text=Exercice,
number=yes,
numbercommand=\groupedcommand{}{.},
style=italic]

\defineenumeration
   [solution]
   [text=Solution,
headcommand=\ACFRAME,
number=no,
numbercommand=\groupedcommand{}{},
style=normal]

\starttext

\startexercice{Le nombre d'or est irrationnel}
  Le nombre d'or, noté \m{\phi}, est tel que
\m{\phi=\dfrac{1+\sqrt{5}}{2}}. Montrer que \m{\phi} est irrationnel.
\stopexercice

\startsolution
  Nous raisonnons par l'absurde en supposant que \m{\phi} est rationnel.
\stopsolution

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

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


Re: [NTG-context] Metapost Animation of Sine

2021-07-21 Thread Fabrice L
Hi,

> Le 21 juill. 2021 à 10:08, Jeroen  a écrit :
> 
> I use this small animation to enlarge a circle
> 
> 
> \usemodule[animation]
> \setupinteraction[state=start]
> \starttext
> \startanimation[menu=yes,framerate=10]
> \dorecurse{7}{\expanded
>   {\startframe
> \startMPcode
> path p;
> numeric n, u;
> u := 1cm;
> n:=\recurselevel*u;
> p := fullcircle scaled n;
> draw p;
> \stopMPcode
>   \stopframe}}
> \stopanimation
> \stoptext
> 
> 
> This I use to draw a sine
> 
> 
> \starttext
> \startMPcode
>   draw(-90/360*1.5cm,-0.9cm) for i = -90 upto 630: .. 
> (i/360*1.5cm,0.9cm*(sind(i)))endfor;
> \stopMPcode
> \stoptext
> 
> 
> When I put it together to animate the sine as following, it does not entirely 
> create the sine animation I am looking for
> 
> 
> \usemodule[animation]
> \setupinteraction[state=start]
> \starttext
> \startanimation[menu=yes,framerate=10]
> \dorecurse{7}{\expanded
>   {\startframe
> \startMPcode
> path p;
> numeric n, u;
> u := 1cm;
> n:=\recurselevel*u;
> p := (-90/360*1.5cm,-0.9cm) for i = -90 upto 630: .. 
> (i/360*1.5cm,0.9cm*(sind(i))) endfor shifted (n,0);
> draw p;
> \stopMPcode
> \stopframe}}
> \stopanimation
> \stoptext
> 
> 
> What better way can I create a sine animation with Metapost?
>  
> 

Here is another way to do your animation. This is doing something, but I guess 
not what you want. Could you describe what do you have in mind ?

\starttext
\dorecurse{7}{ % 3180
\startMPpage
myvariable := #1 ;
path p;
numeric n, u;
    u := 1cm;
n:=myvariable*u;
p := (-90/360*1.5cm,-0.9cm) for i = -90 upto 630: .. 
(i/360*1.5cm,0.9cm*(sind(i))) endfor shifted (n,0);
draw p;
\stopMPpage
}
\stoptext

Fabrice.


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

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


Re: [NTG-context] Problem with chapter numbering

2021-07-15 Thread Fabrice Couvreur
Hi Bruce,
Thanks for the suggestion, it works fine.
Fabrice

Le mer. 14 juil. 2021 à 22:54, Bruce Horrocks  a écrit :

> On 13 Jul 2021, at 18:47, Fabrice Couvreur 
> wrote:
> >
> > Hi,
> > For my book, the header for each chapter should be like the attached
> image. I don't know if I am using the best method, but the result looks
> like what I want. Nevertheless, I am having a problem.
> > I don't understand why the first chapter is not numbered while the
> second is with number 1 etc.
> > Thanks.
> > Fabrice
>
> You were nearly there. Use:
>
> \unexpanded\def\processheadnumber#1%
>{\getmarking[chapternumber][current]}
>
> —
> 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 /
> http://www.ntg.nl/mailman/listinfo/ntg-context
> webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
> archive  : https://bitbucket.org/phg/context-mirror/commits/
> wiki : http://contextgarden.net
>
> ___
>
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

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


[NTG-context] Problem with chapter numbering

2021-07-13 Thread Fabrice Couvreur
Hi,
For my book, the header for each chapter should be like the attached image. I
don't know if I am using the best method, but the result looks like what I
want. Nevertheless, I am having a problem.
I don't understand why the first chapter is not numbered while the second
is with number 1 etc.
Thanks.
Fabrice

###

\definecolor[MyColorA][r=0.8784, g=0.8784, b=0.8784]

\defineframedtext
  [FramedText]
  [
offset=0.6em,
style=,
toffset=\lineheight,
background=color,
backgroundcolor=MyColorA,
foregroundstyle={\switchtobodyfont[11pt]},
align={left, broad},
frame=off,
width=\textwidth,
  ]

\setuplabeltext
 [en]
 [chapter=CHAPITRE]


\setuppagenumbering
  [alternative=doublesided,location=]


\unexpanded\def\HeadTitle#1#2%
   {
 \FramedText{{\cap\labeltext{chapter}}\space#1
  \\
 \bfc#2}
   }

\unexpanded\def\processheadnumber#1%
   {\getmarking[chapternumber]}

 \setuphead
   [chapter]
   [style=\bfd,
align={flushleft,broad},
numbercommand=\processheadnumber,
command=\HeadTitle]


\starttext
\startchapter [title={La récurrence}]
  \startsection[title={Le principe de récurrence}]
\input knuth
  \stopsection
  \startsection[title={Le raisonement par récurrence}]
  \input knuth
  \stopsection
  \startsection[title={Récurrences fortes}]
\input knuth
  \stopsection
   \startsection[title={Exercices corrigés}]
\input knuth
  \stopsection
\stopchapter
\startchapter [title=Combinatoire-Dénombrement]
   \input knuth
\stopchapter
\startchapter [title=Suites]
  \input knuth
\stopchapter
\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] Header for a book

2021-07-13 Thread Fabrice Couvreur
Hi,
My first solution is incorrect ; with the second solution, I don't
understand why the first chapter is not numbered while the second is with
number 1.
Thanks.
Fabrice
\unexpanded\def\HeadTitle#1#2%
   {
 \FramedText{{\cap\labeltext{chapter}}\space#1
  \\
 \bfc#2}
   }

\unexpanded\def\processheadnumber#1%
   {\getmarking[chapternumber]}

 \setuphead
   [chapter]
   [style=\bfd,
align={flushleft,broad},
numbercommand=\processheadnumber,
command=\HeadTitle]


\starttext
\startchapter [title={La récurrence}]
  \startsection[title={Le principe de récurrence}]
 \dorecurse{10}{\input knuth}
  \stopsection
  \startsection[title={Le raisonement par récurrence}]
  \dorecurse{10}{\input knuth}
  \stopsection
  \startsection[title={Récurrences fortes}]
  \dorecurse{10}{\input knuth}
  \stopsection
   \startsection[title={Exercices corrigés}]
  \dorecurse{10}{\input knuth}
  \stopsection
\stopchapter
\startchapter [title=Combinatoire-Dénombrement]
\dorecurse{10}{\input knuth}
\stopchapter

\stoptext



Le lun. 12 juil. 2021 à 16:32, Fabrice Couvreur 
a écrit :

> Hi,
> For my book, the header for each chapter should be like the attached image. I
> don't know if I am using the best method, but the result looks like what I
> want. Nevertheless, I am having some problems :
> 1. the header appears on each page ;
> 2. the title of the chapter should not appear in the body of the text.
> Thanks for your help.
> Fabrice
>
> \definecolor[MyColorA][r=0.8784, g=0.8784, b=0.8784]
> \defineframedtext
>   [FramedText]
>   [
> offset=0.6em,
> style=,
> toffset=\lineheight,
> background=color,
> backgroundcolor=MyColorA,
> foregroundstyle={\switchtobodyfont[11pt]},
> align={left, broad},
> frame=off,
> width=\textwidth,
>   ]
>
>
> \setuplabeltext
>  [en]
>  [chapter=CHAPITRE]
>
> \setuphead
>[chapter]
>[bodypartlabel=]
>
>
> \startsetups [header]
>  \labeltext{chapter} \getmarking[chapternumber]
> \stopsetups
>
> \setupheadertexts
>   []
>   [{\FramedText{{\cap\labeltext{chapter}\space\getmarking[chapternumber]}
>  \\
> \bfc\getmarking[chapter]}}]
>   []
>   [\FramedText{{\cap\labeltext{chapter}\space \getmarking[chapternumber]}
>  \\
>\bfc\getmarking[chapter]}]
>
>
> \setuppagenumbering
>  [alternative=doublesided,location=]
> \starttext
> \startchapter [title=La récurrence]
>   \startsection[title={Le principe de récurrence}]
>  \dorecurse{10}{\input knuth}
>   \stopsection
>   \startsection[title={Le raisonement par récurrence}]
>   \dorecurse{10}{\input knuth}
>   \stopsection
>   \startsection[title={Récurrences fortes}]
>   \dorecurse{10}{\input knuth}
>   \stopsection
>\startsection[title={Exercices corrigés}]
>   \dorecurse{10}{\input knuth}
>   \stopsection
> \stopchapter
> \startchapter [title=Combinatoire-Dénombrement]
> \dorecurse{10}{\input knuth}
> \stopchapter
>
> \stoptext[image: pied_3.png]
>
>
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

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


[NTG-context] Header for a book

2021-07-12 Thread Fabrice Couvreur
Hi,
For my book, the header for each chapter should be like the attached image. I
don't know if I am using the best method, but the result looks like what I
want. Nevertheless, I am having some problems :
1. the header appears on each page ;
2. the title of the chapter should not appear in the body of the text.
Thanks for your help.
Fabrice

\definecolor[MyColorA][r=0.8784, g=0.8784, b=0.8784]
\defineframedtext
  [FramedText]
  [
offset=0.6em,
style=,
toffset=\lineheight,
background=color,
backgroundcolor=MyColorA,
foregroundstyle={\switchtobodyfont[11pt]},
align={left, broad},
frame=off,
width=\textwidth,
  ]


\setuplabeltext
 [en]
 [chapter=CHAPITRE]

\setuphead
   [chapter]
   [bodypartlabel=]


\startsetups [header]
 \labeltext{chapter} \getmarking[chapternumber]
\stopsetups

\setupheadertexts
  []
  [{\FramedText{{\cap\labeltext{chapter}\space\getmarking[chapternumber]}
 \\
\bfc\getmarking[chapter]}}]
  []
  [\FramedText{{\cap\labeltext{chapter}\space \getmarking[chapternumber]}
 \\
   \bfc\getmarking[chapter]}]


\setuppagenumbering
 [alternative=doublesided,location=]
\starttext
\startchapter [title=La récurrence]
  \startsection[title={Le principe de récurrence}]
 \dorecurse{10}{\input knuth}
  \stopsection
  \startsection[title={Le raisonement par récurrence}]
  \dorecurse{10}{\input knuth}
  \stopsection
  \startsection[title={Récurrences fortes}]
  \dorecurse{10}{\input knuth}
  \stopsection
   \startsection[title={Exercices corrigés}]
  \dorecurse{10}{\input knuth}
  \stopsection
\stopchapter
\startchapter [title=Combinatoire-Dénombrement]
\dorecurse{10}{\input knuth}
\stopchapter

\stoptext[image: pied_3.png]
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

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

2021-07-06 Thread Fabrice Couvreur
Hi Wolfgang,
Thank you very much for this very nice solution ; my knowledge of ConTeXt
is unfortunately not at this level.
If I can afford I must do the following header


[image: pied_3.png]
Many thanks.
Fabrice

Le lun. 5 juil. 2021 à 20:20, Wolfgang Schuster <
wolfgang.schuster.li...@gmail.com> a écrit :

> Fabrice Couvreur schrieb am 05.07.2021 um 19:49:
> > Hi,
> > I have to write a book :
> > on the even pages at the bottom and on the left : the page number, a
> > vertical line and the number of the chapter preceded by the text
> > "Chapter" ;
> > on the odd pages at the bottom and on the right : the title of the
> > chapter, a line vertical and page number.
> > Thanks for your help.
> > Fabrice
> >
> >   \setupfootertexts
> >  [{\getmarking[chapter]}]
> >  [{\pagenumber}]
> >  [{\pagenumber}]
> >  [Chapter\space\pagenumber]
> >
> > \starttext
> > \startchapter
> >[title=First chapter]
> >\dorecurse{10}{\input knuth}
> > \stopchapter
> > \startchapter
> >[title=Second chapter]
> >\dorecurse{10}{\input knuth}
> > \stopchapter
> > \stoptext
>
>
> \startsetups [footer:leftpage]
>  \prefixedpagenumber
>  \space
>  \undepthed{\blackrule
>  [
>  width=\linewidth,
>  height=\strutht,
>  depth=\dimexpr\footerheight+\bottomspace\relax,
>  ]}
>  \space
>  \labeltext{chapter} \getmarking[chapternumber]
> \stopsetups
>
> \startsetups [footer:rightpage]
>  \getmarking[chapter]
>  \space
>  \undepthed{\blackrule
>  [
>  width=\linewidth,
>  height=\strutht,
>  depth=\dimexpr\footerheight+\bottomspace\relax,
>  ]}
>  \space
>  \prefixedpagenumber
> \stopsetups
>
> \setuplabeltext
>  [en]
>  [chapter=Chapter]
>
> \setuphead
>  [chapter]
>  [bodypartlabel=]
>
> \setupfootertexts
>  [] [\directsetup{footer:rightpage}]
>  [\directsetup{footer:leftpage}] []
>
> \setuppagenumbering
>  [alternative=doublesided]
>
> \starttext
>
> \startchapter [title=First chapter]
>  \dorecurse{10}{\input knuth}
> \stopchapter
>
> \startchapter [title=Second chapter]
>  \dorecurse{10}{\input knuth}
> \stopchapter
>
> \stoptext
>
> 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
___


[NTG-context] Footer

2021-07-05 Thread Fabrice Couvreur
Hi,
I have to write a book :
on the even pages at the bottom and on the left : the page number, a
vertical line and the number of the chapter preceded by the text "Chapter"
;
on the odd pages at the bottom and on the right : the title of the chapter,
a line vertical and page number.
Thanks for your help.
Fabrice

 \setupfootertexts
[{\getmarking[chapter]}]
[{\pagenumber}]
[{\pagenumber}]
[Chapter\space\pagenumber]

\starttext
\startchapter
  [title=First chapter]
  \dorecurse{10}{\input knuth}
\stopchapter
\startchapter
  [title=Second chapter]
  \dorecurse{10}{\input knuth}
\stopchapter
\stoptext

[image: pied_2.png]
[image: pied_1.png]
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/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] upload / some new math stuff

2021-06-11 Thread Fabrice Couvreur
Hi Hans,
I am not a font specialist and I use pagella and modern.
I'm curious so I installed this new font in
/home/viserion/LMTX/tex/texmf/fonts/opentype/public/newcomputermodern
I tested your file and I get the following message
Thank you Fabrice

Running `lmtx' on `hans-33' with
``/home/viserion/LMTX/tex/texmf-linux-64/bin/mtxrun --autogenerate --script
context --autopdf --purgeall hans-33''

resolvers   | formats | executing runner 'run luametatex format':
/home/viserion/LMTX/tex/texmf-linux-64/bin/luametatex --jobname="hans-33"
--fmt=/home/viserion/LMTX/tex/texmf-cache/luatex-cache/context/5fe67e0bfe781ce0dde776fb1556f32e/formats/luametatex/cont-en.fmt
--lua=/home/viserion/LMTX/tex/texmf-cache/luatex-cache/context/5fe67e0bfe781ce0dde776fb1556f32e/formats/luametatex/cont-en.lui
 --c:autopdf --c:currentrun=1 --c:fulljobname="./hans-33"
--c:input="./hans-33" --c:kindofrun=1 --c:maxnofruns=9 --c:purgeall
--c:texmfbinpath="/home/viserion/LMTX/tex/texmf-linux-64/bin"
fonts   > beware: no fonts are loaded yet, using 'lm mono' in box
system  >
system  > ConTeXt  ver: 2021.06.10 23:13 LMTX  fmt: 2021.6.11  int:
english/english
system  >
system  > 'cont-new.mkxl' loaded
open source > level 1, order 1, name
'/home/viserion/LMTX/tex/texmf-context/tex/context/base/mkxl/cont-new.mkxl'
system  > beware: some patches loaded from cont-new.mkiv
close source> level 1, order 1, name
'/home/viserion/LMTX/tex/texmf-context/tex/context/base/mkxl/cont-new.mkxl'
system  > files > jobname 'hans-33', input './hans-33', result
'hans-33'
fonts   > latin modern fonts are not preloaded
languages   > language 'en' is active
open source > level 1, order 2, name './hans-33.tex'
open source > level 2, order 3, name
'/home/viserion/LMTX/tex/texmf-context/tex/context/fonts/mkiv/type-imp-newcomputermodern.mkiv'
close source> level 2, order 3, name
'/home/viserion/LMTX/tex/texmf-context/tex/context/fonts/mkiv/type-imp-newcomputermodern.mkiv'
fonts   > defining > forced type 'otf' of 'newcm10-regular' not
found
fonts   > defining > unable to define 'newcm10-regular.otf' as
'newcomputermodern-12pt-rm-tf-0--0'
fonts   > defining > font with asked name 'newcmmath-regular' is
not found using lookup 'file'
fonts   > defining > unable to define 'newcmmath-regular' as
'newcomputermodern-12pt-mm-mr--3'
fonts   > defining > unable to define 'newcmmath-regular' as
'newcomputermodern-12pt-mm-mr--2'
fonts   > defining > unable to define 'newcmmath-regular' as
'newcomputermodern-12pt-mm-mr--1'
fonts   > defining > unable to define 'newcmmath-regular' as
'newcomputermodern-12pt-mm-mb--3'
fonts   > defining > unable to define 'newcmmath-regular' as
'newcomputermodern-12pt-mm-mb--2'
fonts   > defining > unable to define 'newcmmath-regular' as
'newcomputermodern-12pt-mm-mb--1'
tex error   > tex error on line 12 in file ./hans-33.tex: Math error:
parameter 'quad' in style 0 is not set

 \p_distance \endgroup \stopimath

 \p_distance \stopforceddisplaymath
\egroup \d_strc_math_number_width \wd \b_strc_formulas_number \ifcase
\mathnumberstatus \setfalse \c_strc_math_has_number \or \ifzeropt
\d_strc_math_number_width \setfalse \c_strc_math_has_number \else \settrue
\c_strc_math_has
 \p_distance \endgroup \ifcase \c_strc_formulas_mode
\Ucheckedstopdisplaymath \or \normalUstopmath \egroup
\strc_formulas_flush_content_and_number \else \expandafter \stopinnermath
\fi
\afterdisplayspace \egroup

 \p_distance \strc_formulas_place_number \strc_formulas_flush_number
\dostarttagged \t!formulacontent \empty \dotagregisterformula
\c_strc_formulas_n \csname \e!stop \formulaparameter \c!alternative
\v!formula \endcsname
\dostoptagged \dostoptagged \nonoindentati

 \stopformula

 2 % \setupbodyfont[cambria]
 3
 4 \starttext
 5
 6 \startformula
 7  x = \integral^1_2 \mathinner{\vrule height 10mm depth 10mm
width 5mm} =
 8  x = \integral^1_2 \mathinner{\vrule height 20mm depth 20mm
width 5mm} =
 9  x = \integral^1_2 \mathinner{\vrule height 30mm depth 30mm
width 5mm} =
10  x = \integral^1_2 \mathinner{x} =
11  x = \integral^1_2 x
12 >>  \stopformula
13
14 \startformula
15  x = \int\Umathadaptsize^1_2 \mathinner{\vrule height 10mm depth
16 10mm width 5mm} =
17  x = \int\Umathadaptsize^1_2 \mathinner{\vrule height 20mm depth
18 20mm width 5mm} =
19  x = \int\Umathadaptsize^1_2 \mathinner{\vrule height 30mm depth
20 30mm width 5mm} =
21  x = \int\Umathadaptsize^1_2 \mathinner{x} =
22  x = \int\Umathadaptsize^1_2 x
Sorry, but I can't typeset math unless various parameters have been set.
This is
normally done by loading special math fonts into the ma

[NTG-context] mathscript in math mode

2021-05-13 Thread Fabrice Couvreur
Hi,
Is it possible to run the macro in math mode ?
Thank you
Fabrice

 \usebodyfont  [stix]
 \setupbodyfont[modern]

 \setupmathematics[stylealternative=calligraphic]

 \unexpanded\def\CScript#1#2{\start\switchtobodyfont[stixtwo]
\m{{\mathscript{#1}}_{#2}}\stop}

 
\unexpanded\def\cscript#1{\start\switchtobodyfont[stixtwo]\m{{\mathscript{#1}}}\stop}

\starttext
\cscript{P}
\startformula
  \cscript{P}
\stopformula
\stoptext
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

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


[NTG-context] LuaMetaFun MPinclusions doublefun

2021-05-02 Thread Fabrice L
Dear list,

I’m experimenting LuaMetaFun. The following MWE example works as expected, but 
stop to work as soon as I uncomment the « doublefun » commands, like :

\startMPinclusions{doublefun} (… )
\startMPpage[instance=doublefun]


% MWE ——

\startMPinclusions%{doublefun}
vardef Macrotest(expr ANumber) =
draw textext(decimal(ANumber)) scaled 10;
enddef ;
\stopMPinclusions

\startMPpage%[instance=doublefun]

Macrotest(22)  ;

  path p; p := (0,0)..(3,3.5)..(9,-3.5).. (12,0)..(9,3.5)..(3,-3.5)..cycle;
  draw lmt_followtext [
 text = "\dorecurse{9}{· Just random text }",
 path = p xsized TextWidth,
 autoscaleup = "max",
 reverse=true,
  ] xsized 5in;
 \stopMPpage

% ———

Log says:

metafun > log > error: Isolated expression
metafun > log >
metapost> log > 
metapost> log >  
metapost> log >(
metapost> log > <*>  Macrotest(
metafun > log >
metafun > log > I couldn't find an '=' or ':=' after the expression 
that is shown above this

I have search the making list for examples, but did not not found anything. 
Thanks for any help !

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

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


Re: [NTG-context] Macro to write a letter with \ mathscript{}

2021-04-18 Thread Fabrice Couvreur
Hi Hans and Wolfgang,
I have tried your suggestions and it seems to work.
Thank you so much.
Fabrice

Le sam. 17 avr. 2021 à 19:04, Wolfgang Schuster <
wolfgang.schuster.li...@gmail.com> a écrit :

> Fabrice Couvreur schrieb am 17.04.2021 um 16:30:
>
> Hi,
> This is going to be difficult to explain because the code below works but
> in a project with many components does not. Actually the macro does not
> work in the definition environment in my project but in the same
> environment of this simple code yes. Thank you for your possible help.
>
>
> Without more information or a better example there is nothing which can be
> done.
>
> It's possible you have multiple definitions for the command in your style
> file,
> you can also try if adding \usebodyfont[stixtwo] (or
> \definebodyfont[...pt] when
> you use a unconventional font size) to your setups.
>
> 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
___


[NTG-context] Macro to write a letter with \ mathscript{}

2021-04-17 Thread Fabrice Couvreur
Hi,
This is going to be difficult to explain because the code below works but
in a project with many components does not. Actually the macro does not
work in the definition environment in my project but in the same
environment of this simple code yes. Thank you for your possible help.
Fabrice

\setupbodyfont[modern]

\setupenumerations
  [before={},
   after={\blank},
   alternative=serried,
   number=no,
   title=yes,
   titleleft={(},
   titleright={)},
   prefix=yes,
   prefixsegments=chapter,
   way=bychapter,
   titlestyle=bold,
   width=broad]

\defineenumeration
   [definition]
   [text=Définition,
number=no,
headcommand=\groupedcommand{}{},
style=slanted]

\setupmathematics[stylealternative=calligraphic]

 
\unexpanded\def\CScript#1#2{\start\switchtobodyfont[stixtwo]\m{{\mathscript{#1}}_{#2}}\stop}

 
\unexpanded\def\cscript#1{\start\switchtobodyfont[stixtwo]\m{{\mathscript{#1}}}\stop}

\starttext

\startdefinition
  \placefigure[right]{}{
  \startMPcode
path rectangle;
rectangle=unitsquare xscaled 6cm yscaled 4cm;

draw rectangle withcolor green;
label.bot("\cscript{C}", center rectangle);
  \stopMPcode}
  Soit \m{f} une fonction continue et positive sur un intervalle
\m{[a\,;b]} et \cscript{C}  sa courbe représentative dans un repère
orthogonal. L'aire du domaine délimité par la courbe \cscript{C}, l'axe des
abscisses et les droites d'équations \m{x=a} et \m{x=b}, exprimée en unité
d'aire, est appelée {\bi intégrale de \m{a} à \m{b} de la fonction \m{f}}.
\stopdefinition

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

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


[NTG-context] Alignment with an enumeration

2021-04-12 Thread Fabrice Couvreur
Hi,
Is it possible that the first item is on the baseline of the definition
environment title ? Thank you.
Fabrice

\define\ItemCommand
{\hskip\zeropoint\relax\autoinsertnextspace}

  \setupitemgroup
[itemize]
[color=darkred,
style=bold,
 distance=\spaceamount]

  \setupitemgroup
[itemize:1]
[option={n,packed,fit,intext},
command=\ItemCommand]

  \setupitemgroup
[itemize:2]
[lefttext=,
righttext=,
option={a,text}]

\setupenumerations
  [before={},
   after={\blank},
   alternative=serried,
   number=no,
   title=yes,
   titleleft={(},
   titleright={)},
   prefix=yes,
   prefixsegments=chapter,
   way=bychapter,
   titlestyle=bold,
   width=broad]

\defineenumeration
   [definition]
   [text=Définition,
number=no,
headcommand=\groupedcommand{}{},
style=normal]

\starttext
\startdefinition
  \input knuth
\stopdefinition
\startdefinition
  \startitemize[n]
\startitem
  First item
\stopitem
\startitem
  Second item
\stopitem
  \stopitemize
\stopdefinition
\stoptext
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

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


[NTG-context] Center a text (Metafun)

2021-03-06 Thread Fabrice Couvreur
Hi Hans,
Some time ago, you offered this code to respond to a specific request from
me. I used this code again and wanted to know if it was possible for the
title "Algorithm" to be automatically centered based on the content.
Thank you
Fabrice


\definecolor[MyBlue][c=0.2 , m=0.03, y=0.00, k=0.00]

\definecolor[maincolor] [b=.5]

\defineframedtext
   [MyFrame]
   [frame=off,
background=MyFrame,
width=fit,
height=fit,
style=small]

\startuseMPgraphic{MyFrame}
 path b;
 picture p;
 p := textext.rt("\tfx\bf\white\framedtextparameter{Title}");
 p := p shifted (2BodyFontSize,OverlayHeight-ypart center
p+.25ExHeight);
 b := boundingbox p leftenlarged .5EmWidth rightenlarged .5EmWidth
topenlarged .5EmWidth bottomenlarged .5EmWidth ;
 fill OverlayBox withcolor "MyBlue" ;
 fill b withcolor \MPcolor{maincolor} ;
 draw p ;
 setbounds currentpicture to boundingbox currentpicture enlarged 2mm ;
\stopuseMPgraphic

\defineoverlay
   [MyFrame]
   [\useMPgraphic{MyFrame}]
\starttext
\MyFrame[Title=Algorithme]{%
 \m{a\gets 2x-1}

  \m{b\gets a²-1}

  \m{c\gets b\div 4}

  \m{d\gets c-a+x}
  }
\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] Lua code and table

2021-02-20 Thread Fabrice Couvreur
Hi Hans
The xx.tex file works for me
Thanks
Fabrice

Le ven. 19 févr. 2021 à 14:28, Hans Hagen  a écrit :

> On 2/19/2021 2:12 PM, Jano Kula wrote:
> > Hi,
> >
> > On Fri, 19 Feb 2021 at 13:06, Hans Hagen  > <mailto:j.ha...@xs4all.nl>> wrote:
> >
> > On 2/19/2021 12:42 PM, Fabrice Couvreur wrote:
> >  > Hi Hans,Thanks again for the ideas to improve my code. However, I
> > am new
> >  > to Lua and my level is far from sufficient to understand
> > everything. Why
> >  > in no table do the crosses appear in the cells; which was my
> > original
> >  > idea.Thank you.Fabrice
> > I get a cross (see attached).
> >
> >
> > I've got no crosses with ConTeXt  ver: 2021.02.05 17:45 LMTX.
> > Fresh install of ConTeXt  ver: 2021.02.19 13:15 LMTX gives me no
> > crosses, too.
> > No missing fonts in both cases.
> > Log and tuc attached.
> And with the previously attached xx.tex file? maybe the mailer messes up
> something?
>
> 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] Lua code and table

2021-02-19 Thread Fabrice Couvreur
Hi Hans, Thanks again for the ideas to improve my code. However, I am new
to Lua and my level is far from sufficient to understand everything. Why in
no table do the crosses appear in the cells; which was my original idea. Thank
you. Fabrice

Le jeu. 18 févr. 2021 à 16:28, Fabrice Couvreur 
a écrit :

> Hello Jano,
> Thanks.
> Fabrice
>
> Le jeu. 18 févr. 2021 à 16:27, Jano Kula  a écrit :
>
>> Hello Fabrice,
>>
>>
>>
>> On Thu, 18 Feb 2021 at 16:19, Fabrice Couvreur <
>> fabrice1.couvr...@gmail.com> wrote:
>>
>>> Hi all, Thanks to you, I'm not at your level with Lua, but I'm learning
>>> thanks to you
>>> Hans, I compiled your code and I get an error message :
>>>
>>> lua error   > lua error on line 50 in file ./table_1.tex:
>>>
>>> token call, syntax: [ctxlua]:11: unexpected symbol near '='
>>>
>>> 13 \startluacode
>>> 14  function document.MyTable(specification)
>>> 15
>>> 16  local pattern= specification.pattern
>>> 17  local action = specification.action
>>> 18  local conversion = specification.conversion or
>>> "Characters"
>>> 19
>>> 20  local n = #pattern
>>> 21
>>> 22  --  context.startxtable { align = "middle,lohi", width =
>>> "0.8cm",
>>> 23 >>  offset = "0.8ex", bodyfont = "9pt", framecolor = "cyan" }
>>>
>>
>> Just comment out line 23, too, or join 22 + 23 to one line.
>>
>> Jano
>>
>>
>>
>> ___
>> If your question is of interest to others as well, please add an entry to
>> the Wiki!
>>
>> maillist : ntg-context@ntg.nl /
>> http://www.ntg.nl/mailman/listinfo/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] Lua code and table

2021-02-18 Thread Fabrice Couvreur
Hello Jano,
Thanks.
Fabrice

Le jeu. 18 févr. 2021 à 16:27, Jano Kula  a écrit :

> Hello Fabrice,
>
>
>
> On Thu, 18 Feb 2021 at 16:19, Fabrice Couvreur <
> fabrice1.couvr...@gmail.com> wrote:
>
>> Hi all, Thanks to you, I'm not at your level with Lua, but I'm learning
>> thanks to you
>> Hans, I compiled your code and I get an error message :
>>
>> lua error   > lua error on line 50 in file ./table_1.tex:
>>
>> token call, syntax: [ctxlua]:11: unexpected symbol near '='
>>
>> 13 \startluacode
>> 14  function document.MyTable(specification)
>> 15
>> 16  local pattern= specification.pattern
>> 17  local action = specification.action
>> 18  local conversion = specification.conversion or
>> "Characters"
>> 19
>> 20  local n = #pattern
>> 21
>> 22  --  context.startxtable { align = "middle,lohi", width =
>> "0.8cm",
>> 23 >>  offset = "0.8ex", bodyfont = "9pt", framecolor = "cyan" }
>>
>
> Just comment out line 23, too, or join 22 + 23 to one line.
>
> Jano
>
>
>
> ___
> If your question is of interest to others as well, please add an entry to
> the Wiki!
>
> maillist : ntg-context@ntg.nl /
> http://www.ntg.nl/mailman/listinfo/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] Lua code and table

2021-02-18 Thread Fabrice Couvreur
Hi all, Thanks to you, I'm not at your level with Lua, but I'm learning
thanks to you
Hans, I compiled your code and I get an error message :

lua error   > lua error on line 50 in file ./table_1.tex:

token call, syntax: [ctxlua]:11: unexpected symbol near '='

13 \startluacode
14  function document.MyTable(specification)
15
16  local pattern= specification.pattern
17  local action = specification.action
18  local conversion = specification.conversion or "Characters"
19
20  local n = #pattern
21
22  --  context.startxtable { align = "middle,lohi", width =
"0.8cm",
23 >>  offset = "0.8ex", bodyfont = "9pt", framecolor = "cyan" }
24  context.startxtable { "MyTable" }
25  context.startxrow()
26  context.startxcell { frame = "off" }
27  context()
28  context.stopxcell()
29  for i=1,n do
30  context.startxcell()
31  context.convertnumber(conversion,i)
32  context.stopxcell()
33  end

mtx-context | fatal error: return code: 256

TeX Output exited abnormally with code 1 at Thu Feb 18 16:13:29


Thank you very much
Fabrice

Le jeu. 18 févr. 2021 à 10:06, Hans Hagen  a écrit :

> On 2/18/2021 12:22 AM, Bruce Horrocks wrote:
>
> >> On 17 Feb 2021, at 17:40, Fabrice Couvreur 
> wrote:
> >>
> >> Hi, The code works, but is it possible to make it shorter ?
> OK, here is my take, based on earlier posts, bringing together some
> 'technologies':
>
> (1) make a document function which isolatees the code
> (2) then call it where needed
> (3) use the built in conversion code
> (4) use so called unique mp graphics (smaller files, faster run)
> (5) use symbols to get the baseline right
> (6) use a little abstraction in the table setup
>
> watch how we can pass a table instead of a string, so
>
> context.startxtable { align = "middle,lohi", width = "0.8cm", offset =
> "0.8ex", bodyfont = "9pt", framecolor = "cyan" }
>
> is ok, but anm abstraction is even better. Now, who will wikify it ...
>
> %%% code %%%
>
> \setupbodyfont[pagella]
>
> \starttext
>
> \definextable
>[MyTable]
>[align={middle,lohi},
> width=0.8cm,
> offset=0.8ex,
> bodyfont=9pt,
> framecolor=cyan]
>
> \startluacode
>  function document.MyTable(specification)
>
>  local pattern= specification.pattern
>  local action = specification.action
>  local conversion = specification.conversion or "Characters"
>
>  local n = #pattern
>
>  --  context.startxtable { align = "middle,lohi", width = "0.8cm",
> offset = "0.8ex", bodyfont = "9pt", framecolor = "cyan" }
>  context.startxtable { "MyTable" }
>  context.startxrow()
>  context.startxcell { frame = "off" }
>  context()
>  context.stopxcell()
>  for i=1,n do
>  context.startxcell()
>  context.convertnumber(conversion,i)
>  context.stopxcell()
>  end
>  context.stopxrow()
>  for i=1,n do
>  context.startxrow()
>  context.startxcell()
>  context.convertnumber(conversion,i)
>  context.stopxcell()
>  for j=1,n do
>  context.startxcell { align = "middle" }
>  action(string.sub(pattern[i],j,j))
>  context.stopxcell()
>  end
>  context.stopxrow()
>  end
>  context.stopxtable()
>
>  end
> \stopluacode
>
> \startuniqueMPgraphic{cross}{width,height,depth,color,line}
>  draw image (
>  draw (\MPvar{depth},\MPvar{height}) -- (\MPvar{width},0) ;
>  draw (\MPvar{depth},0) -- (\MPvar{width},\MPvar{height}) ;
>  )
>  withpen pencircle scaled \MPvar{line}
>  withcolor \MPvar{color} ;
> \stopuniqueMPgraphic
>
> \definesymbol
>[MyRedCross]
>
>
> [\uniqueMPgraphic{cross}{width=1em,height=1ex,depth=.5ex,color=red,line=.2ex}]
>
> \definesymbol
>[MyGreenCross]
>
>
> [\uniqueMPgraphic{cross}{width=1em,height=1ex,depth=.5ex,color=green,line=.2ex}]
>
> \startluacode
>  document.MyTab

[NTG-context] Lua code and table

2021-02-17 Thread Fabrice Couvreur
Hi, The code works, but is it possible to make it shorter ?
Thank you
Fabrice


\startuseMPgraphic{DiagonalRule}
   rulethickness := \frameddimension{rulethickness};

   drawoptions(
 withpen pencircle scaled rulethickness
 withcolor \MPcolor{\framedparameter{framecolor}});

   pair leftcorner, rightcorner, Leftcorner, Rightcorner;
   leftcorner  := (rulethickness, \overlayheight-rulethickness);
   rightcorner := (\overlaywidth-rulethickness, rulethickness);
   Leftcorner  := ( rulethickness, rulethickness);
   Rightcorner :=
(\overlaywidth-rulethickness,\overlayheight-rulethickness);

   draw leftcorner -- rightcorner;
   draw Leftcorner -- Rightcorner;
 \stopuseMPgraphic

\defineoverlay
  [DiagonalRule]
  [\useMPgraphic{DiagonalRule}]

\define[2]\DiagonalLabel{%
  \setuptabulate [after={\blank[\frameddimension{offset}]}]
  \starttabulate [|p|r|]
\NC\NC \bf #2 \NC\NR
\NC \bf #1 \NC\NC\NR
  \stoptabulate
}
\starttext
\startluacode
  local background_one = {
   align = "middle",
   style = "type",
   background = "DiagonalRule",
  }

  local letters_1 = { "A", "B", "C", "D", "E", "F", "G", "H" }
  context.startxtable({"align={middle,lohi},
width=0.8cm,offset=0.8ex,bodyfont=9pt,framecolor=cyan"})
  context.startxrow()
  context.startxcell({"frame=off"})
  context()
  context.stopxcell()
  for _, letter in ipairs(letters_1) do
context.startxcell()
context(letter) context.stopxcell()
  end
  context.stopxrow()
   for _, letter in ipairs(letters_1) do
  context.startxrow()
context.startxcell()
context(letter)
context.stopxcell()
  for j = 0, 7 do
  context.startxcell(  j == 0 and letter == "B" and background_one
  or j == 0 and letter == "C" and background_one
  or j == 0 and letter == "D" and background_one
  or j == 0 and letter == "G" and background_one
  or j == 0 and letter == "H" and background_one
  or j == 1 and letter == "A" and background_one
  or j == 1 and letter == "E" and background_one
  or j == 1 and letter == "F" and background_one
  or j == 1 and letter == "G" and background_one
  or j == 2 and letter == "A" and background_one
  or j == 2 and letter == "D" and background_one
  or j == 2 and letter == "F" and background_one
  or j == 2 and letter == "G" and background_one
  or j == 2 and letter == "H" and background_one
  or j == 3 and letter == "A" and background_one
  or j == 3 and letter == "C" and background_one
  or j == 3 and letter == "E" and background_one
  or j == 3 and letter == "H" and background_one
  or j == 4 and letter == "B" and background_one
  or j == 4 and letter == "D" and background_one
  or j == 4 and letter == "F" and background_one
  or j == 4 and letter == "G" and background_one
  or j == 5 and letter == "B" and background_one
  or j == 5 and letter == "C" and background_one
  or j == 5 and letter == "E" and background_one
  or j == 6 and letter == "A" and background_one
  or j == 6 and letter == "B" and background_one
  or j == 6 and letter == "C" and background_one
  or j == 6 and letter == "E" and background_one
  or j == 7 and letter == "A" and background_one
  or j == 7 and letter == "C" and background_one
  or j == 7 and letter == "D" and background_one
  )
  context()
  context.stopxcell()
  end
  context.stopxrow()
  end
  context.stopxtable()
\stopluacode
\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] midi

2021-02-04 Thread Fabrice L


> Le 4 févr. 2021 à 08:31, Henning Hraban Ramm  a écrit :
> 
>> Am 04.02.2021 um 04:15 schrieb Fabrice L :
>> 
>> I usually do images ; if you or the list ever want to see more, the site 
>> https://art-aleatoire.com is to show my work,
> 
> Wow, this is great!

Thanks so much ! And also thanks to all the other very positive comments I had 
! All welcome ! ;-) 
> 
> I think I’ll come back to you about using some of your works as illustrations 
> for our (Dreiviertelhaus’) German literature magazine.

I will be happy to contribute an illustration to the magazine ! 
> 
> Anyway I’d like to fill many pages of the ConTeXt journal with them.
> 
> Hraban

Fabrice.

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

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

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


Re: [NTG-context] midi

2021-02-03 Thread Fabrice L


> Le 3 févr. 2021 à 16:29, Henning Hraban Ramm  a écrit :
> 
> 
>> Am 03.02.2021 um 22:14 schrieb Fabrice L :
>>>> 
>>>> https://youtu.be/3x03g-eHFC8
>>> 
>>> Great! Would you please write an article about that for our journal? Or 
>>> first present it at the ConTeXt meeting?
>> 
>> Thanks ! Yes, I can do and article with pleasure. Just give me more 
>> indications about the level (perhaps some examples) and length of the paper.
> 
> Well, the range of level and length of articles in our (ConTeXt group’s) 
> journal is quite big.
> 
> Many of the documentation files in the distribution started as meeting talks 
> and journal/proceedings articles.

OK. Maybe I could start with an article explaining the approach to do the 
video, highlighting problems and solutions, and then we can discuss on this ?

> 
>> I would be delighted and honoured to present at a ConTeXt meeting, but they 
>> are usually in Europe and I’m in Canada, so this could be really 
>> challenging. 
> 
> I understand. This fall we’ll meet in Belgium again, and in 2022 in Germany.
> (I couldn’t afford joining a meeting overseas myself.)
> Maybe we could include you remotely? Last time we had “online” talks by Taco 
> – personally is better.

Why not ? ;-)
> 
> Hraban

Thanks for all these propositions. 
Fabrice.

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

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

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


Re: [NTG-context] midi

2021-02-03 Thread Fabrice L
Le 3 févr. 2021 à 19:41, Hans Hagen  a écrit :
> 
> On 2/3/2021 9:33 PM, Jairo A. del Rio wrote:
>> Wow, that's great :)
> 
> Whow indeed!

Thanks a lot for your nice words ! Hans, all your covers have been very 
inspirational to me.. ! I use ConTeXt in my work day, and ConTeXt/Metafun to do 
generative work in the night ! ;-) 

I usually do images ; if you or the list ever want to see more, the site 
https://art-aleatoire.com <https://art-aleatoire.com/> is to show my work, and 
all you can see there is made by me using 100% MetaFun, with sometimes the help 
of you and the list, and all the time the help of your wonderful MetaFun 
manual. I’m often so much impressed by what could be done with a couples of 
lines of MetaFun code; life is made from DNA, art (perhaps illustrations would 
be a better world) could be made by the MetaFun « randomized » function.

« art-aleatoire »  is french, and can be translated to «  random art ». So the 
function I use the most in MetaFun is « randomized » !

> 
>> Would be nice to have it in the Garden so newcomers see what ConTeXt is able 
>> to do.
> 
> Yes, we should definitely collect links there.

I will be glad to contribute to the wiki in any way people think would be 
useful. 

> Hans
> 
Fabrice.


> -
>  Hans Hagen | PRAGMA ADE
>  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
>   tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
> -
> ___
> If your question is of interest to others as well, please add an entry to the 
> Wiki!
> 
> maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/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] midi

2021-02-03 Thread Fabrice L

> Le 3 févr. 2021 à 15:50, Henning Hraban Ramm  a écrit :
> 
>> Am 03.02.2021 um 20:00 schrieb Fabrice L :
>> 
>> Hi,
>> 
>> Off topic (I hope this is ok), an animation made 100% with ConTeXt / 
>> MetaFun. Several elements in the 6 840 images are sync to the music (i.e 
>> images « react » to music - although imperfectly). Theses thousand of pages 
>> are used to make a 3m49s animation. If somebody if ever interested I can 
>> give more details of the process.  
>> 
>> https://youtu.be/3x03g-eHFC8
> 
> Great! Would you please write an article about that for our journal? Or first 
> present it at the ConTeXt meeting?

Thanks ! Yes, I can do and article with pleasure. Just give me more indications 
about the level (perhaps some examples) and length of the paper. I would be 
delighted and honoured to present at a ConTeXt meeting, but they are usually in 
Europe and I’m in Canada, so this could be really challenging. 

> Hraban

Fabrice.

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

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

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


Re: [NTG-context] midi

2021-02-03 Thread Fabrice L
Hi,

Off topic (I hope this is ok), an animation made 100% with ConTeXt / MetaFun. 
Several elements in the 6 840 images are sync to the music (i.e images « react 
» to music - although imperfectly). Theses thousand of pages are used to make a 
3m49s animation. If somebody if ever interested I can give more details of the 
process.  

https://youtu.be/3x03g-eHFC8 <https://youtu.be/3x03g-eHFC8>

Fabrice.

> Le 3 févr. 2021 à 12:09, Hans Hagen  a écrit :
> 
> Hi,
> 
> So, in context, we can do text, and we can do graphics, and also fonts, now 
> do we also need an interface to midi?
> 
> https://www.youtube.com/watch?v=dIKEiKTVwgE
> 
> 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
___


[NTG-context] Hatch a cell : meta:hash:left

2021-01-16 Thread Fabrice Couvreur
Hi,
I seem to have seen a method for hatching the cell of a table, but maybe
it's my imagination. The following code does not work.
Thanks for your help.
Fabrice

## hatching.tex #

\setupcolors[state=start]
\usemodule[xwi]
\starttext
\startxtable
 [align={lohi,middle}, width=1.5cm,framecolor=purple]
\startxrow
\startxcell[background=color,backgroundcolor=paleturquoise]
  i
\stopxcell
\startxcell
 [background=meta:hash:left, meta:hash:linecolor=green]

\stopxcell
\startxcell
   0
\stopxcell
\startxcell
   1
\stopxcell
\startxcell
   2
\stopxcell
\stopxrow
\stopxtable
\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] printing the current date

2021-01-10 Thread Fabrice L


> Le 10 janv. 2021 à 13:23, Peter Münster  a écrit :
> 
> Hi,
> 
> I would expect, that \currentdate prints the current date, but it does
> not:
> 
> --8<---cut here---start->8---
> \starttext
> \date[d=1]% first day of this month, ok
> 
> \date% again first day, last parameters are used, this is ok
> 
> \currentdate% same as \date, but I would expect the day of today...
> \stoptext
> --8<---cut here---end--->8---
> 
> How could I print the current date please?

For exemple:

 \date[][weekday,day,month,year] and \currenttime[h,{\,:\,},m] 

F.

> 
> TIA for any hints,
> -- 
>   Peter
> ___
> If your question is of interest to others as well, please add an entry to the 
> Wiki!
> 
> maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/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 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] Check if two paths intersect in Metafun

2020-12-25 Thread Fabrice L
Hi,

> Le 25 déc. 2020 à 08:48, Jairo A. del Rio  a écrit :
> 
> Hi, list. I've got a question about paths and intersections. The following:
> 
> \starttext 
> \startMPpage
> path p[];
> 
> p[1] = fullcircle scaled 2cm;
> p[2] = unitsquare shifted (4cm,6cm);
> 
> if (known (p[1] intersectionpoint p[2])):
> 
> draw textext("yes");
> 
> else:
> 
> draw textext("no");
> fi;
> 
> \stopMPpage
> \stoptext
> 
> yields an error message: "The paths don't intersect". Is there a way to 
> intercept this error message and trigger an action instead? Thank you in 
> advance.

Instead of using « intersectionpoint » use « Intersectiontimes », this will 
give you the « time » of the intersection of the two paths. If the paths do not 
intersect, than the value is (-1,-1). So you could do something like:

pair checkintersec ;
checkintersec := p[1] intersectiontimes p[2] ;
If xpart(checkintersec) <> -1 : 
draw textext("yes »);
else: 
draw textext(« non »);
fi;

Fabrice.

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

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

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


[NTG-context] Problem with \dfrac{}{} with lmtx updated

2020-12-24 Thread Fabrice Couvreur
Hi,
I just updated lmtx and I don't understand the error that occurs with the
\dfrac{}{}. Thank you.
Fabrice

#
\starttext
\m{f(x)=\dfrac{a + b\ln(x)}{x}}
\stoptext
#

tex error   > tex error on line 2 in file ./hans_21.tex: Math error:
parameter 'fractionnumup' in style 2 is not set


 \math_m_nop #1->\relax \ifmmode #1\else \normalstartimath
#1\normalstopimath
\fi
 \m{f(x)=\dfrac{a + b\ln(x)}{x}}



1 \starttext
2 >>  \m{f(x)=\dfrac{a + b\ln(x)}{x}}
3 \stoptext


Sorry, but I can't typeset math unless various parameters have been set.
This is
normally done by loading special math fonts into the math family slots.
Your font
set is lacking at least the parameter mentioned earlier.


mtx-context | fatal error: return code: 256

TeX Output exited abnormally with code 1 at Thu Dec 24 16:30:13
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/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] Several lines under a limit

2020-11-28 Thread Fabrice Couvreur
Hi Wolfgang,
I knew the \substack command exists with latex but not with context, thanks
a lot.
Fabrice

Le sam. 28 nov. 2020 à 16:29, Wolfgang Schuster <
wolfgang.schuster.li...@gmail.com> a écrit :

> Fabrice Couvreur schrieb am 28.11.2020 um 15:57:
> > Hi,
> > Is there a command that allows to write multiple lines under the command
> > \lim ?
> > I tried but ...
> > Cordially
> > Fabrice
> >
> > \starttext
> > \startformula
> >\lim_{
> >  \vbox{\startalign
> >\NC x \to 2 \NR
> >\NC x > 2   \NR
> >  \stopalign}}=+\infty
> > \stopformula
> > \stoptext
>
> \starttext
>
> \startformula
>\lim_{%
>  \startsubstack
>x \to 2 \NR
>x  >  2 \NR
>  \stopsubstack
>} = +\infty
> \stopformula
>
> \stoptext
>
> 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
___


[NTG-context] Several lines under a limit

2020-11-28 Thread Fabrice Couvreur
Hi,
Is there a command that allows to write multiple lines under the command
\lim ?
I tried but ...
Cordially
Fabrice

\starttext
\startformula
  \lim_{
\vbox{\startalign
  \NC x \to 2 \NR
  \NC x > 2   \NR
\stopalign}}=+\infty
\stopformula
\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] Units of xpart and ypart of a pair in MetaFun

2020-11-26 Thread Fabrice L
Keith,

> Le 26 nov. 2020 à 12:12, Keith McKay  a écrit :
> Thanks Fabrice and Hans.
> 
> I now see I can simplify some lines of the code:
> 
> pp := ((xpart a[i])/cf*cm, (ypart a[i])/cf*cm); now becomes pp:= a[i];
> 
> and
> 
> pp := pp --- ((xpart a[i+1]/cf)*cm, (ypart a[i+1])/cf*cm); now becomes pp := 
> pp --- a[i +1] ;
> 
> However I still have the problem in the calculation of xcoord and ycoord 
> which are used in the creation of path pp:
>   
>   for squig = 1 step 1 until 15:
> 
>   xcoord := uniformdeviate(1) - 0.5 + (xpart a[i]/cf);
> 
>   ycoord := uniformdeviate(1) - 0.5+ (ypart a[i]/cf);
> 
>   pp := pp  .. {curl 100}(xcoord*cm, ycoord*cm);
> 
>   endfor;
> 
> I'm adding a small random amount to the x and ypart of the pair a[i] to 
> produce a path that is like a squiggle (gribouiller in French, according to 
> Google). I have to use cf to convert to the x and yparts to centimeters since 
> they seem to loose the centimeter units on separation. I can't see anyway 
> round this, or am I missing something?
> 
> Thanks
> Keith McKay

First « uniformdeviate(1) - 0.5 » could be modified to « uniformdeviate(0.5)».

To add noise, you can use the randomized function of Metafun. For exemple, you 
can write:

draw pp randomized 1cm ;

Fabrice.



> 
> On 26/11/2020 15:19, Fabrice L wrote:
>> Hi keith,
>> 
>>> Le 26 nov. 2020 à 10:09, Keith McKay >> <mailto:mckaymeis...@gmail.com>> a écrit :
>>> 
>>> Hi,
>>> 
>>> I have been using xpart and ypart to extract these values from pairs of 
>>> points in a path but I wasn't getting the correct result. I was expecting:
>>> 
>>> pair (2cm, 11cm) to give xpart 2 and ypart 11
>>> 
>>> However I was getting:
>>> 
>>> pair (2cm, 11cm) -> xpart 56.6929 and ypart 311.8096
>>> 
>>> After much head scratching and reading the MetaPost and MetaFun manuals, I 
>>> realised that the units of xpart or ypart are in Postcript points or Big 
>>> Points (bp), and 1 bp is 1/72 of an inch, and thus to get the values of 
>>> xpart or ypart in cm I would have to use a correction factor. I had made 
>>> the assumption that since the x and ypart in the pair was in cm that the 
>>> result would be in cm, but I see now that this is not the case. Will I have 
>>> to continue doing this or is there some magic within MetaFun which takes 
>>> account of the units in a pair and outputs the result of x and ypart in the 
>>> same units?
>>> 
>>> The MWE belows shows what I have been doing.
>>> 
>>> Thanks
>>> 
>>> Keith McKay
>>> 
>>> %%% MWE %%%
>>> \setuppapersize [A5, landscape][A4, portrait]
>>> \usecolors[crayola]
>>> \starttext
>>> \startMPpage
>>> StartPage;
>>> width := PaperWidth ; height := PaperHeight ; unit := cm ;
>>> numeric squig;
>>> pair a[]; a0 = (2cm,11cm);  a1 = (4cm,10cm);  a2 = (6cm,9cm);  a3 = 
>>> (8cm,8cm);
>>> show xpart a[0], ypart a[0]; %Example of result from x and ypart before 
>>> applying correction factor (cf) %
>>> cf := 72/2.54; %Converts points/in to points/cm%
>>> path pp;
>>> for i = 0 step 1 until 3:
>>> pp := ((xpart a[i])/cf*cm, (ypart a[i])/cf*cm);
>>> for squig = 1 step 1 until 15:
>>> xcoord := uniformdeviate(1) - 0.5 + (xpart a[i]/cf);
>>> ycoord := uniformdeviate(1) - 0.5+ (ypart a[i]/cf);
>>> pp := pp  .. {curl 100}(xcoord*cm, ycoord*cm);
>>> endfor;
>>> pp := pp --- cycle;
>>> if i < 3 :
>>> pp := pp --- ((xpart a[i+1]/cf)*cm, (ypart a[i+1])/cf*cm);
>>> fi; 
>>> f :=((1.4 - 0.6) * uniformdeviate(1)) + 0.8; % Factor to lighten/darken 
>>> colour %
>>> draw pp withpen pencircle xscaled 0.5mm yscaled .1mm rotated 45 
>>> withcolor (f[white,\MPcolor{BurntSienna}]);
>>> endfor;
>>> StopPage;
>>> \stopMPpage
>>> \stoptext
>>> %%
>>> 
>> 
>> MetaPost (MetaFun) is taking care of everything regarding units. As you ave 
>> discovered, everything is translated to a unique internal dimension. So you 
>> can write:
>> 
>>  a := (1cm,2in) ;
>> 
>> with no problem. The « cm » and « in » parts of the exp

Re: [NTG-context] Units of xpart and ypart of a pair in MetaFun

2020-11-26 Thread Fabrice L
Hi keith,

> Le 26 nov. 2020 à 10:09, Keith McKay  a écrit :
> 
> Hi,
> 
> I have been using xpart and ypart to extract these values from pairs of 
> points in a path but I wasn't getting the correct result. I was expecting:
> 
> pair (2cm, 11cm) to give xpart 2 and ypart 11
> 
> However I was getting:
> 
> pair (2cm, 11cm) -> xpart 56.6929 and ypart 311.8096
> 
> After much head scratching and reading the MetaPost and MetaFun manuals, I 
> realised that the units of xpart or ypart are in Postcript points or Big 
> Points (bp), and 1 bp is 1/72 of an inch, and thus to get the values of xpart 
> or ypart in cm I would have to use a correction factor. I had made the 
> assumption that since the x and ypart in the pair was in cm that the result 
> would be in cm, but I see now that this is not the case. Will I have to 
> continue doing this or is there some magic within MetaFun which takes account 
> of the units in a pair and outputs the result of x and ypart in the same 
> units?
> 
> The MWE belows shows what I have been doing.
> 
> Thanks
> 
> Keith McKay
> 
> %%% MWE %%%
> \setuppapersize [A5, landscape][A4, portrait]
> \usecolors[crayola]
> \starttext
> \startMPpage
> StartPage;
> width := PaperWidth ; height := PaperHeight ; unit := cm ;
> numeric squig;
> pair a[]; a0 = (2cm,11cm);  a1 = (4cm,10cm);  a2 = (6cm,9cm);  a3 = (8cm,8cm);
> show xpart a[0], ypart a[0]; %Example of result from x and ypart before 
> applying correction factor (cf) %
> cf := 72/2.54; %Converts points/in to points/cm%
> path pp;
> for i = 0 step 1 until 3:
>   pp := ((xpart a[i])/cf*cm, (ypart a[i])/cf*cm);
>   for squig = 1 step 1 until 15:
>   xcoord := uniformdeviate(1) - 0.5 + (xpart a[i]/cf);
>   ycoord := uniformdeviate(1) - 0.5+ (ypart a[i]/cf);
>   pp := pp  .. {curl 100}(xcoord*cm, ycoord*cm);
>   endfor;
>   pp := pp --- cycle;
>   if i < 3 :
>   pp := pp --- ((xpart a[i+1]/cf)*cm, (ypart a[i+1])/cf*cm);
>   fi; 
>   f :=((1.4 - 0.6) * uniformdeviate(1)) + 0.8; % Factor to lighten/darken 
> colour %
>   draw pp withpen pencircle xscaled 0.5mm yscaled .1mm rotated 45 
> withcolor (f[white,\MPcolor{BurntSienna}]);
> endfor;
> StopPage;
> \stopMPpage
> \stoptext
> %%
> 

MetaPost (MetaFun) is taking care of everything regarding units. As you ave 
discovered, everything is translated to a unique internal dimension. So you can 
write:

 a := (1cm,2in) ;

with no problem. The « cm » and « in » parts of the expression will become 
numbers to translate this number on the right unit. 
Fabrice.
> ___
> If your question is of interest to others as well, please add an entry to the 
> Wiki!
> 
> maillist : ntg-context@ntg.nl <mailto:ntg-context@ntg.nl> / 
> http://www.ntg.nl/mailman/listinfo/ntg-context 
> <http://www.ntg.nl/mailman/listinfo/ntg-context>
> webpage  : http://www.pragma-ade.nl <http://www.pragma-ade.nl/> / 
> http://context.aanhet.net <http://context.aanhet.net/>
> archive  : https://bitbucket.org/phg/context-mirror/commits/ 
> <https://bitbucket.org/phg/context-mirror/commits/>
> wiki : http://contextgarden.net <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] startCSV Wiki, Natural Table

2020-11-24 Thread Fabrice L


> Le 24 nov. 2020 à 13:36, Wolfgang Schuster 
>  a écrit :
> 
> Fabrice L schrieb am 24.11.2020 um 19:08:
>>> Le 24 nov. 2020 à 12:52, Wolfgang Schuster 
>>>  a écrit :
>>> 
>>> Fabrice L schrieb am 24.11.2020 um 18:44:
>>>> Hi,
>>>> I was using in the past (MKII) a snippet of code to produce (natural) 
>>>> tables from CSV. I was trying to compile my code with MKIV, but this does 
>>>> not work anymore. As a matter of fact, it doe snot work at all, nor MKII, 
>>>> nor MKIV (probably my error !).
>>>> So I came back to the wiki, where my code came from, and the code below is 
>>>> just a copy for the wiki. It is supposed to make a table with three 
>>>> columns, but there is only one column in the resulting table…  I admit I 
>>>> do not understand the code, but is there is missing \eTR somewhere ?
>>> Use the database module.
>>> 
>>> \usemodule[database]
>>> 
>>> \defineseparatedlist
>>>  [CSV]
>>>  [separator={,},
>>>  before=\bTABLE,
>>>   after=\eTABLE,
>>>   first=\bTR,
>>>last=\eTR,
>>>left=\bTD,
>>>   right=\eTD]
>>> 
>>> \starttext
>>> 
>>> \startCSV
>>> 1,2,3
>>> 3,5,6
>>> 7,8,9
>>> \stopCSV
>>> 
>>> \stoptext
>>> 
>>> Wolfgang
>> Wolfgang, thanks. I have seen the use if the database module on the wiki, 
>> but was trying to do without it, the reason is that my documents are often 
>> shared with colleagues, for which installation of modules is most often very 
>> difficult.
> 
> There is nothing to install because the database module is part of ConTeXt.

I see… wonderfull ! Thanks a lot for the help. 
> 
> Wolfgang

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

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


Re: [NTG-context] startCSV Wiki, Natural Table

2020-11-24 Thread Fabrice L


> Le 24 nov. 2020 à 12:52, Wolfgang Schuster 
>  a écrit :
> 
> Fabrice L schrieb am 24.11.2020 um 18:44:
>> Hi,
>> I was using in the past (MKII) a snippet of code to produce (natural) tables 
>> from CSV. I was trying to compile my code with MKIV, but this does not work 
>> anymore. As a matter of fact, it doe snot work at all, nor MKII, nor MKIV 
>> (probably my error !).
>> So I came back to the wiki, where my code came from, and the code below is 
>> just a copy for the wiki. It is supposed to make a table with three columns, 
>> but there is only one column in the resulting table…  I admit I do not 
>> understand the code, but is there is missing \eTR somewhere ?
> 
> Use the database module.
> 
> \usemodule[database]
> 
> \defineseparatedlist
>  [CSV]
>  [separator={,},
>  before=\bTABLE,
>   after=\eTABLE,
>   first=\bTR,
>last=\eTR,
>left=\bTD,
>   right=\eTD]
> 
> \starttext
> 
> \startCSV
> 1,2,3
> 3,5,6
> 7,8,9
> \stopCSV
> 
> \stoptext
> 
> Wolfgang

Wolfgang, thanks. I have seen the use if the database module on the wiki, but 
was trying to do without it, the reason is that my documents are often shared 
with colleagues, for which installation of modules is most often very 
difficult. 
Anyway, I will use the database module this time, so simple ! Thanks again.

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

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


[NTG-context] startCSV Wiki, Natural Table

2020-11-24 Thread Fabrice L
Hi,

I was using in the past (MKII) a snippet of code to produce (natural) tables 
from CSV. I was trying to compile my code with MKIV, but this does not work 
anymore. As a matter of fact, it doe snot work at all, nor MKII, nor MKIV 
(probably my error !). 

So I came back to the wiki, where my code came from, and the code below is just 
a copy for the wiki. It is supposed to make a table with three columns, but 
there is only one column in the resulting table…  I admit I do not understand 
the code, but is there is missing \eTR somewhere ?

Thanks for any help.
Fabrice.

Ps: in case someone is interested, I use this to produce statistical tables for 
teaching. I can share.. ! 

% --
\starttext

% Iterate over all the lines of text captured with \obeylines active
% command to call is first argument, is not called for empty lines
\bgroup
\obeylines
\gdef\ProcessLines#1#2{\doProcessLines{#1}#2^^M\doProcessLines}%
\gdef\doProcessLines#1#2^^M#3\doProcessLines{%
 \doifnotempty{#2}{#1{#2}}%
 \doifnotempty{#3}{\doProcessLines{#1}#3\doProcessLines}%
}%
\egroup

\def\startCSV{\bgroup\obeylines\dostartCSV}

\def\TBLentry#1{\bTD#1\eTD}
\def\TBLline#1{\bTR\processcommalist[#1]\TBLentry}

\def\dostartCSV#1\stopCSV{%
  \bTABLE
  \ProcessLines\TBLline{#1}%
  \eTABLE
  \egroup
}

% some additional settings for the table may be made as well
\setupTABLE[c][2][style=\tt]
\setupTABLE[c][3][align=middle]
\setupTABLE[r][1][style=bold] 

\startCSV
Name,Email,Accepted
\CONTEXT,wo...@trying.to,Yes
Hans,m...@developer.of,Yes
Bug,g...@rid.of,No
\stopCSV

\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] MacOS+TeXlive: installation problems

2020-11-17 Thread Fabrice L
Hi,

> Le 17 nov. 2020 à 15:23, Tomas Hala  a écrit :
> 
> Hi all,
> 
> one student of mine asked me for a help with installation TeXlive 
> (from http://www.tug.org/mactex/mactex-download.html) 
> on her MacBook Air 16 with macOS Catalina.
> 
> Despite the fact that the site states 
> "All install packages are developer-signed and notarized by Apple.",
> she got:
> "Cannot be opened because its from unidentified developer, MacOS cannot 
> verify that this app is free from malware."
> 
> What could it be? 
> I have got no experience with MacOS, so I would like to ask for some hints 
> how we can fix it.

The solution is rather simple, check here:
https://support.apple.com/en-us/HT202491 
<https://support.apple.com/en-us/HT202491>
or
https://support.apple.com/en-ca/guide/mac-help/mh40616/macAfter 
<https://support.apple.com/en-ca/guide/mac-help/mh40616/macAfter>

> 
> Thanks in advance.
> Best wishes,
> Tomáš

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

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


Re: [NTG-context] Import a metapost extension

2020-09-02 Thread Fabrice Couvreur
Hello,
That's okay, I'll compile the files with mpost and do an image insert. Thanks
for your help.
Fabrice

Le mar. 1 sept. 2020 à 19:32, Wolfgang Schuster <
wolfgang.schuster.li...@gmail.com> a écrit :

> Taco Hoekwater schrieb am 01.09.2020 um 19:12:
>
> Hi,
>
>
> On 1 Sep 2020, at 16:46, Hans Hagen   
> wrote:
>
> On 9/1/2020 3:04 PM, Fabrice Couvreur wrote:
>
> Hi Taco,
> Thank you for your help. I specify that this extension works perfectly by 
> compiling the following file.
>
> A logfile of a failed run would have been more helpful in trying to track 
> down the problem. But I did notice that there is a LaTeX file loaded in your 
> succesful run. So perhaps the extension depends on LaTeX
>
>
> I looked for the file online [1] and it uses LaTeX commands (even
> begin/end blocks) for all text boxes.
>
> [1] https://melusine.eu.org/syracuse/poulecl/mp-scratch/
>
> 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] Import a metapost extension

2020-09-01 Thread Fabrice Couvreur
Hi Taco,
Thank you for your help. I specify that this extension works perfectly by
compiling the following file.

input mp-scratch;

Scratchversion:=3;

beginfig(1);
  draw Drapeau;
  draw Repeter("4");
  draw Avancer("100");
  draw Tournerd("90");
  draw FinBlocRepeter;
  endfig;
end


But what you are proposing unfortunately does not work.
Fabrice

Le mar. 1 sept. 2020 à 14:25, Taco Hoekwater  a écrit :

> Hi,
>
> I think you need this:
>
> \startMPinclusions
>   input mp-scratch;
> \stopMPinclusions
>
> \startMPcode
>   Scratchversion:=3;
>   ….
>
> If that also doesn’t work, perhaps attach the log file / terminal output
> to a new message.
>
> Best wishes,
> Taco
>
> > On 1 Sep 2020, at 13:07, Fabrice Couvreur 
> wrote:
> >
> > Hello
> > Is it possible to import a metapost extension into a file compiled with
> the lmtx engine ?
> > I tried unsuccessfully with this example :
> >
> >  begin test.tex
> >
> > \starttext
> > \startMPcode
> >   input mp-scratch;
> >
> > Scratchversion:=3;
> >
> > draw Drapeau;
> > draw Repeter("4");
> > draw Avancer("50");
> > draw Tournerd("90");
> > draw FinBlocRepeter;
> >
> > \stopMPcode
> > \stoptext
> >
> >  end test.tex
> >
> > Thanks
> > Fabrice
> >
> ___
> > If your question is of interest to others as well, please add an entry
> to the Wiki!
> >
> > maillist : ntg-context@ntg.nl /
> http://www.ntg.nl/mailman/listinfo/ntg-context
> > webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
> > archive  : https://bitbucket.org/phg/context-mirror/commits/
> > wiki : http://contextgarden.net
> >
> ___
>
> Taco Hoekwater
> Elvenkind BV
>
>
>
>
>
> ___
> If your question is of interest to others as well, please add an entry to
> the Wiki!
>
> maillist : ntg-context@ntg.nl /
> http://www.ntg.nl/mailman/listinfo/ntg-context
> webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
> archive  : https://bitbucket.org/phg/context-mirror/commits/
> wiki : http://contextgarden.net
>
> ___
>
This is MetaPost, version 2.00 (TeX Live 2020) (kpathsea version 6.3.2)  1 SEP 2020 15:01
**scratch-1.mp
(/home/viserion/texlive/2020/texmf-dist/metapost/base/mpost.mp
(/home/viserion/texlive/2020/texmf-dist/metapost/base/plain.mp
Preloading the plain mem file, version 1.005) ) (./scratch-1.mp
(/home/viserion/texmf/metapost/mp-scratch.mp
(/home/viserion/texmf/metapost/LATEXScratch.mp)
(/home/viserion/texmf/metapost/Mouvement.mp)
(/home/viserion/texmf/metapost/Apparence.mp)
(/home/viserion/texmf/metapost/Sons.mp) (/home/viserion/texmf/metapost/Stylo.mp
) (/home/viserion/texmf/metapost/Controle.mp)
(/home/viserion/texmf/metapost/Evenements.mp)
(/home/viserion/texmf/metapost/Bloc.mp)
(/home/viserion/texmf/metapost/Divers.mp)
(/home/viserion/texmf/metapost/Capteurs.mp)
(/home/viserion/texmf/metapost/Variable.mp)) (./mptextmp.mp) (./mptextmp.mp)
>> 34.55159
>> 55.29037 (./mptextmp.mp) (./mptextmp.mp)
>> 105.50436 (./mptextmp.mp) (./mptextmp.mp) (./mptextmp.mp) (./mptextmp.mp)
(./mptextmp.mp) (./mptextmp.mp)
>> 39.74248
>> 63.32898 (./mptextmp.mp) (./mptextmp.mp)
>> 84.05197 (./mptextmp.mp) (./mptextmp.mp) (./mptextmp.mp) (./mptextmp.mp)
(./mptextmp.mp) (./mptextmp.mp)
>> 56.92798
>> 92.35968 (./mptextmp.mp) (./mptextmp.mp)
>> 112.43477 (./mptextmp.mp) (./mptextmp.mp) (./mptextmp.mp) (./mptextmp.mp)
(./mptextmp.mp) (./mptextmp.mp)
>> 97.13678
>> 127.64769 (./mptextmp.mp) (./mptextmp.mp)
>> 171.08908 (./mptextmp.mp) [1{psfonts.map}{crlt_csjzgd.enc}] )
1 output file written: scratch-1.1

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

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


[NTG-context] Import a metapost extension

2020-09-01 Thread Fabrice Couvreur
Hello
Is it possible to import a metapost extension into a file compiled with the
lmtx engine ?
I tried unsuccessfully with this example :

 begin test.tex

\starttext
\startMPcode
  input mp-scratch;

Scratchversion:=3;

draw Drapeau;
draw Repeter("4");
draw Avancer("50");
draw Tournerd("90");
draw FinBlocRepeter;

\stopMPcode
\stoptext

%%%% end test.tex

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

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


Re: [NTG-context] Mathematical symbol of non-inclusion

2020-08-31 Thread Fabrice Couvreur
Hi Hans,
Thank you for the clarification
Fabrice

Le dim. 30 août 2020 à 17:56, Hans Åberg  a écrit :

>
> > On 30 Aug 2020, at 11:40, Fabrice Couvreur 
> wrote:
> >
> > @Hans My ignorance is total : how to write symbols from the keyboard ?
>
> I use text substitutions on MacOS: a sequence of characters can be
> automatically translated into another. So for example, ".subset" might
> translate into "⊂" as you type along. To find the ⊂ the first time, there
> is a Unicode symbol table. Other platforms and editors have similar
> features. There are other ways, but I have found this easiest and fastest
> both to create and use.
>
>
>
> ___
> If your question is of interest to others as well, please add an entry to
> the Wiki!
>
> maillist : ntg-context@ntg.nl /
> http://www.ntg.nl/mailman/listinfo/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] Mathematical symbol of non-inclusion

2020-08-30 Thread Fabrice Couvreur
Hello,
Thank you for your answers.
@Hans My ignorance is total : how to write symbols from the keyboard ?
Fabrice

Le sam. 29 août 2020 à 20:41, Hans Åberg  a écrit :

>
> > On 29 Aug 2020, at 19:58, Wolfgang Schuster <
> wolfgang.schuster.li...@gmail.com> wrote:
> >
> > Fabrice Couvreur schrieb am 29.08.2020 um 19:27:
> >> Hello,
> >> The result is not what you expected.
> >> How can I correct this problem?
> >
> > 1. Wait for a fix.
> >
> > 2. Use \nsubset.
> >
> > \starttext
> > \m{A \nsubset B}
> > \stoptext
>
> One can also use Unicode directly, choosing the style:
>
> \starttext
> \m{A ⊄ B ⊈ C ⊊ D}
> \stoptext
>
>
> ___
> If your question is of interest to others as well, please add an entry to
> the Wiki!
>
> maillist : ntg-context@ntg.nl /
> http://www.ntg.nl/mailman/listinfo/ntg-context
> webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
> archive  : https://bitbucket.org/phg/context-mirror/commits/
> wiki : http://contextgarden.net
>
> ___
>
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

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


[NTG-context] Mathematical symbol of non-inclusion

2020-08-29 Thread Fabrice Couvreur
Hello,
The result is not what you expected.
How can I correct this problem?
Thank you
Fabrice

\starttext
\m{A \not\subset B}
\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] Label to delete in the table of contents

2020-08-24 Thread Fabrice Couvreur
Thanks !!

Le lun. 24 août 2020 à 15:41, Wolfgang Schuster <
wolfgang.schuster.li...@gmail.com> a écrit :

> Fabrice Couvreur schrieb am 24.08.2020 um 15:32:
>
> Hi Wolfgang,
> Thank you for your reply. Probably my fault but now I get the number 0 on
> the word "Summary".
> Fabrice
> [image: contents.png]
>
>
> \setuphead
>   [title]
>   [command=,
>numbercommand=]
>
> 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] Label to delete in the table of contents

2020-08-24 Thread Fabrice Couvreur
Hi Wolfgang,
Thank you for your reply. Probably my fault but now I get the number 0 on
the word "Summary".
Fabrice
[image: contents.png]

Le lun. 24 août 2020 à 15:12, Wolfgang Schuster <
wolfgang.schuster.li...@gmail.com> a écrit :

> Fabrice Couvreur schrieb am 23.08.2020 um 16:02:
>
> Hello,
> For the title of the chapters I use the following command.
>
> \unexpanded\def\HeadTitle#1#2%
>{\framed
>   [frame=off,
>width=fit,
>align=flushleft]
>{\color[darkgray]{\tfxx\cap\bf\labeltext{chapter}}
> \blank#1\blank#2}
>
> When I compile my project, I have the label "Chapitre" above the word
> "Sommaire" in the table of contents : how to delete it ?
>
>
> 1. Don't apply the command to \title
>
> \setuphead[title][command=]
>
>
> 2. Make the command local to bodypart of your document, this works only
> when you use section blocks (e.g. \startbodymatter)
>
> \startsectionblockenvironment[bodypart]
> \setuphead[chapter][command=\HeadTitle]
> \stopsectionblockenvironment
>
>
> 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
___


[NTG-context] Color specific cells in a table

2020-08-23 Thread Fabrice Couvreur
Hello,
This table will be used to illustrate Pascal's triangle. I manage to color
the cell (2,0) but I would also like to color the cells (2,1) and (3,1). Is
it possible ?
Thank you
Fabrice

\usecolors[X11]

\starttext
\startluacode

  local background_one = {
   align = "middle",
   style = "type",
   background = "color",
   backgroundcolor = "thistle2",
   foregroundcolor = "white",
  }

   local background_two = {
   align = "middle",
   style = "type",
   background = "color",
   backgroundcolor = "peachpuff",
   foregroundcolor = "white",
  }

  context.startxtable({"align={middle,lohi},
width=1cm,offset=0.8ex,bodyfont=9pt,framecolor=cyan"})
  context.startxrow()
  context.startxcell({"background=color,backgroundcolor=thistle2"})
  context("")
  context.stopxcell()
  for j = 0, 7 do

context.startxcell({"foregroundstyle=bold,background=color,backgroundcolor=thistle2"})
  context(j)
  context.stopxcell()
  end

context.startxcell({"foregroundstyle=bold,background=color,backgroundcolor=thistle2"})
  context("\\dots")
  context.stopxcell()
  context.stopxrow()
  for i = 0, 7 do
  context.startxrow()

context.startxcell({"foregroundstyle=bold,background=color,backgroundcolor=thistle2"})
  context(i)
  context.stopxcell()
  for j = 0, 8 do
  context.startxcell(j>i and background_one or i == 2 and j == 0 and
background_two)
  context("")
  context.stopxcell()
  end
  context.stopxrow()
  end
  context.startxrow()
  context.startxcell({"background=color,backgroundcolor=thistle2"})
  context("\\dots")
  context.stopxcell()
  for i = 0, 8 do
  context.startxcell()
  context("")
  context.stopxcell()
  end
  context.stopxrow()
  context.stopxtable()
\stopluacode
\stoptext
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

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


[NTG-context] Label to delete in the table of contents

2020-08-23 Thread Fabrice Couvreur
Hello,
For the title of the chapters I use the following command.

\unexpanded\def\HeadTitle#1#2%
   {\framed
  [frame=off,
   width=fit,
   align=flushleft]
   {\color[darkgray]{\tfxx\cap\bf\labeltext{chapter}}
\blank#1\blank#2}

When I compile my project, I have the label "Chapitre" above the word
"Sommaire" in the table of contents : how to delete it ?
Thanks for your help
Fabrice
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

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


[NTG-context] Chapter number with Luametafun

2020-08-18 Thread Fabrice Couvreur
Hello,
How to get the number of the current chapter ?
How to get the label "Chapitre" ?
Thanks for your help.
Fabrice

%%% Begin example

\mainlanguage[fr]

\setcharacterspacing [frenchpunctuation]

\setuplabeltext[fr][chapter=Chapitre~]

\startuseMPgraphic{fun}
  definecolor[name="Mycolor", s = 0.85 ]
  draw lmt_outline
   [
text = "1",
kind = "fillup",
fillcolor = "Mycolor",
rulethickness = 1,
   ]
  xsized 1cm;
\stopuseMPgraphic

\unexpanded\def\MyNumber#1{\useMPgraphic{fun}#1}

\unexpanded\def\Title#1#2{\framed[frame=off,width=fit,align=flushleft]
  {#1\blank#2}}

\setuphead[chapter]
  [style=\bfd,
   align={flushleft,broad},
   command=\Title,
   textcommand=\MyNumber,
   numbercommand=\groupedcommand{}{\MyNumber},
   number=no]

\starttext
\startchapter
  [title={First chapter}]
  \input knuth.tex
\stopchapter
\startchapter
  [title={Second chapter}]
  \input knuth.tex
\stopchapter
\stoptext

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

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


Re: [NTG-context] About the numbering of theorems

2020-08-08 Thread Fabrice Couvreur
Hi Wolfgang,
Thank you
Fabrice

Le ven. 7 août 2020 à 19:45, Wolfgang Schuster <
wolfgang.schuster.li...@gmail.com> a écrit :

> Fabrice Couvreur schrieb am 07.08.2020 um 16:30:
> > Hello,
> > I have a little problem with the numbering of theorems when there is no
> > subsection. I would like to know :
> >
> > Theorem 1.1
> > Theorem 1.2
> >
> > Theorem 2.3
> > Theorem 2.4
> >
> > Thank you
> > Fabrice
>
> Use a conversion set to set the number conversion for you sections and
> remove the conversion setting (\setuphead[...][conversion=...]) from the
> setups.
>
> \defineconversionset [fabrice] [n,n,R,n] [n]
>
> \setupheads
>[sectionconversionset=fabrice]
>
> 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
___


[NTG-context] About the numbering of theorems

2020-08-07 Thread Fabrice Couvreur
Hello,
I have a little problem with the numbering of theorems when there is no
subsection. I would like to know :

Theorem 1.1
Theorem 1.2

Theorem 2.3
Theorem 2.4

Thank you
Fabrice

 begin example

\setuplabeltext[chapter=Chapitre~]

\unexpanded\def\Title#1#2{\framed[frame=off,width=fit,align=flushleft]{#1\blank#2}}

\startbuffer[mybuffer]
  \starttheorem
\input ward
  \stoptheorem
\stopbuffer

\setuphead
  [chapter]
  [style=\bfd,
   align={flushleft,broad},
   command=\Title]

\setuphead
  [section]
  [style=\bfc,
   distance=\zeropoint,
   sectionsegments=section,
   conversion={R},
   align={flushleft,broad},
   commandbefore={\space\endash\space}]

\setuphead
  [subsection]
   [sectionsegments=subsection,
conversion={n},
style=\bfb,
align={flushleft,broad}]

\setupenumerations
  [before={\blank},
   after={\blank},
   alternative=serried,
   title=yes,
   prefix=yes,
   prefixsegments=chapter,
   titlestyle=bold,
   width=broad]

\defineenumeration
   [theorem]
   [text=Théorème,
number=yes,
style=italic]

\starttext
\startchapter
  [title={First chapter}]
  \startsection
[title={First section}]
\startsubsection
  [title={First subsection}]
  \dorecurse{2}{\getbuffer[mybuffer]}
\stopsubsection
  \stopsection
\stopchapter
\startchapter
  [title={Second chapter}]
  \startsection
[title={Second section}]
 \dorecurse{2}{\getbuffer[mybuffer]}
  \stopsection
  \stoptheorem
\stopchapter

\stoptext

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

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


  1   2   3   4   5   6   7   8   9   >