Re: [NTG-context] atan2 function

2022-10-14 Thread Alan Braslau via ntg-context
On Fri, 14 Oct 2022 16:09:41 -0700
Thangalin  wrote:

> Would making the conditional part of the API be useful to others?

Of course, $\tan^{-1}(\pm 1)$ is undefined (mathematically).

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

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


Re: [NTG-context] atan2 function

2022-10-14 Thread Thangalin via ntg-context
That's certainly tighter, thank you, Alan.

Would making the conditional part of the API be useful to others?

Cheers!

On Fri, Oct 14, 2022 at 3:42 PM Alan Braslau  wrote:
>
> On Fri, 14 Oct 2022 11:59:49 -0700
> Thangalin  wrote:
>
> > I don't think an atantwo is needed. I *thought* I had read somewhere
> > that atan( y, x ) was equivalent to calling atan2 in Lua. Ensuring
> > there's no breakage when x == y would be nice, though. It was a little
> > surprising to see angle return degrees rather than radians, but it
> > does simplify my code:
> >
> >   dc := vbc - vac;
> >   dr := vbr - var;
> >   vi := 0;
> >
> >   if not( dc == dr ):
> > vi := round( angle( dc, dr ) / 60 );
> >   fi;
> >
> >   % Compute the direction towards the first segment (to vertex of
> > an edge). vangle := vi * 60 * pi / 180;
> >
> > Even simpler would be:
> >
> >   dc := vbc - vac;
> >   dr := vbr - var;
> >   vi := round( angle( dc, dr ) / 60 ); % returns 0 when dc == dr
> >
> >   % Compute the direction towards the first segment (to vertex of
> > an edge). vangle := vi * 60 * pi / 180;
> >
> > Or accepting a third argument as the return value in the special case:
> >
> >   vi := round( angle( dc, dr, 0 ) / 60 ); % returns 0 when dc ==
> > dr
> >
> > Cheers!
>
> vi := if (dc = dr) : 0 else : round (angle(dc,dr)/60) fi ;
>
> Alan
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

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


Re: [NTG-context] issues with current latest

2022-10-14 Thread Max Chernoff via ntg-context
On Fri, 2022-10-14 at 16:38 -0600, Alan Braslau wrote:
> On Fri, 14 Oct 2022 16:33:12 -0600
> Max Chernoff  wrote:
> 
> > Do you know how to rebuild the format? I've tried the following to no
> > avail:
> > 
> > --script mtx-context
> 
> I believe that you have to give the full script path here to mtxrun

Thanks! Running:

   luatex --luaonly "/opt/context/tex/texmf-linux-64/bin/mtxrun.lua" --script 
/opt/context/tex/texmf-context/scripts/context/lua/mtx-context.lua --luatex 
--make --redirected

has fixed the format issue. 

I now unfortunately have a new issue (probably for Hans or Mikael).
Running:

   context --luatex empty.tex
   
where "empty.tex" is:

   \starttext
   \null
   \stoptext

gives me this output:

   mtx-context | redirect luametatex -> luatex: luatex --luaonly 
"/opt/context/tex/texmf-linux-64/bin/mtxrun.lua" --script mtx-context --luatex 
empty.tex --redirected
   
   resolvers   | formats | executing runner 'run luatex format': 
/opt/context/tex/texmf-linux-64/bin/luatex --jobname="empty" 
--fmt=/home/max/luatex-cache/context/5fe67e0bfe781ce0dde776fb1556f32e/formats/luatex/cont-en.fmt
 
--lua=/home/max/luatex-cache/context/5fe67e0bfe781ce0dde776fb1556f32e/formats/luatex/cont-en.lui
 cont-yes.mkiv --c:currentrun=1 --c:engine="luatex" 
--c:fulljobname="./empty.tex" --c:input="./empty.tex" --c:kindofrun=1 
--c:luatex --c:maxnofruns=9 --c:redirected 
--c:texmfbinpath="/opt/context/tex/texmf-linux-64/bin"
   This is LuaTeX, Version 1.15.1 (TeX Live 2023/dev) 
system commands enabled.
   open source > level 1, order 1, name 
'/opt/context/tex/texmf-context/tex/context/base/mkiv/cont-yes.mkiv'
   job > passes > version mismatch: 1.33 <> 1.32
   system  > 
   system  > ConTeXt  ver: 2022.10.14 10:16 MKIV  fmt: 2022.10.14  int: 
english/english
   system  > 
   system  > 'cont-new.mkiv' loaded
   open source > level 2, order 2, name 
'/opt/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 
'/opt/context/tex/texmf-context/tex/context/base/mkiv/cont-new.mkiv'
   system  > files > jobname 'empty', input './empty', result 'empty'
   fonts   > latin modern fonts are not preloaded
   languages   > language 'en' is active
   open source > level 2, order 3, name 
'/home/max/Projects/lua-widow-control/nogit-testing/empty.tex'
   fonts   > preloading latin modern fonts (second stage)
   
   lua error   > lua error on line 1 in file 
/home/max/Projects/lua-widow-control/nogit-testing/empty.tex:
   
   ...tex/texmf-context/tex/context/fonts/mkiv/common-math.lfg:100: attempt to 
index a nil value (field 'subsets')
   stack traceback:
...tex/texmf-context/tex/context/fonts/mkiv/common-math.lfg:100: in 
field 'moveitalics'
.../context/tex/texmf-context/tex/context/fonts/mkiv/lm.lfg:103: in 
main chunk
[C]: in function 'dofile'
...ext/tex/texmf-context/tex/context/base/mkiv/good-ini.lua:78: in 
function <...ext/tex/texmf-context/tex/context/base/mkiv/good-ini.lua:68>
(...tail calls...)
   
   1 >>  \starttext
   2 \null
   3 \stoptext
   4 
   
   mtx-context | fatal error: return code: 256

The same file compiles just fine with LMTX.

Thanks,
-- Max
___
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] atan2 function

2022-10-14 Thread Alan Braslau via ntg-context
On Fri, 14 Oct 2022 11:59:49 -0700
Thangalin  wrote:

> I don't think an atantwo is needed. I *thought* I had read somewhere
> that atan( y, x ) was equivalent to calling atan2 in Lua. Ensuring
> there's no breakage when x == y would be nice, though. It was a little
> surprising to see angle return degrees rather than radians, but it
> does simplify my code:
> 
>   dc := vbc - vac;
>   dr := vbr - var;
>   vi := 0;
> 
>   if not( dc == dr ):
> vi := round( angle( dc, dr ) / 60 );
>   fi;
> 
>   % Compute the direction towards the first segment (to vertex of
> an edge). vangle := vi * 60 * pi / 180;
> 
> Even simpler would be:
> 
>   dc := vbc - vac;
>   dr := vbr - var;
>   vi := round( angle( dc, dr ) / 60 ); % returns 0 when dc == dr
> 
>   % Compute the direction towards the first segment (to vertex of
> an edge). vangle := vi * 60 * pi / 180;
> 
> Or accepting a third argument as the return value in the special case:
> 
>   vi := round( angle( dc, dr, 0 ) / 60 ); % returns 0 when dc ==
> dr
> 
> Cheers!

vi := if (dc = dr) : 0 else : round (angle(dc,dr)/60) fi ;

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

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


Re: [NTG-context] issues with current latest

2022-10-14 Thread Alan Braslau via ntg-context
On Fri, 14 Oct 2022 16:33:12 -0600
Max Chernoff  wrote:

> Do you know how to rebuild the format? I've tried the following to no
> avail:
> 
> --script mtx-context

I believe that you have to give the full script path here to mtxrun

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

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


Re: [NTG-context] issues with current latest

2022-10-14 Thread Max Chernoff via ntg-context
Hi Alan,

On Fri, 2022-10-14 at 16:20 -0600, Alan Braslau wrote:
> On Fri, 14 Oct 2022 15:38:52 -0600
> Max Chernoff via ntg-context  wrote:
> 
> 
>$ context --luatex test.tex
>mtx-context | redirect luametatex -> luatex: luatex --luaonly 
> "/opt/context/tex/texmf-linux-64/bin/mtxrun.lua" --script mtx-context 
> --luatex test.tex --redirected
>mtxrun  | unknown script 'mtx-context.lua' or
> 'mtx-mtx-context.lua'
> 
> This happens when the luatex cache is cleared and the context format is not 
> rebuilt properly.

Do you know how to rebuild the format? I've tried the following to no
avail:

   $ mtxrun --generate
   [snip]
   
   $ context --make
   [snip]
   
   $ context --luatex --make
   mtx-context | redirect luametatex -> luatex: luatex --luaonly 
"/opt/context/tex/texmf-linux-64/bin/mtxrun.lua" --script mtx-context --luatex 
--make --redirected
   mtxrun  | unknown script 'mtx-context.lua' or 'mtx-mtx-context.lua'
   
   $ TEXINPUTS="$(dirname $(mtxrun --findfile 'cont-en.mkiv' | head -1))" 
luatex -ini cont-en.mkiv
   warning: /opt/context/tex/texmf/web2c/texmf.cnf:49: (kpathsea) No cnf value 
on line: OSFONTDIR =.
   This is LuaTeX, Version 1.15.1 (TeX Live 2023/dev)  (INITEX)
system commands enabled.
   (/opt/context/tex/texmf-context/tex/context/base/mkiv/cont-en.mkiv
   (/opt/context/tex/texmf-context/tex/context/base/mkiv/context.mkiv
   (/opt/context/tex/texmf-context/tex/context/base/mkiv/syst-ini.mkiv)
   (/opt/context/tex/texmf-context/tex/context/base/mkiv/norm-ctx.mkiv)
   (/opt/context/tex/texmf-context/tex/context/base/mkiv/syst-pln.mkiv)
   (/opt/context/tex/texmf-context/tex/context/base/mkiv/syst-mes.mkiv)
   
(/opt/context/tex/texmf-context/tex/context/base/mkiv/luat-cod.mkiv[\directlua]
   :1: attempt to call a nil value (field 'registercode')
   stack traceback:
[\directlua]:1: in main chunk.
   \registerctxluafile ...ua.registercode("#1","#2")}
 
   l.73 \registerctxluafile{luat-cod}{}
 
   ? x
181 words of node memory still in use:
  1 dir, 22 glue_spec nodes
  avail lists: 2:3
   No pages of output.
   Transcript written on cont-en.log.

   $ fmtutil --all
   bash: fmtutil: command not found...
   
   $ context --make cont-en.mkiv
   [snip]
   
Not sure what else to try.

Thanks,
-- Max
___
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] issues with current latest

2022-10-14 Thread Alan Braslau via ntg-context
On Fri, 14 Oct 2022 15:38:52 -0600
Max Chernoff via ntg-context  wrote:


   $ context --luatex test.tex
   mtx-context | redirect luametatex -> luatex: luatex --luaonly 
"/opt/context/tex/texmf-linux-64/bin/mtxrun.lua" --script mtx-context --luatex 
test.tex --redirected
   mtxrun  | unknown script 'mtx-context.lua' or
'mtx-mtx-context.lua'

This happens when the luatex cache is cleared and the context format is not 
rebuilt properly.

Alan

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

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


Re: [NTG-context] (any) neovim users?

2022-10-14 Thread Alan Braslau via ntg-context
On Fri, 14 Oct 2022 18:59:24 - (UTC)
Nicola via ntg-context  wrote:

> Yours is a valid concern, but maintaining (Neo)Vim plugins is
> a community effort. I took over the development of the ConTeXt plugin
> because I wanted to improve the support for ConTeXt in Vim, and at the
> time the plugin had no active maintainer. In the same way, an
> unsatisfied user might take over the development of a ConTeXt plugin
> for NeoVim, or maybe even for both systems. Anyone can submit a
> patch, and I would welcome a co-maintainer, or even someone who would
> like to take over. I alone simply do not have enough capacity to wet
> my feet in two rivers.
> 
> Indeed, if you or someone reading this would like to steer the
> direction of future development of those plugins, let me know!

I thank you and any/everyone in the community who contributes in an
way, and of course my question was not meant as a critique of any tool
or package or plugin.


In fact, I do *not* use any plugin functionality such as async
typesetting. I do find syntax (color) highlighting helpful, sometimes
(when it works ;-) It generally presently has many problems.

Neovim integrates a lua parser. Unfortunately, I believe that it is
still lua 5.1. Nevertheless, it could possibly benefit from the
(maintained) lpeg Context syntax parser.

Getting an error message now with %@context is annoying. Hopefully,
somebody on this mailing list may know and care something about this.

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

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


Re: [NTG-context] (any) neovim users?

2022-10-14 Thread Alan Braslau via ntg-context
On Fri, 14 Oct 2022 18:59:24 - (UTC)
Nicola via ntg-context  wrote:

> > I wonder why a lua error is reported?  
> 
> Sorry, I should have said that I am only *assuming* that what I wrote
> may be the reason for the error. In fact, I have now tried to open
> a file starting with %, and I get no error. This with NeoVim
> v0.7.2.

The error has appeared with neovim v.0.8.0.

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

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


Re: [NTG-context] issues with current latest

2022-10-14 Thread Max Chernoff via ntg-context

Hi Pablo,

> I’m afraid that I cannot make latest from 2022.10.14 10:16 with LuaTeX.
> 
> I’m on Linux64.

I've got the same configuration and I'm getting the same results:

   $ context --luatex test.tex
   mtx-context | redirect luametatex -> luatex: luatex --luaonly 
"/opt/context/tex/texmf-linux-64/bin/mtxrun.lua" --script mtx-context --luatex 
test.tex --redirected
   mtxrun  | unknown script 'mtx-context.lua' or 'mtx-mtx-context.lua'
   
   $ luatex '\relax'
   warning: /opt/context/tex/texmf/web2c/texmf.cnf:49: (kpathsea) No cnf value 
on line: OSFONTDIR =.
   This is LuaTeX, Version 1.15.1 (TeX Live 2023/dev) 
system commands enabled.
   
   kpathsea: Running mktexfmt luatex.fmt
   mktexfmt: No such file or directory
   I can't find the format file `luatex.fmt'!
   
   $ luatex -ini '\end'
   warning: /opt/context/tex/texmf/web2c/texmf.cnf:49: (kpathsea) No cnf value 
on line: OSFONTDIR =.
   This is LuaTeX, Version 1.15.1 (TeX Live 2023/dev)  (INITEX)
system commands enabled.
   No pages of output.
   Transcript written on texput.log.
   
LuaMetaTeX works fine though.

Thanks,
-- Max
___
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] list not following "focus=standard"

2022-10-14 Thread Pablo Rodriguez via ntg-context
Hi Hans,

I have the following sample:

  \setupinteraction[state=start,
focus=standard]
  \starttext
  \completecontent
  \section{section}
  a\footnote{\contextversion}
  \stoptext

With version from 2022.09.11 20:44, the link from the TOC reads in the
PDF file:

  4 0 obj
  <<
  /D [ 1 0 R /Fit ]
  /S /GoTo
  >>
  endobj

Instead of being a named destination, such as in:

  5 0 obj
  <<
/D (#3)
/S /GoTo
  >>
  endobj

  11 0 obj
  <<
/D [ 1 0 R /XYZ 61.65861 129.0214 null ]
  >>
  endobj

  40 0 obj
  <<
/Limits [ (#3) (content) ]
/Names [ (#3) 11 0 R (*3) 10 0 R (content) 7 0 R ]
  >>
  endobj

This is the problem originally reported by Sylvain
(https://mailman.ntg.nl/pipermail/ntg-context/2022/106836.html).

I apologize, but I’m afraid I cannot provide a patch.

Could you take a look at it?

Many thanks for your help,

Pablo
___
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] issues with current latest

2022-10-14 Thread Pablo Rodriguez via ntg-context
On 10/14/22 16:34, Alain Delmotte via ntg-context wrote:
> Hi!

Hi Alain,

many thanks for your help.

> For me it works! And
>
> also for this!

I’m afraid that I cannot make latest from 2022.10.14 10:16 with LuaTeX.

I’m on Linux64. I hope I may make it work with Win64.

As for the issue with the links, I have already discovered what is wrong
with them (wrong object reference).

Many thanks for your help again,

Pablo

___
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] (any) neovim users?

2022-10-14 Thread Henning Hraban Ramm via ntg-context

Isn’t the tree-sitter parser enough for syntax highlighting in NeoVim?
https://wiki.contextgarden.net/pm39_tree_sitter_parser
https://github.com/pmazaitis/tree-sitter-context_en

(I don’t use either and can’t help further.)

Hraban


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

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


Re: [NTG-context] ToC filler dots not aligned

2022-10-14 Thread Pablo Rodriguez via ntg-context
On 10/14/22 17:29, Schister, Roman via ntg-context wrote:
> Hi,
>
> If I typeset a table of contents with the latest version of ConTeXt
> on my computer (2022.09.11 20:44 LMTX), the filler dots used in list
> alternative C aren’t aligned [...]
Hi Roman,

I compiled your code with version from 2022.09.11 20:44.

I attach an overlay of the results from both LuaMeTaTeX (in red) and
LuaTeX (in darkgreen).

It seems that MkIV is doing fine, but LMTX isn’t aligning the dots (for
some reason unknown to me).

Latest from 2022.10.14 10:16 gives exactly the same result for LMTX, and
MkIV doesn’t work for me.

Just in case it might help,

Pablo


a.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-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] atan2 function

2022-10-14 Thread Thangalin via ntg-context
I don't think an atantwo is needed. I *thought* I had read somewhere
that atan( y, x ) was equivalent to calling atan2 in Lua. Ensuring
there's no breakage when x == y would be nice, though. It was a little
surprising to see angle return degrees rather than radians, but it
does simplify my code:

  dc := vbc - vac;
  dr := vbr - var;
  vi := 0;

  if not( dc == dr ):
vi := round( angle( dc, dr ) / 60 );
  fi;

  % Compute the direction towards the first segment (to vertex of an edge).
  vangle := vi * 60 * pi / 180;

Even simpler would be:

  dc := vbc - vac;
  dr := vbr - var;
  vi := round( angle( dc, dr ) / 60 ); % returns 0 when dc == dr

  % Compute the direction towards the first segment (to vertex of an edge).
  vangle := vi * 60 * pi / 180;

Or accepting a third argument as the return value in the special case:

  vi := round( angle( dc, dr, 0 ) / 60 ); % returns 0 when dc == dr

Cheers!
___
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] (any) neovim users?

2022-10-14 Thread Nicola via ntg-context
On 2022-10-14, Alan Braslau via ntg-context  wrote:
> On Fri, 14 Oct 2022 16:48:42 - (UTC)
> Nicola via ntg-context  wrote:
>
>> On 2022-10-14, Alan Braslau via ntg-context 
>> wrote:
>> > A recent upgrade of the editor neovim leads to the following error
>> > when using % identification at the head of .tex source
>> > files.
>>
>> The ConTeXt plugin (as well as MetaPost and MetaFont ones) has
>> recently been rewritten in Vim 9 script (the new scripting language
>> embedded in Vim), which NeoVim does not support, afaik. See this
>> thread: https://github.com/vim/vim/issues/10968.
>>
>> One thing you can do is: grab the old runtime files and put them in
>> you own ~/.vim directory (following a similar layout). You may get
>> those from the `runtime` folder of the Vim project:
>> https://github.com/vim/vim, or from NeoVim repo. Just checkout
>> a revision with the old scripts (searching for "update runtime" in the
>> commit logs should help you filter the relevant commits).
>>
>> Nicola
>
> Thank you,
>
> I wonder why a lua error is reported?

Sorry, I should have said that I am only *assuming* that what I wrote
may be the reason for the error. In fact, I have now tried to open
a file starting with %, and I get no error. This with NeoVim
v0.7.2.

> I also worry that %@context support has now diverged (for whatever
> reason) and that Context highlighting is now limited to the one "vim"
> variant of the vi editor. Using old runtime files in one's personal
> .vim directory locks one into unmaintained (by the Context community)
> syntax. I wish that a better solution were available.

I am the current maintainer of the ConTeXt/MetaPost/METAFONT plugins.
I do not use NeoVim, and maintaining a plugin compatible with both
systems would be too much of a headache (I know because I have tried
with other plugins). I think that the ConTeXt plugin was not fully
functional in NeoVim even before switch to Vim 9 script (async
typesetting was based on Vim API and, last time I checked, NeoVim had an
incompatible API).

Switching to Vim 9 script has many advantages, as Bram has explained in
the thread I have linked to. So, I believe that it is only natural that
Vim's runtime will gradually move towards Vim 9 script.

Yours is a valid concern, but maintaining (Neo)Vim plugins is
a community effort. I took over the development of the ConTeXt plugin
because I wanted to improve the support for ConTeXt in Vim, and at the
time the plugin had no active maintainer. In the same way, an
unsatisfied user might take over the development of a ConTeXt plugin for
NeoVim, or maybe even for both systems. Anyone can submit a patch, and
I would welcome a co-maintainer, or even someone who would like to take
over. I alone simply do not have enough capacity to wet my feet in two
rivers.

Indeed, if you or someone reading this would like to steer the direction
of future development of those plugins, let me know!

Nicola

___
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] (any) neovim users?

2022-10-14 Thread Alan Braslau via ntg-context
On Fri, 14 Oct 2022 16:48:42 - (UTC)
Nicola via ntg-context  wrote:

> On 2022-10-14, Alan Braslau via ntg-context 
> wrote:
> > A recent upgrade of the editor neovim leads to the following error
> > when using % identification at the head of .tex source
> > files.  
> 
> The ConTeXt plugin (as well as MetaPost and MetaFont ones) has
> recently been rewritten in Vim 9 script (the new scripting language
> embedded in Vim), which NeoVim does not support, afaik. See this
> thread: https://github.com/vim/vim/issues/10968.
> 
> One thing you can do is: grab the old runtime files and put them in
> you own ~/.vim directory (following a similar layout). You may get
> those from the `runtime` folder of the Vim project:
> https://github.com/vim/vim, or from NeoVim repo. Just checkout
> a revision with the old scripts (searching for "update runtime" in the
> commit logs should help you filter the relevant commits).
> 
> Nicola

Thank you,

I wonder why a lua error is reported?

I also worry that %@context support has now diverged (for whatever reason) and 
that Context highlighting is now limited to the one "vim" variant of the vi 
editor. Using old runtime files in one's personal .vim directory locks one into 
unmaintained (by the Context community) syntax. I wish that a better solution 
were available.

Beyond this, I would think that neovim with lua scripting would be greatly 
preferable to vim9scripting. Indeed, while I do not know anything about the 
details, perhaps it could even use the same lpeg code as developed for the 
Scite editor.

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

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


Re: [NTG-context] (any) neovim users?

2022-10-14 Thread Nicola via ntg-context
On 2022-10-14, Alan Braslau via ntg-context  wrote:
> A recent upgrade of the editor neovim leads to the following error
> when using % identification at the head of .tex source files.

The ConTeXt plugin (as well as MetaPost and MetaFont ones) has recently
been rewritten in Vim 9 script (the new scripting language embedded in
Vim), which NeoVim does not support, afaik. See this thread:
https://github.com/vim/vim/issues/10968.

One thing you can do is: grab the old runtime files and put them in you
own ~/.vim directory (following a similar layout). You may get those
from the `runtime` folder of the Vim project:
https://github.com/vim/vim, or from NeoVim repo. Just checkout
a revision with the old scripts (searching for "update runtime" in the
commit logs should help you filter the relevant commits).

Nicola

___
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] ToC filler dots not aligned

2022-10-14 Thread Schister, Roman via ntg-context
Hi,

If I typeset a table of contents with the latest version of ConTeXt on my 
computer (2022.09.11 20:44 LMTX), the filler dots used in list alternative C 
aren’t aligned (i.e., they don’t end flush next to the page number). 
Typesetting the same file with the online version on ConTeXt Garden (2021.10.28 
10:19 LMTX) results in the filler dots being right-aligned with the page 
numbers (as they should).

I had a similar issue back in April 2021 which got resolved by an update. Since 
I haven’t updated in a while, I can’t say in which version the behaviour 
changed back, unfortunately.

Here’s a working example of my code:

\setupcombinedlist[content][alternative=c]
\starttext
\completecontent
\chapter[title={First chapter}]
\chapter[title={Second, longer chapter}]
\chapter[title={Third chapter}]
\stoptext

Any help is greatly appreciated.

Thanks and best wishes,
Roman
___
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] issues with current latest

2022-10-14 Thread Alain Delmotte via ntg-context

Hi!

Le 14/10/2022 à 16:24, Pablo Rodriguez via ntg-context a écrit :

Dear list,

I have the following sample:

   \setuppapersize[A7]
   \setupinteraction[state=start,
 color=darkred,
 contrastcolor=darkred,
 focus=standard]
   \starttext
   \completecontent
   \startsection[title={sec}, list=(before \&\ now), reference=a]
   \page
   \in[a] (after 2022.10.14 10:16)
   \stopsection
   \stoptext

For me it works! And

[...]
It is also caused by the minimal:

   \starttext
\null
   \stoptext


also for this!

Alain
___
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] (any) neovim users?

2022-10-14 Thread Alan Braslau via ntg-context
A recent upgrade of the editor neovim leads to the following error
when using % identification at the head of .tex source files. 


Error detected while processing BufReadPost Autocommands for "*":
Error executing lua callback: 
/usr/local/share/nvim/runtime/lua/vim/filetype/detect.lua:1248: attempt to 
index local 'format' (a number
 value)
stack traceback:
/usr/local/share/nvim/runtime/lua/vim/filetype/detect.lua:1248: in 
function 'ft'
vim/filetype.lua:2362: in function 'dispatch'
vim/filetype.lua:2522: in function 'match'
/usr/local/share/nvim/runtime/filetype.lua:12: in function


Has anyone encountered this? (perhaps it has been fixed upstream?)

Alan


-- 
Alan Braslau
816 West Mountain Avenue
Fort Collins, CO 80521 USA
mobile: (970) 237-0957

Conserve energy! ;-)
___
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] atan2 function

2022-10-14 Thread Alan Braslau via ntg-context
On Fri, 14 Oct 2022 10:07:19 +0200
Hans Hagen via ntg-context  wrote:

> So you suggest to add atantwo? As side note, you can redure your 
> definition to:
> 
>  vardef atantwo(expr dy, dx) =
>  if dx == 0 :
>  if dy < 0 : - fi pi / 2
>  else :
>  atan(dy/dx) if dx > 0 : if dy < 0 : - else : + fi pi fi
>  fi
>  enddef ;
> 
> going further makes us end up in an one-line obscurity

An absurdity, as further discussion on this thread has shown:
atan is derived from angle, which is essentially atan2.
There is no need to circle around.

As a side point, I now use MP doubleprecision mode by default, although
I do believe that it is still preferable to use classic scaled integer
mode (and minifun) for text graphical embellishments. The only
practical point to consider when using doubleprecision mode for me is
the need to explicitly use format with "decimal i" to round the text
rendering of numbers.

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

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


Re: [NTG-context] new upload

2022-10-14 Thread Alan Braslau via ntg-context
On Fri, 14 Oct 2022 16:14:01 +0200
Pablo Rodriguez via ntg-context  wrote:

> I have discovered that it includes in
> tex/texmf-context/source/luametatex what should be the LMTX source
> (about 11MB).
> 
> I wonder whether this could be made optional. Internet speed is not
> constant where I live and it was impossible for me to update at work
> (after many attempts to download the newer version).

Subsequent installs should only download source files that have been
changed, so the download should be faster (also for the font files :-)

I applaud the inclusion, by default, of the luametatex source files.

Thank you everyone who has contributed to this.

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

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


[NTG-context] issues with current latest

2022-10-14 Thread Pablo Rodriguez via ntg-context
Dear list,

I have the following sample:

  \setuppapersize[A7]
  \setupinteraction[state=start,
color=darkred,
contrastcolor=darkred,
focus=standard]
  \starttext
  \completecontent
  \startsection[title={sec}, list=(before \&\ now), reference=a]
  \page
  \in[a] (after 2022.10.14 10:16)
  \stopsection
  \stoptext

If I try to compile with LuaTeX (after deleting the cache), I get the
following error:

lua error   > lua error on line 1 in file a.tex:

...tex/texmf-context/tex/context/fonts/mkiv/common-math.lfg:100: attempt
to index a nil value (field 'subsets')
stack traceback:
...tex/texmf-context/tex/context/fonts/mkiv/common-math.lfg:100: in
field 'moveitalics'
.../context/tex/texmf-context/tex/context/fonts/mkiv/lm.lfg:103: in
main chunk
[C]: in function 'dofile'
...ext/tex/texmf-context/tex/context/base/mkiv/good-ini.lua:78: in
function <...ext/tex/texmf-context/tex/context/base/mkiv/good-ini.lua:68>
(...tail calls...)

It is also caused by the minimal:

  \starttext
   \null
  \stoptext

And with the first source, \in hyperlink doesn’t work at all.

Sylvain reported an issue with the \completecontent list (not honoring
"focus=standard"), but with current latest the \in hyperlink doesn’t
work at all.

Could anyone confirm the issues?

Many thanks for your help,

Pablo
___
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] new upload

2022-10-14 Thread Pablo Rodriguez via ntg-context
On 10/14/22 10:21, Hans Hagen via ntg-context wrote:
> Hi,
>
> I uploaded a new version. Apart from a few fixes / extensions already
> mentioned here (or known to those who wanted it) the main changes are in
> the math goodie files (work in progress, we will clean them up later) as
> part of improving the rendering of math.

Many thanks for the new version, Hans.

I have discovered that it includes in
tex/texmf-context/source/luametatex what should be the LMTX source
(about 11MB).

I wonder whether this could be made optional. Internet speed is not
constant where I live and it was impossible for me to update at work
(after many attempts to download the newer version).

Just in case it would be possible, modules (also as an option) would be
more useful for many of us.

Many thanks for your excellet work,

Pablo
___
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] atan2 function

2022-10-14 Thread luigi scarso via ntg-context
On Fri, 14 Oct 2022 at 14:58, Taco Hoekwater via ntg-context <
ntg-context@ntg.nl> wrote:

>
>
> > On 14 Oct 2022, at 14:26, Alan Braslau via ntg-context <
> ntg-context@ntg.nl> wrote:
> >
> > Are you using MP in scaled integer or in doubleprecision mode?
> >
> > I have not looked into the MP angle operator code, but my suspicion is
> that it is based on some super-clever John Hobby scheme optimized for
> scaled integer calculations.
>
> The scaled version of “angle” is a handwritten approximation in web, not
> using
> any math library. I really doubt that that code is faster than calling
> atan2()
> on a modern machine, but I’ve kept it in because using a lib might give
> slightly
> different results.
>

iirc, in metapost  the whole scaled number system has no dependency  from
any external math library
(I have not checked the lmtx source yet).
___
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] atan2 function

2022-10-14 Thread Taco Hoekwater via ntg-context


> On 14 Oct 2022, at 14:26, Alan Braslau via ntg-context  
> wrote:
> 
> Are you using MP in scaled integer or in doubleprecision mode?
> 
> I have not looked into the MP angle operator code, but my suspicion is that 
> it is based on some super-clever John Hobby scheme optimized for scaled 
> integer calculations.

The scaled version of “angle” is a handwritten approximation in web, not using
any math library. I really doubt that that code is faster than calling atan2()
on a modern machine, but I’ve kept it in because using a lib might give 
slightly 
different results.

The double version of “angle" uses atan2() internally already, so that the 
atantwo macro is just duplicating the internals for that case.

The decimal version of “angle’ uses a dedicated decNumberAtan2() library call.

> 
> Hans has integrated the entire math library (and more) into lmtx.
> 
> On 13/10/22 13/10/22, 13:51, Thangalin via ntg-context wrote:
>> Thank you, Max.
>> The angle function doesn't appear to provide the same calculation as
>> my atantwo in all cases.
>> https://pdfhost.io/v/Oqj7XmibJ_scaled
>> The shorter line segment should be directed towards the vertex closest
>> to the longer line segment. I tried using both:
>> theta := angle( dx, dy );
>> theta := angle( dy, dx );
>> Neither made a difference, in some cases the angle differs from what I'd 
>> expect.
>> My implementation is based on the first version given here:
>> https://en.wikipedia.org/wiki/Atan2#Definition_and_computation
>> I have something that works, so this is more of a curiosity as to
>> there being a difference between my implementation of atantwo and the
>> angle function.
>> Here's an example with many lines and the angle function:
>> https://pdfhost.io/v/1T4jgBnxh_scaled
>> On Wed, Oct 12, 2022 at 11:42 PM Max Chernoff  wrote:
>>> 
>>> Hi,
>>> 
 How is atan2 called? I rolled my own as follows:
>>> 
 Is atan with two parameters supposed to behave like atan2?
>>> 
>>> At mp-math.mpxl:167 there is:
>>> 
>>>vardef atan   primary x = angle(1,x)   enddef ;
>>> 
>>> The MetaPost manual says:
>>> 
>>>The angle operator takes a pair and computes the two-argument
>>>arctangent; i.e., angle is the inverse of the dir operator
>>> 
>>> So it looks like "angle" is the function that you want for "atan2".
>>> 
>>> Thanks,
>>> -- Max
>> ___
>> If your question is of interest to others as well, please add an entry to 
>> the Wiki!
>> maillist : ntg-context@ntg.nl / 
>> https://www.ntg.nl/mailman/listinfo/ntg-context
>> webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
>> archive  : https://bitbucket.org/phg/context-mirror/commits/
>> wiki : https://contextgarden.net
>> ___
> 
> \
> 
> ___
> If your question is of interest to others as well, please add an entry to the 
> Wiki!
> 
> maillist : ntg-context@ntg.nl / 
> https://www.ntg.nl/mailman/listinfo/ntg-context
> webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
> archive  : https://bitbucket.org/phg/context-mirror/commits/
> wiki : https://contextgarden.net
> ___

— 
Taco Hoekwater  E: t...@bittext.nl
genderfluid (all pronouns)



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

maillist : ntg-context@ntg.nl / 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] atan2 function

2022-10-14 Thread Alan Braslau via ntg-context

Are you using MP in scaled integer or in doubleprecision mode?

I have not looked into the MP angle operator code, but my suspicion is 
that it is based on some super-clever John Hobby scheme optimized for 
scaled integer calculations.


Hans has integrated the entire math library (and more) into lmtx.

On 13/10/22 13/10/22, 13:51, Thangalin via ntg-context wrote:

Thank you, Max.

The angle function doesn't appear to provide the same calculation as
my atantwo in all cases.

https://pdfhost.io/v/Oqj7XmibJ_scaled

The shorter line segment should be directed towards the vertex closest
to the longer line segment. I tried using both:

 theta := angle( dx, dy );
 theta := angle( dy, dx );

Neither made a difference, in some cases the angle differs from what I'd expect.

My implementation is based on the first version given here:

https://en.wikipedia.org/wiki/Atan2#Definition_and_computation

I have something that works, so this is more of a curiosity as to
there being a difference between my implementation of atantwo and the
angle function.

Here's an example with many lines and the angle function:
https://pdfhost.io/v/1T4jgBnxh_scaled

On Wed, Oct 12, 2022 at 11:42 PM Max Chernoff  wrote:


Hi,


How is atan2 called? I rolled my own as follows:



Is atan with two parameters supposed to behave like atan2?


At mp-math.mpxl:167 there is:

vardef atan   primary x = angle(1,x)   enddef ;

The MetaPost manual says:

The angle operator takes a pair and computes the two-argument
arctangent; i.e., angle is the inverse of the dir operator

So it looks like "angle" is the function that you want for "atan2".

Thanks,
-- Max

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

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


\

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

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


Re: [NTG-context] lmt_outline not rendering properly

2022-10-14 Thread Jacob Kauffmann via ntg-context
Hi,

I can confirm that the rendering is fixed in the newest upload 2022.10.14 10:16.

Cheers,
Jacob

> Am 23.09.2022 um 17:42 schrieb Mikael Sundqvist via ntg-context 
> :
> 
> On Thu, Sep 22, 2022 at 11:15 AM Jacob Kauffmann via ntg-context
>  wrote:
>> 
>> Dear list,
>> 
>> attached is an example taken from the luametafun manual.
>> The letter o looks odd. When I compile the manual the examples in section 4 
>> look also bad (different font; page 10 attached).
>> It seems like the paths miss one point.
>> 
>> This is with the latest version 2022.09.11 20:44.
>> 
>> Cheers,
>> Jacob
> 
> Hi,
> 
> I do not see this in the (just a bit) newer version I have locally, so
> I think it was fixed during the meeting last week. Hopefully it will
> work in the next upload. (Sometime next week)
> 
> /Mikael
> ___
> 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
> ___



signature.asc
Description: Message signed with OpenPGP
___
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] Cron /var/www/aanhet.net/context/bin/cron/context-mirror

2022-10-14 Thread Cron Daemon via ntg-context
receiving incremental file list
 ./
 ctan.lsr
 document-2.htm
 download-1.htm
 download-2.htm
 logo-ade.png
 logo-cts.png
 logo-pod.png
 rss.xml
 show-fil.pdf
 context/latest/
 context/latest/cont-mpd.zip
 context/latest/cont-ppc.zip
 context/latest/cont-sci.zip
 context/latest/cont-tmf.zip
 context/latest/cont-tst.7z
 context/latest/cont-tst.tar.xz
 context/latest/cont-tst.zip
 
 sent 101,397 bytes  received 21,826,732 bytes  3,373,558.31 bytes/sec
 total size is 448,893,257  speedup is 20.47


Running archiver:

New dir: /var/www/aanhet.net/context//htdocs/archives/context-2022-10-14.11
172023660   
/var/www/aanhet.net/context//htdocs/archives/context-2022-10-14.11/latest
126745317   
/var/www/aanhet.net/context//htdocs/archives/context-2022-10-14.11/current
18956262
/var/www/aanhet.net/context//htdocs/archives/context-2022-10-14.11/alpha
126707516   
/var/www/aanhet.net/context//htdocs/archives/context-2022-10-14.11/beta
36851   
/var/www/aanhet.net/context//htdocs/archives/context-2022-10-14.11
36851   total
___
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] new upload

2022-10-14 Thread Hans Hagen via ntg-context

Hi,

I uploaded a new version. Apart from a few fixes / extensions already 
mentioned here (or known to those who wanted it) the main changes are in 
the math goodie files (work in progress, we will clean them up later) as 
part of improving the rendering of math.


Hans


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

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


Re: [NTG-context] Spacing in \unit - SOLVED

2022-10-14 Thread Hans Hagen via ntg-context

On 10/13/2022 1:52 PM, Gavin via ntg-context wrote:

Hi Oli,


Thank four your effort. I found out, that the following definition of a new 
unit, i called it SI, results also in a correct spaceing in the math 
environment:

\defineunit[SI][alternative=text]

It seems, that the option alternative=text solves the problem with no spaces 
between value and unit in the math environment.


That is a terrific solution that doesn’t require any messing with 
phys-dim.mkxl. You do not need to define a new unit. I got your result using 
this line:

\setupunits[alternative=text]

This fixed the most significant problems with \unit in most situations. I’m 
still applying some of my solutions as well.
I'll look into it (with Mikael as some relates to math) once you're done 
playing and provide suggestions and tests.


Hans


-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
   tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-

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

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


Re: [NTG-context] atan2 function

2022-10-14 Thread Hans Hagen via ntg-context

On 10/14/2022 2:35 AM, Max Chernoff via ntg-context wrote:


Hi,


The angle function doesn't appear to provide the same calculation as
my atantwo in all cases.


They both give the same results, but "angle" gives a result in degrees
while "atantwo" gives a result in radians. This demo:

\startMPpage
vardef atantwo( expr dy, dx ) =
save theta;

numeric theta;

theta := 0;

if (dx > 0):

theta := atan( dy / dx );
elseif (dx < 0) and (dy >= 0):
theta := atan( dy / dx ) + pi;
elseif (dx < 0) and (dy < 0):
theta := atan( dy / dx ) - pi;
elseif (dx == 0) and (dy > 0):
theta := pi / 2;
elseif (dx == 0) and (dy < 0):
theta := -pi / 2;
fi;

theta

enddef;

def showangles(expr dx, dy) =

message "---"
message "atantwo " & decimal atantwo(dy, dx)
message "angle " & decimal (angle(dx, dy) * pi / 180)
message "angle " & decimal angle(dx, dy)
message "(" & decimal dx & ", " & decimal dy & ")"
enddef;

showangles(1, 0);

showangles(1, 1);
showangles(0, 1);
showangles(-1, 1);
showangles(-1, 0);
showangles(-1, -1);
showangles(0, -1);
showangles(1, -1);
\stopMPpage
So you suggest to add atantwo? As side note, you can redure your 
definition to:


 vardef atantwo( expr dy, dx ) =
 if (dx > 0):
 atan( dy / dx )
 elseif (dx < 0) and (dy >= 0):
 atan( dy / dx ) + pi
 elseif (dx < 0) and (dy < 0):
 atan( dy / dx ) - pi
 elseif (dx == 0) and (dy > 0):
 pi / 2
 elseif (dx == 0) and (dy < 0):
 -pi / 2
 else :
 0
 fi
 enddef ;

and then

vardef atantwo(expr dy, dx) =
if dx == 0 :
if dy < 0 : - fi pi / 2
else :
atan(dy/dx) if dx > 0 : if dy < 0 : - else : + fi pi fi
fi
enddef ;

going further makes us end up in an one-line obscurity

Hans

-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
   tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-

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

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