[NTG-context] Re: lmt_shade fails

2024-02-19 Thread Fabrice L
Dear Keith,

> Le 18 févr. 2024 à 11:44, Keith McKay  a écrit :
> 
> Hi all
> I went to use the lmt_shade function and it fails with two error messages. 
> the first one is:
> 
> metafun > log > error: Not a cycle
> 
> followed by lots of trace messages, then:
> 
> metafun > log > That contour should have ended with '.. cycle' or '& 
> cycle'. So I'll not change
> anything just now.
> 
> The MWE I used is as follows:
> 
> \starttext
> \startMPpage
> definecolor [ name = "MyColor3", r = uniformdeviate(1), g = 
> uniformdeviate(1), b = uniformdeviate(1) ] ;
> definecolor [ name = "MyColor4", r = uniformdeviate(1), g = 
> uniformdeviate(1), b = uniformdeviate(1) ] ;
> draw lmt_shade [
> path = fullsquare scaled 5cm,
> direction = "up",
> alternative = "linear",
> colors = { "red", "green" },
> ];
> \stopMPpage
> \stoptext
>  I'm using:
> 
> system  > ConTeXt  ver: 2024.02.14 13:38 LMTX  fmt: 2024.2.15  int: 
> english/english
> 
> on a mac mini M1.
> 
> Any thougths?
> 

On an Mac running  ConTeXt  ver: 2023.09.26 18:19 LMTX  fmt: 2023.12.11 , this 
works perfectly. 
> Best wishes
> 
> Keith McKay
> 
Fabrice.
> ___
> If your question is of interest to others as well, please add an entry to the 
> Wiki!
> 
> maillist : ntg-context@ntg.nl / 
> https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
> webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
> archive  : https://github.com/contextgarden/context
> wiki : https://wiki.contextgarden.net
> ___

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

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


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

2024-01-11 Thread Fabrice L
Dear list, dear Hraban,

> Le 7 janv. 2024 à 13:58, Henning Hraban Ramm  a écrit :
> 
> Am 07.01.24 um 17:11 schrieb garulfo:
>> does this kind of poster would make sense ?
>> https://wiki.contextgarden.net/Cover_Pages#Poster_01_-_proposal_for_Libre_Planet_2021
> 
> Thank you, that looks good but it’s not what I had in mind.
> 
> I meant a poster _about_ ConTeXt, not only made with our toolset (I have a 
> stack of books for that). Maybe something about typography.
> 
> Here’s how the DANTE booth at FrOSCon 2023 looked like:
> https://yemaya.fiee.net/s/qTkeXAmXmJeosJc
> (The “mindmap” diagram on the left shows projects supported by DANTE, in the 
> middle a drawing by Duane Bibby, on the right a Tux with its TikZ source code 
> in the back.)
> We also had posters that show the architecture of TeX/LaTeX, but they were 
> seriously outdated.
> 
> Some elements that might fit:
> – some example code (like from Mikael’s BachoTeX presentation)
> – anatomy of a word and a formula (with all those little boxes and measures), 
> maybe also in Arabic
> – dodo & cow drawings from Mikael’s math manual
> – overview of layout areas (I re-made Sietse’s drawing from the wiki for my 
> book)
> - workflow diagrams
> – parts of LuaMetaTeX
> – artwork by Eçir Baff (art-aleatoire.com)
> – Hans’ recent christmas card / memory game artwork
> 
> But I don’t want just a wild collection of stuff, there should be something 
> connecting them. It should be interesting to look at as well as basic 
> information about ConTeXt.
> Hraban
> 

The suite ConTeXt/Metafun is so powerful, and can do so much different things, 
as already mentioned, that it can be difficult to present it in a coherent way. 
Perhaps this angle is that Context is a real Swiss Army knife: not only can it 
do lots of different things, it can do them very very well! 
You can take (and or I can provide in PDF of) any artwork from 
art-aleatoire.com , and if you wish/need I can 
contribute to an « art » part ! 

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

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


[NTG-context] Re: 2024

2024-01-02 Thread Fabrice L
Dear Hans,

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

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

> 
> -
>  Hans Hagen | PRAGMA ADE
>  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
>   tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
> -
> 
> ___
> If your question is of interest to others as well, please add an entry to the 
> Wiki!
> 
> maillist : ntg-context@ntg.nl / 
> https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
> webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
> archive  : https://github.com/contextgarden/context
> wiki : https://wiki.contextgarden.net
> ___

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

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


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

2023-12-04 Thread Fabrice L
nonym [notonaskharabic-Bold-Italic] [name:notonaskharabic] 
> >> [features=fea]
> >> \stoptypescript
> >>
> >> \starttypescript [serif] [notonaskharabic]
> >> \usetypescript[serif][fallback]
> >> \definefontsynonym [Serif] [notonaskharabic-Light] [features=fea]
> >> \definefontsynonym [SerifItalic] [notonaskharabic-Italic] [features=fea]
> >> \definefontsynonym [SerifBold] [notonaskharabic-Bold] [features=fea]
> >> \definefontsynonym [SerifBoldItalic] [notonaskharabic-Bold-Italic] 
> >> [features=fea]
> >> \stoptypescript
> >>
> >> \starttypescript [notonaskharabic]
> >> \definetypeface [notonaskharabic] [rm] [serif] [notonaskharabic] [default]
> >> \stoptypescript
> >>
> >> \usetypescript[notonaskharabic]
> >>
> >> \setupbodyfont [RomanFont]
> >>
> >> \usecolors[crayola]
> >>
> >> \startMPinclusions
> >>
> >> picture p[];
> >> path TheFrame ;
> >> TheFrame := fullsquare scaled 5in ;
> >>
> >> z0 = (0,0);
> >> z1 = (60,40);
> >> z2 = (40,90);
> >> z3 = (10,70);
> >> z4 = (30,50);
> >> z5 = (90,70);
> >> z6 = (-10,70);
> >>
> >> path A; A = z0..z1..z2..z3..z4 ;
> >> pair AStartPoint; AStartPoint = point 0 of A;
> >> pair AEndPoint; AEndPoint = point 4 of A;
> >> path B; B = z5..z6;
> >> pair BStartPoint; BStartPoint = point 0 of B;
> >> pair BEndPoint; BEndPoint = point 1 of B;
> >> path C; C = AStartPoint..AEndPoint;
> >>
> >> p1:=image(
> >> draw A withcolor red;
> >> );
> >>
> >> p2:=image(draw A; label(lmt_outline [
> >> text = "\JapaneseFont 日本語"
> >> ], AEndPoint););
> >>
> >> p3:=image(
> >> label(textext("\notonaskharabic \textdir TRT دانگ") scaled 1.2, 
> >> BStartPoint);
> >> );
> >>
> >> p4:=image(draw A; label(lmt_outline [
> >> text = "\KoreanFont 한국어"
> >> ], AStartPoint););
> >>
> >> p5:=image(
> >> label(textext("bāng"), BEndPoint);
> >> draw C withcolor green;
> >> );
> >>
> >> p6:=image(
> >> draw B withcolor blue;
> >> );
> >> \stopMPinclusions
> >>
> >> \starttext
> >>
> >> \dorecurse{6}{ % Frame
> >> \setupMPpage[background=color, backgroundcolor=SpringGreen]
> >> \startMPpage[pagestate=start]
> >> currentime := #1 ;
> >> % Just for learning :
> >> draw TheFrame withpen pencircle scaled .1in withcolor magenta ;
> >> draw textext("T="(currentime)) scaled 2 shifted(0,2in) withcolor 
> >> magenta ;
> >> for k=1 upto currentime: draw p[k]; endfor
> >> setbounds currentpicture to TheFrame ;
> >>
> >> desiredformat := 1080;% In pixels (will be converted by default at 72dpi)
> >> currentpicture := currentpicture xysized (desiredformat ,desiredformat );
> >>
> >> \stopMPpage
> >> }
> >>
> >> \stoptext
> >> On Nov. 27 2023, at 11:25 pm, Aditya Mahajan  wrote:
> >>
> >> On Mon, 27 Nov 2023, Fabrice L wrote:
> >>
> >> > Hi,
> >> >
> >> > It is fun fact very easy to do. You just use \startMPpage (…) 
> >> > \stopMPpage multiple times. Here is an example which build an animation 
> >> > of a particle moving according to a Brownian motion.
> >>
> >> A very similar option is to pass a variable to a metapost drawing. This is 
> >> what I use:
> >>
> >> https://adityam.github.io/context-blog/post/metapost-animation/
> >>
> >> It only works when viewed in acrobat, you can just comment out the 
> >> animation part and wrap it in \startTEXpage .. \stopTEXpage to get 
> >> multi-page animation.
> >>
> >> Aditya___
> >> If your question is of interest to others as well, please add an entry to 
> >> the Wiki!
> >>
> _

I do not understand why your original code does not work, and I know Mickael 
has offered you a solution, but there is, just for curiosity,  another one to 
achieve your goal using \MPinclusions  :

% 8 < ———

\starttext

\startMPinclusions

 path TheFrame ;
 TheFrame := fullsquare scaled 5in ;

 pair Coord[] ;
 string TheText[] ; 

 TheText[1] := "Word 1" ; Coord[1] := (60,40) ;
 TheText[2] := "Word 2" ; Coord[2] := (40,90) ;
 TheText[3] := "Word 3" ; Coord[3] := (10,70) ;

\stopMPinclusions

\dorecurse{3}{ % Frame
\startMPpage%[pagestate=start]  
 currentime := #1 ;

 % Just for learning :
 draw TheFrame withpen pencircle scaled .1in withcolor magenta ;
 draw textext("T="(currentime)) scaled 2 shifted(0,2in) withcolor 
magenta ;

 for k=1 upto currentime: 
  draw textext(TheText[k]) shifted Coord[k] ;
  endfor ;
 
\stopMPpage
}

\stoptext
% 8 < ———

Fabrice. 

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

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


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

2023-11-27 Thread Fabrice L
Hi,

It is fun fact very easy to do. You just use \startMPpage (…) \stopMPpage 
multiple times. Here is an example which build an animation of a particle 
moving according to a Brownian motion. 

Fabrice.

% 8< ---

\usecolors[crayola]
\setupMPinstance

\starttext

% We can put in the inclusions the material we will use at each page, to 
declare things only one time.
\startMPinclusions
 % the frame of the video ;
 path TheFrame ;
 TheFrame := fullsquare scaled 5in ;

 randomseed := 53 ;
 path TheBrownianMotion ;
 pair Coordinate[];
 Coordinate[0] := (0,0);
 TheBrownianMotion := Coordinate[0] ;
 variance := 10 ;
\stopMPinclusions

\dorecurse{600}{ % Frame

\setupMPpage[background=color, backgroundcolor=SpringGreen]
\startMPpage[pagestate=start]

 currentime := #1 ;
 % Just for learning :
 draw TheFrame withpen pencircle scaled .1in withcolor magenta ;
 draw textext("T="(currentime)) scaled 2 shifted(0,2in) withcolor 
magenta ;

Coordinate[currentime] := Coordinate[currentime-1] + 
%(normaldeviate*variance,normaldeviate*variance) ;
  ((uniformdeviate(1)-0.5)*variance,(uniformdeviate(1)-0.5)*variance) ;
TheBrownianMotion := for p=0 upto (currentime-1) :
  Coordinate[p] .. endfor Coordinate[currentime] ;

draw TheBrownianMotion withpen pencircle scaled .01in withcolor blue ;
draw Coordinate[currentime] withpen pencircle scaled .10in withcolor red ;

setbounds currentpicture to TheFrame ;

desiredformat := 1080;% In pixels (will be converted by default at 72dpi)
currentpicture := currentpicture xysized (desiredformat ,desiredformat );

\stopMPpage

} 

\stoptext
% 8< ---



> Le 27 nov. 2023 à 13:49, Emanuel Han via ntg-context  a 
> écrit :
> 
> How can I achieve multipage metapost output from ConTeXt? The result should 
> be a multipage pdf. It contains just a metapost graphic per page. The graphic 
> has always the same bounding box and evolves from page to page: Some elements 
> to be drawn are added, and some others would ideally also be removed, while 
> keeping elements which has already been drawn on previous pages. I can manage 
> when it is not possible to remove elements (in that case I'll just cover them 
> with a covering element).
> 
> I saw that it is possible to achieve my goal with standalone metapost, as 
> described here: 
> https://tex.stackexchange.com/questions/471662/mptopdf-is-multipage-output-pdf-possible
> But I'll need to achieve this with Metapost inside ConTeXt because I use 
> labels in Metapost which print text in Japanese, Korean , Arabic and Roman 
> script: Thanks to ConTeXt, I can define appropriate fonts for each script. 
> All this works already in my working example.
> 
> The only unsolved problem is to ship out multiple pages.
> 
> For the minimal working example, I didn't remove the font defining part, 
> because having 4 different fonts is a condition of my use case. The graphic 
> on the other hand is some simple dummy nonsense graphic not from my project. 
> The graphic is in the provided example drawn as a summing up of layered 
> drawing steps (6 steps, to be precise), so no removing is implemented here 
> (because I don't know how that would be done). If each of the figures 1 to 6 
> of my mwe can be put alone on a page, I'd be already very happy. Now, they're 
> put on top of each other all on the same single page, also on top of figure 0.
> 
> The desired multipage pdf will be used in presentation mode of a pdf viewer 
> and skipped forward and backward from page to page (that is from drawing step 
> to drawing step).
> 
> mwe:
> 
> \enableregime[utf] % enable unicoded input
> 
> \definefontfamily [RomanFont] [rm] [calluna]
> 
> \definefontfamily [KoreanFont] [rm] [applemyungjo]
> 
> \definefontfamily [JapaneseFont] [rm] [hannotatesc]
> 
> \definefontfeature
>  [fea]
>  [mode=node,language=dflt,script=arab,
>   init=yes,
>   medi=yes,
>   fina=yes,
>   isol=yes,
>   calt=yes,
>   rlig=yes,
>   tlig=yes,
>   trep=yes,
>   curs=yes,
>   kern=yes,
>   mark=yes
> ]
> 
> \starttypescript [serif] [notonaskharabic]
>  \definefontsynonym [notonaskharabic-Light]   [name:notonaskharabic]  
>   [features=fea]
>  \definefontsynonym [notonaskharabic-Bold][name:notonaskharabic]  
>   [features=fea]
>  \definefontsynonym [notonaskharabic-Italic]  [name:notonaskharabic]  
>   [features=fea]
>  \definefontsynonym [notonaskharabic-Bold-Italic] [name:notonaskharabic]  
>   [features=fea]
> \stoptypescript
> 
> \starttypescript [serif] [notonaskharabic]
>  \usetypescript[serif][fallback]
>  \definefontsynonym [Serif]   [notonaskharabic-Light] 
>   [features=fea]
>  \definefontsynonym [SerifItalic] [notonaskharabic-Italic]
>   [features=fea]
>  \definefontsynonym [SerifBold]   [notonaskharabic-Bold]  
>   [features=fea]
>  \definefontsynonym [SerifBoldItalic] 
> [notonaskharabic-Bold-Italic] 

[NTG-context] Re: Strange behavior with anglestriped()

2023-11-20 Thread Fabrice L
Hi,

Fabrice, you have a problem with the definition of the path b: this path 
include q and b. To see this, replace your lines with :

   draw q anglestriped (1,45,2) withcolor cyan;
   draw b anglestriped (1,45,2) withcolor red;

And you will see that the path b is drawn twice : once in red, once in cyan. So 
if you change your instructions to :

   draw q anglestriped (1,45,2) withcolor cyan;
   draw r anglestriped (1,45,2) withcolor cyan;

This will correct the problem, because each path is now drawn only once. 

Fabrice. 

> Le 20 nov. 2023 à 14:47, Fabrice Couvreur  a 
> écrit :
> 
> Hi Otared,
> It's true that the color seems identical.
> Thanks.
> Fabrice
> 
> Le dim. 19 nov. 2023 à 21:55, Otared Kavian  > a écrit :
>> Hi Fabrice,
>> 
>> It seems to me the colors are the same, although they may appear different 
>> at first sight because the « with » of the lines are different (the width is 
>> larger in the lower rectangle).
>> 
>> I attach the PDF created with your code.
>> 
>> Best regards: Otared
>> 
>> 
>> 
>>> On 19 Nov 2023, at 18:56, Fabrice Couvreur >> > wrote:
>>> 
>>> Hi,
>>> I don't understand why the hatching of the two rectangles is not the same 
>>> color. 
>>> Thanks for your help.
>>> Fabrice
>>> 
>>> \starttext
>>> \setupbodyfont[8pt]
>>> \startMPcode
>>>path p, q, r, b ;
>>>  
>>>z[0] = (2cm,0cm) ;
>>>z[1] = (2cm,2cm) ;
>>>z[2] = (0cm,2cm) ;
>>> 
>>>p := unitsquare xyscaled (9cm, 5cm) ;
>>>q := llcorner p--z[0]--z[1]--z[2]--cycle ;
>>>r := unitsquare xyscaled (7cm,3cm) shifted(2cm,2cm) ;
>>>b := z[2]--z[1]--ulcorner r--urcorner p--lrcorner r--z[1]--
>>>z[0]--llcorner p--cycle ;
>>>
>>>   
>>>draw b anglestriped (1,45,2) withcolor cyan;
>>>draw q anglestriped (1,45,2) withcolor cyan;
>>>
>>>draw p ;
>>>
>>>label.llft("A", p) ;
>>>label.lrt("D", p) ;
>>>label.ulft("B", p) ;
>>>label.urt("C", p) ;
>>>label.lft("M", z[2]) ;
>>>label.ulft("N", z[1]) ;
>>>label.bot("P", z[0]) ;
>>>label.top("J", ulcorner r) ;
>>>label.rt("I", lrcorner r) ;
>>>label.bot(btex $x$ etex,(llcorner p+z[0])/2);
>>>label.lft(btex $x$ etex,(llcorner p+z[2])/2);
>>> \stopMPcode
>>> 
>>> \stoptext
>>> 
>>> ___
>>> If your question is of interest to others as well, please add an entry to 
>>> the Wiki!
>>> 
>>> maillist : ntg-context@ntg.nl  / 
>>> https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
>>> webpage  : https://www.pragma-ade.nl  / 
>>> https://context.aanhet.net  (mirror)
>>> archive  : https://github.com/contextgarden/context
>>> wiki : https://wiki.contextgarden.net 
>>> ___
>> 
>> Otared Kavian
>> e-mail: ota...@gmail.com 
>> Phone: +33 6 88 26 70 95
>> 
>> 
>> 
>> 
>> ___
>> If your question is of interest to others as well, please add an entry to 
>> the Wiki!
>> 
>> maillist : ntg-context@ntg.nl  / 
>> https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
>> webpage  : https://www.pragma-ade.nl  / 
>> https://context.aanhet.net  (mirror)
>> archive  : https://github.com/contextgarden/context
>> wiki : https://wiki.contextgarden.net 
>> ___
> ___
> If your question is of interest to others as well, please add an entry to the 
> Wiki!
> 
> maillist : ntg-context@ntg.nl / 
> https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
> webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
> archive  : https://github.com/contextgarden/context
> wiki : https://wiki.contextgarden.net
> ___

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

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

[NTG-context] Re: Tikz calendar problem.

2023-09-05 Thread Fabrice L
Dear Aditya,

> Le 5 sept. 2023 à 04:21, Aditya Mahajan  a écrit :
> 
> On Mon, 4 Sep 2023, Fabrice L wrote:
> 
>> Dear list,
>> 
>> I have a problem with tikzCalendar on a recent installation. This minimal 
>> example :
>> 
>> 8< 
>> 
>> \usemodule[tikz]
>> \usetikzlibrary[calendar]
>> 
>> \starttext
>> This should works:
>> \blank
>> \tikz  \calendar[dates=2000-01-01 to 2000-01-31,week list];
>> \blank
>> but this does not !
>> \stoptext
>> 
>> 8< 
>> 
>> should work, but does not. The problem seems to be here:
>> 
>> open source > level 2, order 61, name 'tikzlibrarycalendar.code.tex'
>> modules > 'pgfcalendar' is not found
>> close source> level 2, order 61, name ‘tikzlibrarycalendar.code.tex'
>> 
>> The file « tikzlibrarycalendar.code.tex » is read, but the file « 
>> pgfcalendar » seems missing. I have reinstall a new standalone version of 
>> ConTeXt, with all the modules (with the new script from ConTeXt Garden), but 
>> nothing works. 
> 
> Here is what is going on:
> 
> `tikzlibrarycalendar.code.tex` contains the line:
> 
>  \pgfutil@usemodule{pgfcalendar}
> 
> In `generic/pgf/utilities/pgfutil-context.def`, \pgfutil@usemodule is defined 
> as:
> 
>  \def\pgfutil@usemodule#1{\usemodule[#1]}
> 
> which is supposed to load the file `plain/pgf/utilities/pgfcalendar.tex` 
> which just a wrapper to load `pgfcalendar.code.tex`:
> 
> 
>\edef\pgfcalendaratcode{\the\catcode`\@}
>\catcode`\@=11
> 
>\input pgfrcs.tex
>\input pgfcalendar.code.tex
> 
>\catcode`\@=\pgfcalendaratcode
> 
>\endinput
> 
> Now, the reason that this is not working is that the new module installer for 
> tikz removes all the files from `tex/plain`. It appears that tikz is at fault 
> here. If the file `pgfcalendar.tex` is supposed to used by both plain and 
> context, then it should be in `tex/generic` directory rather than `tex/plain` 
> directory. 
> 
> However, moving the file to `tex/generic` will not fix the issue directly 
> loading the above `pgfcalendar.code.tex` in context is surely going to fail 
> because of the manual catcode changes that are being done by pgfcalendar. 
> 
> So, I propose that we add a file `m-tikz-pgfcalendar.tex` as a wrapper around 
> `pgfcalendar.code.tex` and in `m-tikz.mk(xl|iv)` add
> 
> 
>  \definefilesynonym [pgfcalendar]  [tikz-pgfcalendar]
> 
> 
> I am attaching `m-tikz-calendar` which causes the original example to compile 
> (provided one adds the definefilesynonym before calling 
> \usetikzlibrary[calendar]). Can you please test if other features of 
> pgfcalendar are working with this file.
> 

This is working, thanks ! I tested some features of the calendar, and 
everything seems in order. I will continue today to work on this (a course 
syllabus).

> Aditya

Thanks again, you are a life saver ! 
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
___

[NTG-context] Tikz calendar problem.

2023-09-04 Thread Fabrice L
Dear list,

I have a problem with tikzCalendar on a recent installation. This minimal 
example :

8< 

\usemodule[tikz]
\usetikzlibrary[calendar]
 
\starttext
This should works:
\blank
\tikz  \calendar[dates=2000-01-01 to 2000-01-31,week list];
\blank
but this does not !
\stoptext

8< 

should work, but does not. The problem seems to be here:

open source > level 2, order 61, name 'tikzlibrarycalendar.code.tex'
modules > 'pgfcalendar' is not found
close source> level 2, order 61, name ‘tikzlibrarycalendar.code.tex'

The file « tikzlibrarycalendar.code.tex » is read, but the file « pgfcalendar » 
seems missing. I have reinstall a new standalone version of ConTeXt, with all 
the modules (with the new script from ConTeXt Garden), but nothing works. 


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
___

[NTG-context] Re: context-on-web broken

2023-07-04 Thread Fabrice L
Dear Aditya,

> Le 26 juin 2023 à 13:53, Aditya Mahajan via ntg-context  
> a écrit :
> 
> On Mon, 26 Jun 2023, Miguel Diaz via ntg-context wrote:
> 
>> indeed it is a simple simulation of overleaf (for latex). 
> 
> FWIW, context works on overleaf as well!
> 
> Simply create a `latexmkrc` file with the following content:
> 
> ```
> $pdflatex="context --synctex=1 --result=output %S; cp output.log 
> /compile/output.log;cp output.pdf /compile/output.pdf";
> $recorder=0;
> $pdf_mode=1;
> ```

This is a very precious information, thanks a lot  ! Most often, I’m isolated 
working with ConTeXt, most collaborators using LaTeX. Of course, some have seen 
the amazing things we can do with ConTeXt, and are using it a bit, but 
installation remains a challenge for most of them. Being able to work and share 
an overleaf project is a way to work in a collaborative way in ConTeXt (and 
Metafun of course !).

> 
> Aditya

Tanks agin for the tip ! 
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 paralleled does not give a parallel path

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

parralel.pdf
Description: Adobe PDF document

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

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


Re: [NTG-context] Metafun : 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  / 
> http://www.ntg.nl/mailman/listinfo/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
>> 
>> % \enablemode[solution]
>> 
>> \startmode[solution] % If in solution mode, redefine 
>> \startsolution...\stopsolution
>> 
>>   \definenarrower
>> [mysolution]
>> [before=\blank,
>>  after=\blank]
>> 
>>   \tolerant\protected\def\startsolution[#1]%
>> {\startmysolution
>>  \it}
>> 
>>   \protected\def\stopsolution
>> {\stopmysolution}
>> 
>> \stopmode
>> 
>> \startnotmode[solution] % If in solution mode, redefine 
>> \startsolution...\stopsolution
>> 
>>   \tolerant\protected\def\startsolution[#1]%
>> {\doifelsenothing{#1}{\blank[2.5cm]}{\blank[#1]}
>>  \gobbleuntil\stopsolution}
>> 
>>   

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
___


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
___


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
___


[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] 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  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 

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
___


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
___


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

or
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] Filter module for R

2020-06-15 Thread Fabrice L
Dear Aditya,

> Le 15 juin 2020 à 01:45, Aditya Mahajan  a écrit :
> 
> This is an adapted version of the code that I use for my course where I use 
> the vim module to do the typesetting:
> 
> \usemodule[filter]
> \usemodule[vim]
> 
> \definecolor  [darkblue]   [r=0.1,  g=0.11, b=0.84]
> \definecolor  [darkgreen]  [g=0.7]
> \definecolor  [lightblue]   [h=87cefa]
> \definecolor  [lightgreen]  [g=0.95,b=0.8,r=0.8]
> 
> \defineframedtext
>  [leftbartext]
>  [
>width=local,
>frame=off,
>framecolor=darkblue,
>leftframe=on,
>rulethickness=1ex,
>offset=0.25ex,
>loffset=3ex,
>background=color,
>backgroundcolor=lightblue,
>  ]
> 
> \definevimtyping
>  [RCODE]
>  [
>syntax=r,
>directory=output,
>strip=yes,
>escape=yes,
>before={\blank[quarterline]\startleftbartext},
>after={\stopleftbartext},
>  ]
> 
> \define[1]\ShowOutput
>{\typeRCODEfile{\externalfilterinputfile}
> \startleftbartext[framecolor=darkgreen, backgroundcolor=lightgreen]
>   \setupalign[flushleft, verytolerant]
>   % range={1,-1} not currently supported
>   % See below for details
>   \typefile[range={1,-1}]{#1}
> \stopleftbartext}
> 
> 
> \defineexternalfilter
>  [R]
>  [ filtercommand={R CMD BATCH -q --no-timing --save --restore
> \externalfilterinputfile\space \externalfilteroutputfile},
> output=\externalfilterbasefile.out,
> directory=output,
> readcommand=\ShowOutput,
> read=no,
> cache=yes,
> purge=yes, % THE COMMA WAS MISSING
>   ]
> 
> \starttext
> 
> Some text...
> 
> \startR[read=yes]
>   pdf("RPlots/MyHistogram.pdf",5,5)
>   X <- rnorm(200,mean=10,sd=2)
>   hist(X, col =  "red3" ,  xlab="Score QI" , main="", ylab="fréquence")
> \stopR
> 
> \externalfigure[RPlots/MyHistogram.pdf][width=.5\textwidth]
> 
> \stoptext
> 
> 


Thanks so much for your answer. I had (of course) to install nvim in order the 
code to work, but this works ! Thanks also for your additional work regarding 
the locale setting.. this is really deep magic for me. 

I think the facility to run R code directly from context can open ConTeXt to 
new users. The alliance between R and LaTeX is a winning combination to a lot 
of my colleagues. Do you think this would be appropriate to do a simple page on 
the wiki explaining how R code can be done in ConTeXt, with eventual 
formatting, with some simple examples, or this is too much noise ?

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] Filter module for R

2020-06-14 Thread Fabrice L
Hi,Following a question about the broken R module (R the statistical software), Aditya suggested me the filter module (thanks to him). I’m about to distribute a set of course notes to colleagues, and I need to deal with details now. I have one problem and two questions.1) the filter collect R code between \startR / \stopR and submit this code to R. As it can be seen in the following minimal example, when a label contains an accented character (« Fréquence » in my example), the pdf graphic does not contains the « é ». Strangely, the snippet of code (which is saved locally as « test2-temp-R-0.tmp » (for test2.tex)) when submitted with the same command as the filtercommand, works correctly; that means the same file works when submitted to R outside of ConTeXt. I have no idea how to solve this. 2) In a teaching context, we may want sometimes to show the code. The filter module actually permits to show the output of the code submitted to R (which can include or not the input commands); would it be possible to typeset the submitted code ?3) Finally, using "R CMD BATCH… » as the filtercommand add an extra line at the end of the output file which can be typeset to visualize results. Would it be possible by a magic trick to deleter the last line of the file ?Here is a minimal code:% —\usemodule[filter]\defineexternalfilter  [R]  [ filtercommand={R CMD BATCH -q --no-timing --save --restore \externalfilterinputfile\space \externalfilteroutputfile},     output=\externalfilterbasefile.out,     directory=output,     readcommand=\typefile,     read=no,     cache=yes,     purge=yes   ]\starttextSome text...\startR[read=yes]   pdf("RPlots/MyHistogram.pdf",5,5)   X <- rnorm(200,mean=10,sd=2)   hist(X, col =  "red3" ,  xlab="Score QI" , main="", ylab="fréquence")\stopR\externalfigure[MyHistogram.pdf][width=.5\textwidth] \stoptext% —Sorry for the three questions… and thanks for any help.Fabrice.

MyHistogram.pdf
Description: Adobe PDF document
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

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


Re: [NTG-context] start/stop executed conditionally on mode ?

2020-06-09 Thread Fabrice L


> Le 9 juin 2020 à 03:37, Hans Hagen  a écrit :
> 
> On 6/8/2020 9:53 PM, Fabrice L wrote:
>>> Le 7 juin 2020 à 23:19, Aditya Mahajan >> <mailto:adit...@umich.edu>> a écrit :
>>> 
>>> On Sun, 7 Jun 2020, Fabrice L wrote:
>>> 
>>>> Dear List,
>>>> 
>>>> I would like to insert a page using (ideally) start/stop instructions. The 
>>>> problem is that this page should be inserted only in a certain mode. 
>>>> Consulting the mailing list, I thought the following code was working, but 
>>>> it’s not ! The code is executed in the mode as expected, but the following 
>>>> instructions ("Some other text... » in the exemple) is not typeset.
>>>> 
>>>> Here is a minimal (not working!) example:
>>>> 
>>>> % 
>>>> \unexpanded\def\StartQuestionsList{
>>>> \startmode[ClassRoom]  \page[yes] Here are some questions: \blank
>>>> }
>>>> \unexpanded\def\StopQuestionsList{
>>>> \page[yes] \stopmode
>>>> }
>>>> \definestartstop[Questions][
>>>> before=\StartQuestionsList,
>>>> after=\StopQuestionsList
>>>> ]
>>>> 
>>>> 
>>>> \startQuestions
>>>> Question A….
>>>> Question B….
>>>> \stopQuestions
>>>> 
>>>> Some other text...
>>>> % 
> One of the oldest mechanism available ... blocks:
> 
> \enablemode[classroom] % comment this
> 
> \defineblock[Question]
> 
> \doifmode {classroom} {
>\keepblocks[Question]
> }
> 
> \starttext
> 
>Text A
> 
>\beginQuestion
>Question A….
>\endQuestion
> 
>Text B
> 
>\beginQuestion
>Question B….
>\endQuestion
> 
>\page
> 
>\doifnotmode {classroom} {
>\useblocks[Question]
>}
> 
> \stoptext

You are right of course... In fact I already use blocks, for another purpose, 
but I did not think about this solution because I needed a lot of formatting 
(these blocks should occupy whole page, different background color…), but 
blocks can adapt to my current need (I have try this morning) using the 
\setupblock[][before=..,after=…] command. And there is a bonus; I can « collect 
» these blocks and put them all together at the end of my courses notes, this 
is perfect.


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

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


Re: [NTG-context] start/stop executed conditionally on mode ?

2020-06-08 Thread Fabrice L


> Le 7 juin 2020 à 23:19, Aditya Mahajan  a écrit :
> 
> On Sun, 7 Jun 2020, Fabrice L wrote:
> 
>> Dear List,
>> 
>> I would like to insert a page using (ideally) start/stop instructions. The 
>> problem is that this page should be inserted only in a certain mode. 
>> Consulting the mailing list, I thought the following code was working, but 
>> it’s not ! The code is executed in the mode as expected, but the following 
>> instructions ("Some other text... » in the exemple) is not typeset.
>> 
>> Here is a minimal (not working!) example:
>> 
>> % 
>> \unexpanded\def\StartQuestionsList{
>>  \startmode[ClassRoom]  \page[yes] Here are some questions: \blank
>> }
>> \unexpanded\def\StopQuestionsList{
>>  \page[yes] \stopmode
>> }
>> \definestartstop[Questions][
>>  before=\StartQuestionsList,
>>  after=\StopQuestionsList
>>  ]
>> 
>> 
>> \startQuestions
>>  Question A….
>>  Question B….
>> \stopQuestions
>> 
>> Some other text...
>> % 
>> 
>> 
>> So to be clear, I would like the result in the « ClassRoom » mode to be:
>> % 
>> Here are some questions:
>> 
>>  Question A….
>>  Question B….
>> 
>> Some other text...
>> % 
>> 
>> Otherwise to be:
>> % 
>> Some other text...
>> % 
> 
> If you only set `ClassRoom` mode at compile time (rather than setting and 
> unsetting it the middle of the document), then you can do:
> 
> \definebuffer[Questions]
> 
> \startmode[ClassRoom]
> \define\StopQuestionsList {...}
> 
> \definestartstop[Questions][...]
> \stopmode
> 

Thanks to Aditya, I have succeeded, but it was not trivial for me. So, in case 
somebody someday would need a detailed solution, here is a minimal example, and 
an explanation. 

A buffer « Questions » is defined. If in « ClassRoom » mode, a start/stop « 
Questions » is also defined. So when ConTeXt encounters the \startQuestions / 
\stopQuestions, if the « ClassRoom » mode is enabled, the buffer is processed 
(with some format if needed - framed here for the example), and if the mode « 
ClassRoom » is disabled, then nothing is process. You can add as many 
\startQuestions / \stopQuestions you wish. 


% --
\definebuffer[Questions]

\enablemode[ClassRoom] % Try "On / Off » to process "\startQuestions / 
\stopQuestions » or not.

\startmode[ClassRoom]
 
\definestartstop[Questions][before={\startframedtext\red},after={\stopframedtext\blue}]
\stopmode

\starttext

Before...

\startQuestions
The content of the buffer ! 
\stopQuestions

After...

\stoptext
% --

Thanks Aditya !
Fabrice.



> Aditya___
> 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] start/stop executed conditionally on mode ?

2020-06-08 Thread Fabrice L
Dear Aditya,

> Le 7 juin 2020 à 23:19, Aditya Mahajan  a écrit :
> 
> On Sun, 7 Jun 2020, Fabrice L wrote:
> 
>> Dear List,
>> 
>> I would like to insert a page using (ideally) start/stop instructions. The 
>> problem is that this page should be inserted only in a certain mode. 
>> Consulting the mailing list, I thought the following code was working, but 
>> it’s not ! The code is executed in the mode as expected, but the following 
>> instructions ("Some other text... » in the exemple) is not typeset.
>> 
>> Here is a minimal (not working!) example:
>> 
>> % 
>> \unexpanded\def\StartQuestionsList{
>>  \startmode[ClassRoom]  \page[yes] Here are some questions: \blank
>> }
>> \unexpanded\def\StopQuestionsList{
>>  \page[yes] \stopmode
>> }
>> \definestartstop[Questions][
>>  before=\StartQuestionsList,
>>  after=\StopQuestionsList
>>  ]
>> 
>> 
>> \startQuestions
>>  Question A….
>>  Question B….
>> \stopQuestions
>> 
>> Some other text...
>> % 
>> 
>> 
>> So to be clear, I would like the result in the « ClassRoom » mode to be:
>> % 
>> Here are some questions:
>> 
>>  Question A….
>>  Question B….
>> 
>> Some other text...
>> % 
>> 
>> Otherwise to be:
>> % 
>> Some other text...
>> % 
> 
> If you only set `ClassRoom` mode at compile time (rather than setting and 
> unsetting it the middle of the document), then you can do:
> 
> \definebuffer[Questions]
> 
> \startmode[ClassRoom]
> \define\StopQuestionsList {...}
> 
> \definestartstop[Questions][...]
> \stopmode
> 


Thanks for your answer, I will try that.
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] start/stop executed conditionally on mode ?

2020-06-07 Thread Fabrice L
Dear List,

I would like to insert a page using (ideally) start/stop instructions. The 
problem is that this page should be inserted only in a certain mode. Consulting 
the mailing list, I thought the following code was working, but it’s not ! The 
code is executed in the mode as expected, but the following instructions ("Some 
other text... » in the exemple) is not typeset. 

Here is a minimal (not working!) example: 

% 
\unexpanded\def\StartQuestionsList{ 
\startmode[ClassRoom]  \page[yes] Here are some questions: \blank 
}
\unexpanded\def\StopQuestionsList{ 
\page[yes] \stopmode
}
\definestartstop[Questions][
before=\StartQuestionsList,
after=\StopQuestionsList
]


\startQuestions
Question A….
Question B…. 
\stopQuestions

Some other text...
% 


So to be clear, I would like the result in the « ClassRoom » mode to be:
% 
Here are some questions: 

Question A….
Question B…. 

Some other text...
% 

Otherwise to be:
% 
Some other text...
% 

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] Metapost and TikZ color code equivalent

2020-02-14 Thread Fabrice L
Hi,

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

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

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

See metafun manual, section 1.13.

> Thank you.
> Fabrice

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

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

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


Re: [NTG-context] R module

2019-11-23 Thread Fabrice L
Dear Aditya.

> Le 22 nov. 2019 à 17:49, Aditya Mahajan  a écrit :
> 
>>  I’m teaching with R this term, and I tried (without success) the 
>> R-module (I think the path of R is not found). Having no time to test and 
>> find out the problem, I have tried with success knitr (with is Rmarkdown 
>> code converted to latex-beamer). But I’m missing Context… My understanding 
>> is that the R-module is working only with mk-ii. Is there people in this 
>> list using successfully the r-module with mk-iv ?
> 
> Have you tried the filter module:
> https://github.com/adityam/filter/blob/master/README.md
> 
> For setup with R, see:
> https://github.com/adityam/filter/wiki/R
> 
> Aditya

Thanks for your answer. I did not know about the filter module. I had a look; 
the module is  powerful… but complex to install. It is not clear for me: this 
module would permits to submit code to R, optionally shows this code in the 
conTeXt document, and includes the output of R ? So is it a modern replacement 
of the r-module ?

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] R module

2019-11-22 Thread Fabrice L
Dear list,

I’m teaching with R this term, and I tried (without success) the 
R-module (I think the path of R is not found). Having no time to test and find 
out the problem, I have tried with success knitr (with is Rmarkdown code 
converted to latex-beamer). But I’m missing Context… My understanding is that 
the R-module is working only with mk-ii. Is there people in this list using 
successfully the r-module with mk-iv ?

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] Arithmetic overflow on placing an external figure in MP

2019-09-07 Thread Fabrice L
Hi,

> Le 7 sept. 2019 à 16:47, Henning Hraban Ramm  a écrit :
> 
> Bear with me, I still got no experience in MetaPost…
> 
> I’m trying to place a pixel image on a MP page.
> 
> According to the MetaFun manual this should work:
> 
> \startMPpage
> draw externalfigure "mill.png" scaled 5cm shifted (-6cm,0) ;
> \stopMPpage
> 
> And it works with mill.png (copied into my test dir), but with none of my 
> other PNGs, I always get
> 
> ! Arithmetic overflow.
> <*> ...xternalfigure "dodo.png" scaled 5cm shifted
> (-6cm,0) ; ;
> Uh, oh. A little while ago one of the quantities that I was
> computing got too large, so I'm afraid your answers will be
> somewhat askew. You'll probably have to adopt different
> tactics next time. But I shall try to carry on anyway.
> 
> [1]
> 
> 1 \startMPpage
> 2 draw externalfigure "dodo.png" scaled 5cm shifted (-6cm,0) ;
> 3 >>  \stopMPpage
> 4
> 

I can reproduce your error with MKIV, but this world with lmtx; I think this is 
just too big for MKIV (I’m not sure why !).
Be aware of the difference between « scaled » and « sized ». You can try:

\starttext
\startMPpage
draw externalfigure "dodo.png" sized  5cm shifted (-6cm,0) ;
\stopMPpage
\stoptext

and try:

\starttext
\startMPpage
draw externalfigure "dodo.png" scaled 0.018cm shifted (0,0) ;
draw ((0,0) -- (5cm,0) -- (5cm,5cm) -- (0,5cm) -- cycle ) withcolor red ;
\stopMPpage
\stoptext

In the second case, your image fits (approximately) in a 5cm square. 
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] Syntax hightlighting

2019-08-28 Thread Fabrice L
Dear list,

I’m using colored verbatim code (for course notes). In the past, I modified 
verb-mp.mkii for the langage I need (SAS). This code works fine with MKII:

%——
\setupcolors[state=start]
\definetyping [MP] [option=MP]

\starttext
A example:
\startMP
draw (0,0) withpen pencircle 1in withcolor red ;
\stopMP
\stoptext
%——

I obtain a color syntax output (« draw » in red, « within » in green for 
example). This code does not work anymore in MKIV (every word is the same 
color, green). There should be a solution ?

Trying to find some help, in the maling list and the « verbatim_text » page on 
Context garden, I found some solutions, like pretty printing, which should work 
on MKIV, but "pret-mp.lua » is found nowhere (nor in the context source 
browser, nor in my recent distribution). 

I must admit I’m lost in all the solutions I found there and there (most of 
them never works out of the box on my installation). Can somebody refer me to a 
simple solution, which permit me to do colored verbatim code, such as I can 
modify a source to insert the keywords of the langage I use ?

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] Why is the list so quiet these days?

2019-07-02 Thread Fabrice L
Le 2 juillet 2019 à 14:39:47, Andres Conrado Montoya (
andresconr...@gmail.com) a écrit:

Yes! I always get an answer, and I'm very grateful for that, and all the
work you all do. This is a great mail list, and ConTeXt is an amazing tool
that I very much enjoy working with. Thank you all!

I second this thinking ! Thanks to all that make context so amazing !

Fabrice.



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

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


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


El mar., 2 jul. 2019 a las 13:19, Hans Hagen () escribió:

> On 7/2/2019 8:09 PM, Andres Conrado Montoya wrote:
> > Is there an event or something else? Or everybody is just busy?
>
> normally traffic is somewhat lower during the summer (holiday season)
>
> https://mailman.ntg.nl/pipermail/ntg-context/2019/date.html
>
> but i'm pretty sure that when you post a question that you get an answer
>
> 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] preparing math exams

2019-04-23 Thread Fabrice L
Hi,

Le 23 avril 2019 à 11:10:11, Gour (g...@atmarama.com) a écrit:

Hello,

For regular formulas involving e.g. rational numbers, I'm sure that
input language for math is quite sufficient, but wonder about drawing
part?


Metapost (Metafun) is your best friend here. You can insert directly in
context some MetaFun code, like this:

\starttext
Lorem Ipsum…

\startMPcode
draw ( (0,0) — (1,0) — (0,1)) with color red ;
\stopMPcode

\stoptext

Look at this entry in the wiki:
https://wiki.contextgarden.net/MetaPost_in_ConTeXt

Also, you will find a link to the meta fun manual in this page, this a good
place to start !
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] getdocumentargument in Metafun

2019-02-22 Thread Fabrice L
Le 22 février 2019 à 11:08:51, Aditya Mahajan (adit...@umich.edu) a écrit:

Untested. Add quotes around FileName:

> string FileName ;
> FileName := "\getdocumentargument{File}" ;


And not tested successfully !

Thanks a lot Aditya !

Fabrice.



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

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

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


[NTG-context] getdocumentargument in Metafun

2019-02-22 Thread Fabrice L
Dear list,

I wish to do several zoom from a picture made in MetaFun, from a pdf file
which name is given on the commande line, like:

context zoom.tex —File=EntryFile —Page=9 —result=OutFile.pdf

Minimal example:

\starttext
  \startMPpage
numeric ThePage ;
string FileName ;
FileName := \getdocumentargument{File} ;
ThePage := \getdocumentargument{Page} ;
draw textext("\externalfigure["  & FileName &"][page="  & ThePage &"]")
xysized (48in,48in) ;
  \stopMPpage
\stoptext

I can get in the MPpage the page number in entry (9 in my example), but not
the file name.
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] About the macro path intersectionpoint path with Metapost

2019-02-04 Thread Fabrice L
Hi,

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

Happy drawing !
F.

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

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


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

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

\starttext
\startMPcode
  path p, q, r, b ;
  p:= fullcircle scaled 6cm ;
  q:= fullcircle scaled 4cm shifted (2.5cm,2cm) ;
  r:= fullcircle scaled 4cm shifted (-2.5cm,2cm);
  b:= fullcircle scaled 2cm shifted (0,-3cm);
  pair A, B ;
  A:= p intersectionpoint r ;
  B:= p intersectionpoint r ;
  path u ;
  u:= A--B--cycle ;
  draw p ;
  draw q ;
  draw r ;
  draw b ;
  draw u numberstriped (.25,15,5) withcolor magenta ;
\stopMPcode
\stoptext
___
If your question is of interest to others as well, please add an entry to
the Wiki!

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

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


Re: [NTG-context] Variable instance identifiers exhausted

2018-09-21 Thread Fabrice L
Le 19 septembre 2018 à 15:47:07, Fabrice L (fabrice.al...@gmail.com) a
écrit:




Le 19 septembre 2018 à 15:28:54, Alan Braslau (braslau.l...@comcast.net
(mailto:braslau.l...@comcast.net)) a écrit:

> On Tue, 18 Sep 2018 19:21:31 -0700
> Fabrice L wrote:
>
> > The problem is that the process take hours of compilations, and
> > tests are not easy to do. Anyway, I will enrich my « minimal » code to
my
> > « full » code in order to find the difference… and the problem. I will
> > update the thread as soon as can.
>
> My over 700k object graphics example, processed several times
(repeatedly, over several pages with modifications) took less than one
minute to process. In fact, each graphic took almost as long to render from
the pdf as it did for metapost/lua to process.
>
> Alan

I do not know what your example is (but I’m curious: can I see this
somewhere ?).

In my case, the long time needed is to check if a new object does not
intersect with any other object: so when I try to find the maximum size of
the 1000th object at a given position, I have to check with the 999 others…
I do this with « intersectiontimes ». And so on for the 10001th… I have a
course try to find solutions to gain time, like using the coordinate of a
new object: when the coordinate of a new object is chosen, I do not need to
check potential intersections with objects far away… but surprisingly (to
me) this take more time than to blindly check with every object.

This is an algorithmic problem more than a ConTeXt/Metapost one… but I you
have suggestions, I’m sure I can learn !

Below is minimal code. (Just to be clear, this code work, even for 20K
objects.)
Thanks.

\starttext
  \startMPpage
  path Obj[] , ObjTemp ;
  pair ObjPos , Inter ;
  numeric NObj ;
  % Change herte "NObj" to a big numer (says 20K)
  NObj := 100;
  numeric Danger, MaxSize ;

  % Draw an initial object of random shape and random size ;
  Obj[1]:= fullsquare randomized .001in
  scaled (uniformdeviate(.5)*1in)
  shifted (uniformdeviate(5)*1in,uniformdeviate(5)*1in) ;
  Obj[1] := curved ( Obj[1] );
  fill Obj[1] withcolor cyan randomized (.2,1.5);
  draw Obj[1] withcolor black randomized (.2,1.5);

  for i=2 upto NObj :
  Danger := 0;
% Choose a position for the object :
  ObjPos := (uniformdeviate(5)*1in,uniformdeviate(5)*1in) ;
  % Choose a form :
  Obj[i] := fullsquare randomized .01in ;
  Obj[i] := curved ( Obj[i] );
  % Choose a scale so the object does not interact with any other object:
for j=1 upto 50:
   MaxSize := (j*.01in) ;
ObjTemp := Obj[i] scaled MaxSize shifted ObjPos ;
   %draw ObjTemp withcolor magenta ;
   % Check if this temporary object intersect with any other object :
   for k=1 upto (i-1):
string trace ;
 Inter := Obj[k] intersectiontimes ObjTemp ;
 if (xpart Inter) <> -1 : Danger := 1; fi ;
 if Danger=1: MaxSize := ((j-1)*.01in) ; fi;
 exitif Danger = 1;
   endfor;
   exitif Danger = 1;
  endfor ;
  Obj[i] := Obj[i] scaled MaxSize shifted ObjPos ;

  fill Obj[i] withcolor cyan randomized (.2,1.5);
  draw Obj[i] withcolor black randomized (.2,1.5);
  endfor;
  \stopMPpage
\stoptext



So after some hours of computation, this code above breaks for me if the
number of objects,  NObj in my code, is too large. Of course, perhaps an
error occurs at some point and is not caused directly by the number of
objects, because according to what has been said in this thread this should
not be is not a problem. I put below the log. If somebody has a hint in
which direction I should look… thanks !

Fabrice.

mtx-context | run 1: luatex
--fmt="/Users/fabricel/context/tex/texmf-cache/luatex-cache/context/5fe67e0bfe781ce0dde776fb1556f32e/formats/luatex/cont-en"
--jobname="0030-0018-minimal2"
--lua="/Users/fabricel/context/tex/texmf-cache/luatex-cache/context/5fe67e0bfe781ce0dde776fb1556f32e/formats/luatex/cont-en.lui"
--no-parse-first-line --c:currentrun=1
--c:fulljobname="./0030-0018-minimal2.tex"
--c:input="./0030-0018-minimal2.tex" --c:kindofrun=1 --c:maxnofruns=1
--c:runs="1" "cont-yes.mkiv"

This is LuaTeX, Version 1.08.0 (TeX Live 2018)
 system commands enabled.
open source > level 1, order 1, name
'/Users/fabricel/context/tex/texmf-context/tex/context/base/mkiv/cont-yes.mkiv'
system  >
system  > ConTeXt  ver: 2018.05.17 18:32 MKIV beta  fmt: 2018.5.18
 int: english/english
system  >
system  > 'cont-new.mkiv' loaded
open source > level 2, order 2, name
'/Users/fabricel/context/tex/texmf-context/tex/context/base/mkiv/cont-new.mkiv'
system  > beware: some patches loaded from cont-new.mkiv
close source> level 2, order 2, name
'/Users/fabricel/context/tex/texmf-context/tex/context/base/mkiv/cont-new.mkiv'
system  > files > jobname '0030-0018-minimal2', input
'./0030-0018-

Re: [NTG-context] Variable instance identifiers exhausted

2018-09-18 Thread Fabrice L
Le 18 septembre 2018 à 03:11:40, Taco Hoekwater (t...@elvenkind.com) a
écrit:

> On 17 Sep 2018, at 21:17, Fabrice L  wrote:
>
> Dear List,
>
> I’m running into a problem in Metapost (using Context of course!)
> creating (I think) too many objects; I got this error message:
>
> variable instance identifiers exhausted

The max value for that is 2^31, or about 2 billion (and some change).
Are you sure you do not have an eternal loop in your source?

The number of objects I have is clearly less than 2^31, so my problem is
elsewhere then.

I do not think this a loop problem, because the same code runs ok for 15
000 objects, but give an error for 18 000 objects. I’m working to build a
minimal example.

Thanks a lot for the help ! Much appreciated.

Fabrice.



Best wishes,
Taco





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

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

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

Re: [NTG-context] Variable instance identifiers exhausted

2018-09-18 Thread Fabrice L
Le 18 septembre 2018 à 01:15:36, luigi scarso (luigi.sca...@gmail.com) a
écrit:



On Mon, Sep 17, 2018 at 9:18 PM Fabrice L  wrote:

> Dear List,
>
> I’m running into a problem in Metapost (using Context of course!)
> creating (I think) too many objects; I got this error message:
>
> variable instance identifiers exhausted
>
> I have tried without success to find information and a solution.
> Does somebody has a hint to solve this ?
>

Do you have  minimal example ?

I have worked on a minimal example today with no success ! What I mean is
that I have rebuilt the same algorithm from scratch in order to show
something minimal to the list, and I do not seem to encounter the problem
anymore ! The problem is that the process take hours of compilations, and
tests are not easy to do. Anyway, I will enrich my « minimal » code to my
« full » code in order to find the difference… and the problem. I will
update the thread as soon as can.

Thanks a lot for helping.

Fabrice.



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

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

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

[NTG-context] Variable instance identifiers exhausted

2018-09-17 Thread Fabrice L
Dear List,

I’m running into a problem in Metapost (using Context of course!)
creating (I think) too many objects; I got this error message:

variable instance identifiers exhausted

I have tried without success to find information and a solution.
Does somebody has a hint to solve this ?

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] roadmap

2018-05-16 Thread Fabrice L
Dear all,

> - Check what additional features users want (miss) and decide to what
extent and with what priority we will put effort in this.

As asked, I add a wish to the list...

One feature which I depend a lot on is to be able to do animations: I
actually use the Raw Steps module, by David Munger (dated from 2006), which
still worked, but in MKII only. This is essential for me for my teaching
and talks. During teaching, I have designed courses notes in ConText using
a lot modes of context: the notes are different for the teacher, are
available in two formats for the students (paper and for completion on
tablets), and there is a last version for use in the class by me. In class,
this is essential for me that the material is presented by steps, otherwise
students have a tendency to not listen, or to not try to solve a problem is
the solution is already on the screen. I can not use the animation
tools available in ConTexT using javascript, since I use to show notes in
class an iPad, and I use the stylus to fill blanks present in the notes
(which work great by the way !). The facility to use modes in the courses
notes like this have convinced several of my colleagues to use ConTeXt for
their teaching needs.

Following threads on this list on animations, my understanding is that Hans
is not a great supporter of the method of animations in the Raw Steps
module, for technical reasons.

I have switch to MKIV for others documents, but I'm still on MKII for this
reason for my courses notes, which are 90% one my needs in TeX.
Fabrice.

2018-05-14 11:17 GMT-04:00 Hans Hagen :

> Hi,
>
> The ConTeXt meeting is - as usual - the right place and moment to discuss
> the roadmap. We never had real binding roadmaps, more informal ones.
> Anyway, here are some thoughts on the two main components: MkIV and LuaTeX.
>
> ConTeXt MkIV:
>
> - Check if some mechanism can (by now) be simplified due to LuaTeX
> extension introduced the last few years that can be considered stable by
> now. This has a low impact as we already use Lua a lot.
>
> - Figure out what mechanism in ConTeXt are bottlenecks in performance if
> there are such bottlenecks at all. We need user input on this.
>
> - Get rid of inconsistencies in the user interface e.g. by introducing new
> commands with settings.
>
> - Check what additional features users want (miss) and decide to what
> extent and with what priority we will put effort in this. We've reached a
> point where interference prevents more complex extensions.
>
> - Try to improve tricky mechanisms, like columns and tables. Improvements
> are of course always on the agenda.
>
> - We can add more trickery for fonts and scripts. There are some pending
> extensions.
>
> - Maybe we should provide a few more general styles.
>
> - Are there reasonable challenges left.
>
> LuaTeX 1.09:
>
> - This version is pretty close to what is the final version (seen from the
> functional point of view). We're still debating where to move after this.
> LuaTeX 2.0? A stripped down (lean and mean) version specific for ConTeXt?
> Keep in mind that we cannot fundamentally change something, even if we want
> to, because other macro packages use it and don't expect it to change much.
>
> - There will probably be some more options in controlling math (given
> issues with fonts). We have to accept that not everything has a generic
> programmable solution (which is why we have Lua on board).
>
> - There might be a few more callbacks but probably nothing fundamental is
> planned.
>
> - We keep cleaning up the code base (less code is better, less
> dependencies too, some documentation is missing or not yet adapted to the
> new code). For instance the pdf inclusion code will soon be redone (and
> then tested in the ConTeXt distribution as usual).
>
> - When possible we will try to improve performance but there is not much
> to gain to be expected there.
>
> - We will also keep up with Lua (currently 5.3, some day 5.4). It is
> unclear to what extent LuaJit follows. When it stays behind we need to
> decide if support in ConTeXt will stay (to some extent we can have dual
> code paths as we have now).
>
> - We expect the ffi interface to external libraries to become more stable
> over time. ConTeXt will not introduce dependencies (what can be done in Lua
> will happen in Lua) but on the other hand we might put some libraries in
> the distribution e.g. for database support.
>
> - We might add some extensions to MetaPost in MPLib.
>
> In addition we could formulate ideas with respect to the distribution,
> garden, documentation and so on.
>
> You can react on this list but if you come to the meeting, you can
> participate in discussions.
>
> So far for now,
>
> Hans
>
> -
>   Hans Hagen | PRAGMA ADE
>   Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
>tel: 038 477 53 69 | www.pragma-ade.nl | 

Re: [NTG-context] Border matrix

2018-04-19 Thread Fabrice L
Wolfgang, thanks so much ! Everything is clear now, and works fine.

I will explore the mathalignment environment, which I’m not used to.
Fabrice.


Le 19 avril 2018 à 16:14:51, Wolfgang Schuster (schuster.wolfg...@gmail.com)
a écrit:

1. The bordermatrix code is part of the core and you can remove it from
cont-new.mkiv.

2. To use the \equalign command you have to enable the special meaning of &
in math mode with \setupmathematics[ampersand=normal].

3. User the new mathalignment environment as replacement for \equalign
which avoids special characters like &.

Wolfgang

Fabrice L <fabrice.al...@gmail.com>
19. April 2018 um 22:05
Dear list,

Some months ago, Hans wrote to this list (see below) a macro to do matrix
showing outside the brackets some informations (like we usually do for
Markov chains), but adapted some plain tex code, which worked in MKII). I
have used with success this code since then, but some weeks ago, the
behavior of Context had changed (probably something on my part; I have
updated the installation, but nothing changed).

The problem (I think) is linked to \unprotect \protect. When this code is
put before the \starttext to the the cont-new-mkiv, the border matrix
behave well, but a simple \eqalign like this:

\startformula
\eqalign{ & \lambda=5, \mu =5 \cr
   & \mu=8 \cr }
\stopformula

do not works is I replace «  \lambda » by « \lambda_2 » for example. I have
no idea what’s is going on. here is a minimal example where Hans’s code is
before the \starttext:

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

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

2018-04-19 Thread Fabrice L
Dear list,

Some months ago, Hans wrote to this list (see below) a macro to do matrix
showing outside the brackets some informations (like we usually do for
Markov chains), but adapted some plain tex code, which worked in MKII). I
have used with success this code since then, but some weeks ago, the
behavior of Context had changed (probably something on my part; I have
updated the installation, but nothing changed).

The problem (I think) is linked to \unprotect \protect. When this code is
put before the \starttext to the the cont-new-mkiv, the border matrix
behave well, but a simple \eqalign like this:

\startformula
\eqalign{ & \lambda=5, \mu =5 \cr
   & \mu=8 \cr }
\stopformula

do not works is I replace «  \lambda » by « \lambda_2 » for example. I have
no idea what’s is going on. here is a minimal example where Hans’s code is
before the \starttext:


% 
\unprotect

\def\math_border_NC_indeed
{\gdef\math_border_NC{\aligntab}}

\let\math_border_NC\math_border_NC_indeed

\def\math_border_NR
{\glet\math_border_NC\math_border_NC_indeed
\cr}

\unexpanded\def\math_border_matrix#1#2#3% adapted plain
{\begingroup
%
\pushmacro\cr
%
\setbox\scratchbox\hbox\bgroup
\mr B%
\egroup
\scratchdimenone\wd\scratchbox
%
\scratchdimentwo.2\bodyfontsize
%
\mathsurround\zeropoint
%
\def\NC{\math_border_NC}%
\def\NR{\math_border_NR}%
%
\setbox\scratchboxone\vbox\bgroup
\def\cr{%
\crcr
\noalign\bgroup
\kern\scratchdimentwo
\global\let\cr\endline
\egroup
}%
\ialign{%
\startimath\alignmark\alignmark\stopimath
\hfil
\kern\dimexpr\scratchdimentwo+\scratchdimenone\relax
\aligntab
\thinspace
\hfil
\startimath\alignmark\alignmark\stopimath
\hfil
\aligntab
\aligntab
\quad
\hfil
\startimath\alignmark\alignmark\stopimath
\hfil
\crcr
\omit
\strut
\hfil
\crcr
\noalign{\kern-\baselineskip}%
#3\crcr
\omit
\strut
\cr
}%
\egroup
\setbox\scratchboxtwo\vbox\bgroup
\unvcopy\scratchboxone
\global\setbox\globalscratchbox\lastbox
\egroup
\setbox\scratchboxtwo\hbox\bgroup
\unhbox\globalscratchbox
\unskip
\global\setbox\globalscratchbox\lastbox
\egroup
\setbox\scratchboxtwo\hbox\bgroup
\startimath
\kern\dimexpr\wd\globalscratchbox-\scratchdimenone\relax
\left#1\relax
\kern-\wd\globalscratchbox
\global\setbox\globalscratchbox\vbox\bgroup
\box\globalscratchbox
\kern\scratchdimentwo
\egroup
\vcenter\bgroup
\kern-\ht\globalscratchbox
\unvbox\scratchboxone
\kern-\baselineskip
\egroup
\thinspace
\right#2\relax
\stopimath
\egroup
\null
\thickspace
\vbox\bgroup
\kern\ht\globalscratchbox
\box\scratchboxtwo
\egroup
%
\popmacro\cr
%
\endgroup}

\unexpanded\def\bordermatrix {\math_border_matrix()}
\unexpanded\def\bbordermatrix{\math_border_matrix[]}

\unexpanded\def\startbordermatrix #1\stopbordermatrix
{\math_border_matrix(){#1}}
\unexpanded\def\startbbordermatrix#1\stopbbordermatrix{\math_border_matrix[]{#1}}

\let\stopbordermatrix \relax
\let\stopbbordermatrix\relax

% 
% Should there be a "\ptotect" ?
%\protect
% 

\starttext

A plain border matrix  :

\startformula
\bbordermatrix{
a & b & c & d \cr
e & f & G & h \cr
i & j & k & l \cr}
\stopformula

\startformula
\startbbordermatrix
\NC a \NC b \NC c \NC d \NR
\NC e \NC f \NC G \NC h \NR
\NC i \NC j \NC k \NC l \NR
\stopbbordermatrix
\stopformula

\startformula
\eqalign{
& \lambda=5, \mu =5 \cr
% 
% Does not work if the next line is uncommented
% & \lambda_1=5, \mu =4 \cr
% 
& \mu=8 \cr
}
\stopformula

\stoptext

% 

Thanks for any help. By the way. Is there with MKIV a more direct way to do
such matrix ?
Fabrice.


Le 28 août 2017 à 13:47:59, Hans Hagen (pra...@wxs.nl) a écrit:

Hi,

Put this in cont-new.mkiv (after \unprotect):

\def\math_border_NC_indeed
{\gdef\math_border_NC{\aligntab}}

\let\math_border_NC\math_border_NC_indeed

\def\math_border_NR
{\glet\math_border_NC\math_border_NC_indeed
\cr}

\unexpanded\def\math_border_matrix#1#2#3% adapted plain
{\begingroup
%
\pushmacro\cr
%
\setbox\scratchbox\hbox\bgroup
\mr B%
\egroup
\scratchdimenone\wd\scratchbox
%
\scratchdimentwo.2\bodyfontsize
%
\mathsurround\zeropoint
%
\def\NC{\math_border_NC}%
\def\NR{\math_border_NR}%
%
\setbox\scratchboxone\vbox\bgroup
\def\cr{%
\crcr
\noalign\bgroup
\kern\scratchdimentwo
\global\let\cr\endline
\egroup
}%
\ialign{%
\startimath\alignmark\alignmark\stopimath
\hfil
\kern\dimexpr\scratchdimentwo+\scratchdimenone\relax
\aligntab
\thinspace
\hfil
\startimath\alignmark\alignmark\stopimath
\hfil
\aligntab
\aligntab
\quad
\hfil
\startimath\alignmark\alignmark\stopimath
\hfil
\crcr
\omit
\strut
\hfil
\crcr
\noalign{\kern-\baselineskip}%
#3\crcr
\omit
\strut
\cr
}%
\egroup
\setbox\scratchboxtwo\vbox\bgroup
\unvcopy\scratchboxone
\global\setbox\globalscratchbox\lastbox
\egroup
\setbox\scratchboxtwo\hbox\bgroup
\unhbox\globalscratchbox
\unskip
\global\setbox\globalscratchbox\lastbox
\egroup
\setbox\scratchboxtwo\hbox\bgroup
\startimath
\kern\dimexpr\wd\globalscratchbox-\scratchdimenone\relax
\left#1\relax

Re: [NTG-context] Border matrix

2017-08-28 Thread Fabrice L
Thanks so much !
I’ll will add an entry to the wiki.
Fabrice.


Le 28 août 2017 à 13:29:55, Hans Hagen (pra...@wxs.nl) a écrit:

On 8/28/2017 6:33 PM, Fabrice L wrote:
> Hi,
>
> I’have a lot of courses notes in MKII. I’m trying to move to MKIV. I
> have a problem that I’m not able to resolve, to make a border matrix
> with brackets. In MKII, I was using a macro, found somewhere, which
> works great, but no longer works; here is the macro:
>
> % Border matrix: first line and column are label
> \catcode`\@=11\relax
> \newdimen\p@renwd
> \font\tenex=cmex10 \setbox0=\hbox{\tenex B} \p@renwd=\wd0
> \def\bbordermatrix#1{\begingroup \m@th
> \setbox\z@\vbox{\def\cr{\crcr\noalign{\kern2\p@\global\let\cr\endline}}%
> \ialign{$##$\hfil\kern2\p@\kern\p@renwd&\thinspace\hfil$##$\hfil
>   &&\quad\hfil$##$\hfil\crcr
>   \omit\strut\hfil\crcr\noalign{\kern-\baselineskip}%
>   #1\crcr\omit\strut\cr}}%
>   \setbox\tw@\vbox{\unvcopy\z@\global\setbox\@ne\lastbox}%
>   \setbox\tw@\hbox{\unhbox\@ne\unskip\global\setbox\@ne\lastbox}%
>   \setbox\tw@\hbox{$\kern\wd\@ne\kern-\p@renwd\left[\kern-\wd\@ne
> \global\setbox\@ne\vbox{\box\@ne\kern2\p@}%
> \vcenter{\kern-\ht\@ne\unvbox\z@\kern-\baselineskip}\,\right]$}%
>   \null\;\vbox{\kern\ht\@ne\box\tw@}\endgroup}
> \catcode`\@=12\relax

Such a plain macro needs to be made bodyfotn size aware and such.

> but MKIV gives me the error:
>
> \bbordermatrix #1->\begingroup \m@th
>
>  \setbox \z@ \vbox {\def \cr {\crcr
> \noa...
>
> l.26i & j & k & l \cr}
>
>
> 16   \null\;\vbox{\kern\ht\@ne\box\tw@}\endgroup}
>
> 17 \catcode`\@=12\relax
>
>
> I look for solutions on the list, but did not find anything.Here is a
> minimal example:
>
> \starttext
> A border matrix:
> \startformula
> \bbordermatrix{
>a & b & c & d \cr
>e & f & G & h \cr
>i & j & k & l \cr}
> \stopformula
> \stoptext
>
> As I have in my notes hundreds of such matrix, it is really difficult to
> change the input format.
>
> Do you know, or can you point me, to a solution ? I’m in a dead end..
> Thanks a lot.
I'll add this:

\unprotect

\unexpanded\def\math_border_matrix#1#2#3% adapted plain
{\begingroup
%
\pushmacro\cr
%
\setbox\scratchbox\hbox\bgroup
\mr B%
\egroup
\scratchdimenone\wd\scratchbox
%
\scratchdimentwo.2\bodyfontsize
%
\mathsurround\zeropoint
%
\setbox\scratchboxone\vbox\bgroup
\def\cr{%
\crcr
\noalign\bgroup
\kern\scratchdimentwo
\global\let\cr\endline
\egroup
}%
\ialign{%
\startimath\alignmark\alignmark\stopimath
\hfil
\kern\dimexpr\scratchdimentwo+\scratchdimenone\relax
\aligntab
\thinspace
\hfil
\startimath\alignmark\alignmark\stopimath
\hfil
\aligntab
\aligntab
\quad
\hfil
\startimath\alignmark\alignmark\stopimath
\hfil
\crcr
\omit
\strut
\hfil
\crcr
\noalign{\kern-\baselineskip}%
#3\crcr
\omit
\strut
\cr
}%
\egroup
\setbox\scratchboxtwo\vbox\bgroup
\unvcopy\scratchboxone
\global\setbox\globalscratchbox\lastbox
\egroup
\setbox\scratchboxtwo\hbox\bgroup
\unhbox\globalscratchbox
\unskip
\global\setbox\globalscratchbox\lastbox
\egroup
\setbox\scratchboxtwo\hbox\bgroup
\startimath
\kern\dimexpr\wd\globalscratchbox-\scratchdimenone\relax
\left#1\relax
\kern-\wd\globalscratchbox
\global\setbox\globalscratchbox\vbox\bgroup
\box\globalscratchbox
\kern\scratchdimentwo
\egroup
\vcenter\bgroup
\kern-\ht\globalscratchbox
\unvbox\scratchboxone
\kern-\baselineskip
\egroup
\thinspace
\right#2\relax
\stopimath
\egroup
\null
\thickspace
\vbox\bgroup
\kern\ht\globalscratchbox
\box\scratchboxtwo
\egroup
%
\popmacro\cr
%
\endgroup}

\unexpanded\def\bordermatrix {\math_border_matrix()}
\unexpanded\def\bbordermatrix{\math_border_matrix[]}

\protect

\starttext

A plain border matrix:

\startformula
\bordermatrix{
a & b & c & d \cr
e & f & G & h \cr
i & j & k & l \cr}
\stopformula

\startformula
\bbordermatrix{
a & b & c & d \cr
e & f & G & h \cr
i & j & k & l \cr}
\stopformula

\stoptext


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

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

[NTG-context] Border matrix

2017-08-28 Thread Fabrice L
Hi,

I’have a lot of courses notes in MKII. I’m trying to move to MKIV. I have a
problem that I’m not able to resolve, to make a border matrix with
brackets. In MKII, I was using a macro, found somewhere, which works great,
but no longer works; here is the macro:

% Border matrix: first line and column are label
\catcode`\@=11\relax
\newdimen\p@renwd
\font\tenex=cmex10 \setbox0=\hbox{\tenex B} \p@renwd=\wd0
\def\bbordermatrix#1{\begingroup \m@th
\setbox\z@\vbox{\def\cr{\crcr\noalign{\kern2\p@\global\let\cr\endline}}%
\ialign{$##$\hfil\kern2\p@\kern\p@renwd&\thinspace\hfil$##$\hfil
  &&\quad\hfil$##$\hfil\crcr
  \omit\strut\hfil\crcr\noalign{\kern-\baselineskip}%
  #1\crcr\omit\strut\cr}}%
  \setbox\tw@\vbox{\unvcopy\z@\global\setbox\@ne\lastbox}%
  \setbox\tw@\hbox{\unhbox\@ne\unskip\global\setbox\@ne\lastbox}%
  \setbox\tw@\hbox{$\kern\wd\@ne\kern-\p@renwd\left[\kern-\wd\@ne
\global\setbox\@ne\vbox{\box\@ne\kern2\p@}%
\vcenter{\kern-\ht\@ne\unvbox\z@\kern-\baselineskip}\,\right]$}%
  \null\;\vbox{\kern\ht\@ne\box\tw@}\endgroup}
\catcode`\@=12\relax

but MKIV gives me the error:

\bbordermatrix #1->\begingroup \m@th

 \setbox \z@ \vbox {\def \cr {\crcr
\noa...

l.26i & j & k & l \cr}




16   \null\;\vbox{\kern\ht\@ne\box\tw@}\endgroup}

17 \catcode`\@=12\relax

I look for solutions on the list, but did not find anything.Here is a
minimal example:

\starttext
A border matrix:
\startformula
\bbordermatrix{
   a & b & c & d \cr
   e & f & G & h \cr
   i & j & k & l \cr}
\stopformula
\stoptext

As I have in my notes hundreds of such matrix, it is really difficult to
change the input format.

Do you know, or can you point me, to a solution ? I’m in a dead end..
Thanks a lot.
F.
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

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

Re: [NTG-context] Steps in presentation

2015-01-02 Thread Fabrice L.

pol stra ryzz at hotmail.fr writes:

  Hello,I tried to use some steps in a presentation.  In the following
conversationhttp://www.mail-archive.com/ntg-context at
ntg.nl/msg53524.html, Wolfgang saysthat we can use the pre-60 module. 
So I tried this snippet:\usemodule[pre-
stepwise]\starttext\StartSteps\startitemize\item one \FlushStep\item two
\FlushStep\item three \FlushStep\stopitemize\StopSteps\stoptextBut it
does not compile:ConTeXt  ver: 2012.09.11 20:36 MKIV  fmt: 2012.9.12 
int: english/englishsystem   cont-new.mkiv
loaded(/opt/context-minimals/texmf-context/tex/context/base/cont-new.
mkivsystem   beware: some patches loaded from
cont-new.mkiv)fonts    latin modern fonts are not
preloadedlanguages    language en is
active(pre60.texresolvers    modules  loaded:
'pre-stepwise'(/opt/context-minimals/texmf-context/tex/context/base/s-
pre-60.mkivfonts    beware: no fonts are loaded yet, using 'lm
mono' in box(/opt/context-minimals/texmf-
context/tex/context/base/java-imp-stp.mkiv)interactions     javascripts
 loaded: library 'stp'metapost     loaded: library 'nav'
(/opt/context-minimals/texmf-
context/tex/context/base/meta-imp-nav.mkiv)){/opt/context-minimals/texmf
- fonts/fonts/map/pdftex/context/mkiv-base.map}fonts   
preloading latin modern fonts (second stage)fonts   
typescripts  unknown: library 'loc'{/opt/context-minimals/texmf-
fonts/fonts/map/dvips/lm/lm-math.map}{/opt/context-minimals/texmf-
fonts/fonts/map/dvips/lm/lm-rm.map}fonts    virtual math 
unable to resolve name mapsfromcharfonts    fallback modern rm
12pt is loaded!LuaTeX error: There should have been a lua node here,
not an object with type string! == Fatal error occurred, no output PDF
file produced!Is there something broken in recent release of conteXt? 
By the way It seemsthere is no Rawsteps module anymore but it still is
in the wiki. Is there issomething like a bugtracker for conteXt, in
order to signal when  a feature isnot working or outdated and signal
when it is back (or definitly depreciate)?(it would be a complementary
tool for the mailing list)   



I'm following on an old thread about the RawSteps Module, which is
broken in MKIV. Trying to move to MKIV, this is a no go for me since I
absolutely need this module for teaching. I've contacted David Munger,
the author of the module,  last September, which had been a real helper
in the past about this module, but he has presently no time to work on
this. If someone know how to fix the problem, I provide a short minimal
exemple:

%%% \enableregime[utf] 
\usemodule[rsteps]

\setupcolors[state=start] \setuppapersize[S4][S4]

\starttext

\StartSteps \startformula 
 \eqalign{ P[\text{atteindre l'état}\ j | \text{partant de } i] 
   = P\left[\bigcup_{n=0}^\infty (X_n=j)| X_0 = i\right]\cr
   \leq \sum_{n=0}^\infty P[X_n=j|X_0=i]\cr 
   =\sum_{n=0}^\infty P_{ij}^n =0 \cr } 
\stopformula \StopSteps

\StartSteps \startformula
\eqalign{
  \FromStep[1][reserve]{P[\text{atteindre l'état}\ j | \text{partant de } i]} 
  \FromStep[1][reserve]{= P\left[\bigcup_{n=0}^\infty (X_n=j)| X_0 = 
i\right]}\cr 
  \FromStep[2][reserve]{\leq \sum_{n=0}^\infty P[X_n=j|X_0=i]}\cr 
  \FromStep[3][reserve]{=\sum_{n=0}^\infty P_{ij}^n =0 }\cr } 
\stopformula
\StopSteps

\stoptext 
 


Also, here is the contextHarden link:
http://wiki.contextgarden.net/RawSteps

If somebody know another solution to show content by step in a page, I
would be happy to know about it. 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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___