Re: [NTG-context] $\sin \theta$ behave differently in metafun

2022-04-15 Thread śrīrāma via ntg-context
On 4/16/22 4:34 AM Jeong Dal via ntg-context wrote:
> I use $\sin \theta$ and $\cos \theta$ behave differently in text and in 
metafun.
> It works well sometime before but it doesn’t  in metafun now.
> What is wrong in my example?
> 
> Thank you for reading.
> Best regards,
> 
> Dalyoung
> 
> Here is a MWE.
> 
> \startbuffer[pointCircle]
> numeric u; u:=1cm;
> pair A,B,C;
> draw fullcircle scaled 4u;
> A := dir(25)*2u;
> label.top(textext("$P=(\cos\theta, \sin\theta)$"), A);
> B := dir(-25)*2u;
> label.bot(textext("$Q=(\cos(-\theta), \sin(-\theta))$"), B);
> C := (xpart A, 0); label.lrt(textext("$A$"), C);
> label(textext("$O$"), origin);
> \stopbuffer
> \starttext
> I'd like use $\sin$ and $\cos$ in the metafun. But it shows strange text 
instead
> of $\sin$ and $\cos$.
> 
> \processMPbuffer[pointCircle]
> 
> \stoptext

Hi Hans and Mikael (and others on the list),

I can confirm that even with the newest LMTX [2022.04.15 20:20] the above might 
actually be a bug. mfunctions inside MP strings are not properly rendred. A  
tiny MWE:

  \starttext
\startMPcode
draw textext("\m{\max_i x_i}");
\stopMPcode
  \stoptext

Could trace it down to '\math_function_handle_label' [math-ini] but not sure 
what MP is doing. Also looked into mp-mlib, mlib-pps but could not figure it 
out. I request you to kindly look into it.

Thanks,
  Sreeram


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

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


[NTG-context] $\sin \theta$ behave differently in metafun

2022-04-15 Thread Jeong Dal via ntg-context
Dear all,

I use $\sin \theta$ and $\cos \theta$ behave differently in text and in metafun.
It works well sometime before but it doesn’t  in metafun now.
What is wrong in my example?

Thank you for reading.
Best regards,

Dalyoung

Here is a MWE.

\startbuffer[pointCircle]
numeric u; u:=1cm;
pair A,B,C;
draw fullcircle scaled 4u;
A := dir(25)*2u; 
label.top(textext("$P=(\cos\theta, \sin\theta)$"), A);
B := dir(-25)*2u;
label.bot(textext("$Q=(\cos(-\theta), \sin(-\theta))$"), B);
C := (xpart A, 0); label.lrt(textext("$A$"), C);
label(textext("$O$"), origin);
\stopbuffer
\starttext
I'd like use $\sin$ and $\cos$ in the metafun. But it shows strange text 
instead of $\sin$ and $\cos$. 

\processMPbuffer[pointCircle]

\stoptext


> 2022. 4. 13. 오전 11:09, ntg-context-requ...@ntg.nl 작성:
> 
> Send ntg-context mailing list submissions to
>   ntg-context@ntg.nl
> 
> To subscribe or unsubscribe via the World Wide Web, visit
>   https://mailman.ntg.nl/mailman/listinfo/ntg-context
> or, via email, send a message with subject or body 'help' to
>   ntg-context-requ...@ntg.nl
> 
> You can reach the person managing the list at
>   ntg-context-ow...@ntg.nl
> 
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of ntg-context digest..."
> 
> 
> Today's Topics:
> 
>   1. Re: Setting up zint on a mac with macOS Montery Version
>  12.3.1 (Keith McKay)
>   2. Re: fatal error in LMTX (Bruce Horrocks)
>   3. Re: Setting up zint on a mac with macOS Montery Version
>  12.3.1 (Bruce Horrocks)
>   4. Re: Proper formatting of itemized bullets in ConTeXt (śrīrāma)
>   5. Re: Proper formatting of itemized bullets in ConTeXt (śrīrāma)
> 
> 
> --
> 
> Message: 1
> Date: Tue, 12 Apr 2022 21:04:50 +0100
> From: Keith McKay 
> To: Bruce Horrocks , mailing list for ConTeXt users
>   , monty.l...@gmail.com
> Subject: Re: [NTG-context] Setting up zint on a mac with macOS Montery
>   Version 12.3.1
> Message-ID: <475d96e6-0905-7d2d-a51d-84b06d340...@gmail.com>
> Content-Type: text/plain; charset="utf-8"; Format="flowed"
> 
> Hi All
> 
> I created the symbolic link as suggested by Bruce and Luis and still got the 
> error message
> 
> optional> unable to locate library 'libzint'
> 
> in my text editor. I use TeXworks. However, I thought I would try running 
> from the Terminal app and it worked. It found libzint and output the pdf with 
> both barcodes and the qrcode. I have no idea why it works in the Terminal and 
> not TexWorks, I'm guessing I have a path issue which I need to investigate.
> 
> Notes
> 1) My machine is a mac-mini-M1 with macos Monterey and I'm running the latest 
> ConTeXt version
> 2) Bruce noted that my Homebrew was installed in a non-standard location so I 
> checked on the Hombrew website and it is installed in opt/homebrew for Apple 
> Silicon i.e the M1 chip. Maybe Bruce's homebrew was installed on an earlier 
> version.
> 
> Thanks to Luis and Bruce for their suggestions.
> Best Wishes
> Keith McKay
> 
> On 10/04/2022 22:26, Bruce Horrocks wrote:
>> Hi Keith,
>> 
>>> On 10 Apr 2022, at 14:49, Keith McKay via ntg-context  
>>> wrote:
>>> 
>>> Hi All
>>> 
>>> I have been struggling today trying to setup and use the Barcode module 
>>> zint in ConTeXt and failed. I have followed the instructions on the wiki 
>>> (https://wiki.contextgarden.net/Barcodes  ) but with some changes as 
>>> follows. Which maybe why I failed.
>>> 
>>> 1) I downloaded Zint using Homebrew since I'm using macOS, and installed it 
>>> according to the instructions.
>>> 
>>> 
>>> 2) Since I'm using LMTX I looked for the file libzint.dylib and found it in 
>>> /opt/homebrew/Cellar/zint/2.10.0/lib . This is different from the path 
>>> given on the wiki. The directory contained three files, two of which were 
>>> aliases,  libzint.2.10.dylib and libzint.dylib, and an exe file 
>>> libzint.2.10.0.0.dylib
>> You have Hombrew installed in a non-standard location. Mine is in 
>> /usr/local/Cellar with the executables linked into /usr/local/bin.
>> 
>> But, assuming other Homebrew commands work when run from Terminal then you 
>> might still be okay.
>> 
>>> 3) I created the path $TEXROOT/tex/texmf-osx-64/bin/lib/luametatex/zint and 
>>> copied libzint.2.10.0.0.dylib into but replaced dylib with 'so' as 
>>> suggested on the wiki instructions. So I basically added  
>>> lib/luametatex/zint to texmf-osx-64/bin .
>> "Yes" to creating the path but "no" to copying. Create a symbolic link 
>> instead.
>> 
>> So, in Terminal:
>> 
>>   $ cd $TEXROOT/tex/texmf-osx-64/bin/lib/luametatex/zint
>> 
>>   # In my case I used the following:
>>   $ ln -s /usr/local/Cellar/zint/2.10.0/lib/libzint.dylib libzint.so
>> 
>>   # For you with Homebrew in a different location, try:
>>   $ ln -s /opt/homebrew/Cellar/zint/2.10.0/lib/libzint.dylib libzint.so
>> 
>> Then steps 4 and 5 as below. I ran the MWE below: the ISBN worked, the 

[NTG-context] placing (on) layers

2022-04-15 Thread Henning Hraban Ramm via ntg-context

Hi again,

I’m always struggling with putting stuff on layers, since these just 
never start where I’d expect them to, and the offsets changed a few 
times within the last years.


Please explain how I should define a layer that covers the whole page, 
since the following MWE is wrong (the layer always starts below the 
first line):



\useMPlibrary[dum]

\setuppapersize[A5][A4]
\setuplayout[
  marking=on,
  location=middle,
]
\definemeasure[Bleed][3mm]
\definemeasure[MaxHeight][{\dimexpr\paperheight + 2\measure{Bleed}\relax}]
\definemeasure[MaxWidth][{\dimexpr\paperwidth + 2\measure{Bleed}\relax}]

\definelayer[papier][
  preset=lefttop,
  %x=0mm,y=0mm,
  width=\paperwidth,
  height=\paperheight,
]
\setupbackgrounds[paper][background=cover,state=start]


\starttext
\showframe
TEST

\setlayerframed[papier][
  preset=lefttop,
  %x=-\measure{Bleed},
  %y=-\measure{Bleed},
  offset=overlay,
  %frame=off,
  width=\measure{MaxWidth},
  height=\measure{MaxHeight},
]{\externalfigure[dummy][
  width=\measure{MaxWidth},height=\measure{MaxHeight}
]}

\flushlayer[papier]

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

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


[NTG-context] cropoffset reduces paper size

2022-04-15 Thread Henning Hraban Ramm via ntg-context
Hi, at least in the current and previous LMTX beta, the paper size gets 
reduced if I use cropoffset as well as \setupinteractionscreen.

(It is known that the PDF box settings only work with the latter.)

In the MWE below, paper size gets reduced by cropoffset:


\setuppapersize[A4]

\setuplayout[
  cropoffset=10mm,
]

\setupinteractionscreen[
  width=max,height=max,
]

\starttext
\showframe

\samplefile{knuth}

\stoptext


If I set:

\setuppapersize[A4][A4,oversized]

\setuplayout[
  marking=on,
  location=middle,
  cropoffset=7.5mm,
]

Then the resulting paper size is A4, because the "oversized" factor is 
nulled by the crop offset.


While I can work around this "feature", the behaviour is different from 
earlier versions. Can’t check with MkIV, since that doesn’t work any 
more, as reported by Pablo et al.


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
___


[NTG-context] new upload

2022-04-15 Thread Hans Hagen via ntg-context

Hi,

I uploaded a new lmtx. Apart from a experimental intersection feature in 
the mp library (and metafun, more will be revealed when MS an I are okay 
with it) there is not that much news.


I decided to turn some test code into a mechanism which is illustrated 
below. Adaptive boxes are hboxes that act a bit like glue which means 
that when we hook in e.g. a graphic it can be made to adapt.


We can add some more methods if needed so maybe you see other usage. The 
interface is rather lightweight and the overhead is quite resonable.


Hans


===

\starttext

\startMPdefinitions
def TickTock =
interim linecap := squared;
save p ; path p ; p := fullsquare 
xysized(AdaptiveWidth,.9(AdaptiveHeight+AdaptiveDepth)) ;

fill p withcolor AdaptiveColor ;
draw bottomboundary (p enlarged (-AdaptiveThickness) )
withdashes (3*AdaptiveThickness)
withpen pencircle scaled AdaptiveThickness
withcolor white ;
enddef ;
\stopMPdefinitions

\startsetups adaptive:test
\setbox\usedadaptivebox\hbox to \usedadaptivewidth yoffset 
-.9\usedadaptivedepth \bgroup

\hss
\startMPcode
TickTock ;
\stopMPcode
\hss
   \egroup
\stopsetups

\definecolor[adaptive:tick][.25(blue,green)]
\definecolor[adaptive:tock][.75(blue,green)]

\defineadaptive
  [tick]
  [setups=adaptive:test,
   color=adaptive:tick,
   foregroundcolor=white,
   foregroundstyle=\infofont,
   strut=yes]

\defineadaptive
  [tock]
  [tick]
  [color=adaptive:tock]

% with postprocessing

\dorecurse{5}{
\dostepwiserecurse{1}{150}{1}{%
this~#1.##1 is~#1.##1 test~#1.##1
\ifodd##1\relax
\adaptivebox[tick]{\hss tick #1.##1\hss}
\else
\adaptivebox[tock]{\hss tock #1.##1\hss}
\fi
}
\blank
}

\page

% without postprocessing

\dorecurse{5}{
\dostepwiserecurse{1}{150}{1}{%
this~#1.##1 is~#1.##1 test~#1.##1
{\showboxes\adaptivebox[strut=yes,foregroundcolor=darkred]{\hss 
test #1.##1\hss}}

}
\blank
}

\page

% with images

% a weird one

\setupexternalfigures
  [location={default,global}]

\startsetups adaptive:test
\setbox\usedadaptivebox\hbox to \usedadaptivewidth yoffset 
-\usedadaptivedepth \bgroup

\externalfigure
  [cow.pdf]
  [width=\usedadaptivewidth,
   height=\dimexpr\usedadaptiveheight+\usedadaptivedepth\relax]%
   \egroup
\stopsetups

\dorecurse{5}{
\dostepwiserecurse{1}{150}{1}{%
this~#1.##1 is~#1.##1 test~#1.##1
{\adaptivebox[strut=yes,setups=adaptive:test]{}}
}
\blank
}

\stoptext

It actually uses an already present for a while low level engine feature 
that we introduced as part of the math processing update:


\dorecurse
  {1000}
  {test \uleaders\ruledhbox{\hss#1\hss}\hskip2em minus 1em\ }


Next on the todo is to move some experimental graphic trickery related 
to math (matrices) into the core but the interfacing needs some thought.


Hans

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

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


Re: [NTG-context] right item marks for associative questions?

2022-04-15 Thread śrīrāma via ntg-context
On 4/15/22 2:24 PM Damien Thiriet via ntg-context wrote:
> I read the cld manual and my guess is I should use function() 
> but looks like I lack some understanding of context proceeding.
> 
> 
> This is what I did so far
> [...]

In function 'ListeAleatoireGauche' calling startitemize as below should help:
  context.startitemize ({"8","packed","random"}, {align="righttoleft"})

Further, I think you might also need to put the entry into stream in a group:
  context.start() context.lefttoright(t[k]) context.stop()

  Sreeram


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

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


Re: [NTG-context] right item marks for associative questions?

2022-04-15 Thread Damien Thiriet via ntg-context
> You can use different alignment settings to move the bullet points to
> the right side of your lists.

Thank you Wolfgang, this is exactly what I need.
One more question: I am typesetting those questions in lua,
because lua vectors were more convenient for reading the whole 
but I am not sure how should I pass the righttoleft option.
I read the cld manual and my guess is I should use function() 
but looks like I lack some understanding of context proceeding.


This is what I did so far


\startluacode 
   userdata = userdata or {}
   function ListeAleatoireGauche(t)
  context.startitemize {"8","packed","random"}
 for k=1,#t do
context.startitem()
   context.lefttoright(t[k])
context.stopitem()
 end
  context.stopitemize()
   end
   function ListeAleatoireDroite(t)
  context.startitemize {"8","packed","random"}
 for k=1,#t do
context.startitem()
   context(t[k])
context.stopitem()
 end
  context.stopitemize()
   end

   function QCMAssociatif(t,u)
  context.startxtable {"frame=no","columndistance=3cm"}
 context.startxrow()
context.startxcell()
   ListeAleatoireGauche(t)
context.stopxcell()
context.startxcell()
   ListeAleatoireDroite(u)
context.stopxcell()
 context.stopxrow()
  context.stopxtable()
   end
\stopluacode
\starttext
\startluacode 
Author = {"Nietzsche","God"}
Quote = {"God is dead","Nietzsche is Dead"}
QCMAssociatif (Author,Quote)
\stoptext


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

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