Re: [NTG-context] simplifying repeated macro calls in metafun

2021-06-20 Thread Aditya Mahajan
On Mon, 21 Jun 2021, Jeong Dal wrote:

> 
> Hi,
> 
> I defined a macro definition in metafun, and draw figures using 
> \startbuffer[] … \stopbuffer and \processMPbuffer[].
> As you see in the attached code, the same macro definition is used repeatedly 
> by changing the numeric argument. 
> Is there a better way to simplify the code, for example, using \dorecurse and 
> recurselevel?

See attached. The main idea is to store the repetitive bits in 
\startuseMPgraphic{...} and then reuse them using \includeMPgraphic. 

Aditya

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

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/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] simplifying repeated macro calls in metafun

2021-06-20 Thread Jeong Dal

Hi,

I defined a macro definition in metafun, and draw figures using \startbuffer[] 
… \stopbuffer and \processMPbuffer[].
As you see in the attached code, the same macro definition is used repeatedly 
by changing the numeric argument. 
Is there a better way to simplify the code, for example, using \dorecurse and 
recurselevel?

Thank you for reading.

Best regards,

Dalyoung

\startbuffer[UDBasic]
  pair A,B,C,D;
  pair E, F, G, H;
  path p,q;
  numeric ang,maxNum;
  u:=1in;
  A=(.95*TextWidth,u); B=(0,u); C=(0,0); D=(.95*TextWidth,0);
  p := A--B--C--D;
  q := (TextWidth,1.5u)--(0,1.5u)--(0,-.5u)--(TextWidth,-.5u)--cycle;
  z0=(.1u,0);
  
   vardef nextPt (expr M,N) = 
   if ypart(N) = 0: 
   H := whatever[N, N + dir(.5*angle(M-N))*u] = whatever[A,B];
   else:
   H := whatever[N, N + dir(.5*angle(M-N))*u] = whatever[C,D];
   fi;
   H
   enddef;

   def grayUD(expr i) =
  draw G -- if ypart(B)=ypart(G): B -- C else: C -- B fi --z[i];
  filldraw z[i]+2*(G-z[i])*u -- z[i] -- z[i+1] -- z[i+1]+(G-z[i])*u -- 
cycle withcolor .75white; 
  draw G -- z[i+1] dashed evenly;
  draw z[0] for k=0 upto i: --z[k] endfor dashed evenly;
  clip currentpicture to q;
   enddef;

   def linesUD(expr i) =
  draw p;
  draw z0 for k=0 upto i+1: --z[k] endfor dashed evenly;
  setbounds currentpicture to boundingbox q;
   enddef;
\stopbuffer

\startbuffer[UDpts]
   ang := 40;
   z[1] = whatever[z[0], z[0]+dir(ang)*u] = whatever[A,B];
   G := whatever[z[0], z[0]+dir(2*ang)*u] = whatever[A,B];
   for k = 2 upto 20:
  z[k] = nextPt(z[k-2],z[k-1]);
  maxNum := k;
  exitif xpart(z[k]) > TextWidth;
   endfor;
\stopbuffer
\startbuffer[UD0]
   draw p;
   setbounds currentpicture to boundingbox q;
\stopbuffer
\startbuffer[UD1]
   grayUD(0);
\stopbuffer
\startbuffer[UD11]
   linesUD(0);
\stopbuffer
\startbuffer[UD2]
   G := z0;
   grayUD(1)
\stopbuffer
\startbuffer[UD21]
   linesUD(1);
\stopbuffer
\startbuffer[UD3]
   G := z1;
   grayUD(2);
\stopbuffer
\startbuffer[UD31]
   linesUD(2);
\stopbuffer
\startbuffer[UD4]
   G := z2;
   grayUD(3);
\stopbuffer
\startbuffer[UD41]
   linesUD(3);
\stopbuffer
\startbuffer[UD5]
   G := z3;
   grayUD(4);
\stopbuffer
\startbuffer[UD51]
   linesUD(4);
\stopbuffer
\startbuffer[UDFinal]
draw p;
draw z0--z1--z2--z3--z4--z5--z6--z7--z8 dashed evenly;
setbounds currentpicture to boundingbox q;
\stopbuffer
\starttext
\processMPbuffer[UDBasic,UDpts,UD0]
\processMPbuffer[UDBasic,UDpts,UD1]
\processMPbuffer[UDBasic,UDpts,UD11]
\processMPbuffer[UDBasic,UDpts,UD2]
\processMPbuffer[UDBasic,UDpts,UD21]
\processMPbuffer[UDBasic,UDpts,UD3]
\processMPbuffer[UDBasic,UDpts,UD31]
\processMPbuffer[UDBasic,UDpts,UD4]
\processMPbuffer[UDBasic,UDpts,UD41]
\processMPbuffer[UDBasic,UDpts,UD5]
\processMPbuffer[UDBasic,UDpts,UD51]
\processMPbuffer[UDBasic,UDpts,UDFinal]
\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] Font glyph replacement regression

2021-06-20 Thread Hans Hagen

On 6/20/2021 9:51 PM, Christoph Reller wrote:

Hi,

In my documents I use the MyriadPro font of Adobe. Until recently, some 
glyphs were automatically replaced (in a correct way) for this font. In 
ConTeXt LMTX version 2021.09.18, the replacement stopped working:


1. En dash and em dash: "--" and "---" are not by default replaced any 
more. Using the font feature "trep" brings back the replacement in this 
case. See https://www.mail-archive.com/ntg-context@ntg.nl/msg98162.html 



2. Apostrophe: "'" is not replaced by the proper apostrophe anymore. 
Unfortunately, I don't know any font feature to bring back this replacement.


Any hints for this issue? (I can provide the MyriadPro font for 
debugging purposes.)

an exmaple would help


-
  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] Font glyph replacement regression

2021-06-20 Thread Christoph Reller
Hi,

In my documents I use the MyriadPro font of Adobe. Until recently, some
glyphs were automatically replaced (in a correct way) for this font. In
ConTeXt LMTX version 2021.09.18, the replacement stopped working:

1. En dash and em dash: "--" and "---" are not by default replaced any
more. Using the font feature "trep" brings back the replacement in this
case. See https://www.mail-archive.com/ntg-context@ntg.nl/msg98162.html

2. Apostrophe: "'" is not replaced by the proper apostrophe anymore.
Unfortunately, I don't know any font feature to bring back this replacement.

Any hints for this issue? (I can provide the MyriadPro font for debugging
purposes.)

Cheers,

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

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/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] Natural tables framecolor=white regression

2021-06-20 Thread Christoph Reller
Hi,

Consider the following MWE:

\starttext
\setupTABLE[
  rulethickness=5pt,
  framecolor=white, %red,
  background=color,
  backgroundcolor=gray,
  frame=off]
\setupTABLE[1][2][foregroundcolor=white, topframe=on]
\setupTABLE[r][2][topframe=on]
\bTABLE[setups=table:color]
  \bTR \bTD One   \eTD \bTD A \eTD \eTR
  \bTR \bTD \rotate[rotation=90]{Two} \eTD \bTD B \eTD \eTR
\eTABLE
\stoptext

Attached is the result for ConTeXt LMTX version 2021.04.09 (and earlier)
and for version 2021.06.18. In the latter case, the white frame is missing
in the first column between row 1 and 2. Changing the frame color to red,
makes the frame appear.

Could this be a bug or am I doing something wrong?

Thank you for looking into this. Cheers,
Christoph
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/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] Functionnames disappearing (sometimes)

2021-06-20 Thread Otared Kavian
Hi Hans,

Many thanks !
Yes the new engine fixes the issues.

Best regards: Otared

> On 19 Jun 2021, at 23:27, Hans Hagen  wrote:
> 
> On 6/19/2021 10:01 PM, Otared Kavian wrote:
>> Hi,
>> I don’t know whether the issue reported by Mikael S. is related to the 
>> following: since last week (I guess) some math sympbols are not shown 
>> either, such as \bigcap and \bigcup, even using version 2021.06.18 23:37. An 
>> example is:
>> \starttext
>> $A \cup B = X \cap Y$
>> \startformula
>> A \bigcup B = X \bigcap Y
>> \stopformula
>> \stoptext
> it's a bug i introduced in the engine .. you can try a newer bin from:
> 
> https://dl.contextgarden.net/build/luametatex/
> 
> 
> -
>  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
___