Re: [NTG-context] Can ConTeXt print specific paragraph and sentences from an input file?

2023-01-26 Thread Hans Hagen via ntg-context

On 1/27/2023 4:22 AM, Joel via ntg-context wrote:

Assuming I have an input file with an essay:

\starttext

\input essay

\stoptext


Is there any command to tell ConTeXt to print a specific sentence, e.g. 
the first sentence from paragraph 2, or the last sentence from paragraph 
1, etc?
depends on the kind of input, coding etc .. how reliable is is to 
recognize a sentence and such, but given that tex is a programing 
environment all is possible in the end


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
___


[NTG-context] Can ConTeXt print specific paragraph and sentences from an input file?

2023-01-26 Thread Joel via ntg-context
Assuming I have an input file with an essay:
\starttext
\input essay
\stoptext

Is there any command to tell ConTeXt to print a specific sentence, e.g. the 
first sentence from paragraph 2, or the last sentence from paragraph 1, etc?
--Joel
___
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] autospacing and colonequals (was Lucida-1.901 (2023-01-21) available)

2023-01-26 Thread Hans Hagen via ntg-context

On 1/26/2023 10:52 PM, Otared Kavian via ntg-context wrote:

Indeed the command \colonequals give the precise expected alignment for 
the combination glyph « := ». Befors changing the combination « := » to 
\columnequals in my documents, I am wondering whether one could add a 
small lua code in order to make an automatic replacement at run time. 
Actually, since I don’t know of any other instance in which the 
combination « := » is used to mean something else, would it not be 
reasonnable to make « := » synonym to \colonequals?


that's what the (has-always-been-there)

\setupmathematics[collapsing=2]

is for (needs latest version to work when the space trickery i senabled)

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] protected macro vs protected luacall

2023-01-26 Thread Hans Hagen via ntg-context

On 1/26/2023 9:33 PM, Henri Menke via ntg-context wrote:

\directlua{
   userdata = userdata or {}
   function userdata.test()
 tex.print("\string\\numexpr 17\string\\relax")
   end
}

\tt
\protected\def\test{\directlua{userdata.test()}}
\meaning\test\par
\edef\x{\test}\meaning\x\par
\the\test

\directlua{
   local t = lua.get_functions_table()
   t[\string#t + 1] = userdata.test
   token.set_lua("test", userdata.test, \string#t, "protected")
}
\meaning\test\par
\edef\x{\test}\meaning\x\par
\the\test

from the code it looks like we're talking plain luatex ...

\the is very selective and doesn't work for all primitives or macros

compare it to \number which accepts any number representation following 
it while \the doesn't work ok 123


that said, your set_lua is wrong and passes a function as well as an index

\directlua{
   lua.get_functions_table()[999] = function()
 tex.print("\string\\numexpr 17\string\\relax")
   end
   token.set_lua("test", 999)
}

\the\test % needs the \numexpr

\number \test % doesn't

\count0 \test % needs the \numexpr

\count0=\test % doesn't

etc

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] autospacing and colonequals (was Lucida-1.901 (2023-01-21) available)

2023-01-26 Thread Otared Kavian via ntg-context
Hi Hans and Mikael,

Thank you both for your attention to my reply and the clarification and hints 
regarding the comman \colonequals and 
\setupmathematics[autospacing=yes]

Indeed the command \colonequals give the precise expected alignment for the 
combination glyph « := ». Befors changing the combination « := » to 
\columnequals in my documents, I am wondering whether one could add a small lua 
code in order to make an automatic replacement at run time. Actually, since I 
don’t know of any other instance in which the combination « := » is used to 
mean something else, would it not be reasonnable to make « := » synonym to 
\colonequals?

I played a little bit with 
\setupmathematics[autospacing=yes]
and it seems to me that without this command one gets automatic spacing in math 
mode, while with the above command the spacing obeys what has been inserted in 
the source. Is this behaviour intended, or is there a mismatch between 
\setupmathematics[autospacing=yes]
and
\setupmathematics[autospacing=no]

Best regards: Otared


> On 26 Jan 2023, at 10:33, Hans Hagen via ntg-context  > wrote:
> 
> On 1/25/2023 6:24 PM, Mikael Sundqvist via ntg-context wrote:
>> On Wed, Jan 25, 2023 at 11:02 AM Otared Kavian via ntg-context
>> mailto:ntg-context@ntg.nl>> wrote:
>>> 
>>> Hi,
>>> 
>>> Thanks Hraban for the information and the link to the article by Hans and 
>>> Mikael about the math fonts in Lucida.
>>> 
>>> I very much appreciated that article: one sees how the handling of almost 
>>> impercebtile details in ConTeXt make us to adhere to and love LuaMetaTeX… 
>>> So a great thank you to Hans and Mikael for all this work!
>>> 
>>> Regarding the details of vertical alignment in math, I wonder whether the 
>>> column « : » in front of the equal sign « = », in the combination « := » 
>>> (used to define for instance a new variable) should be alos centered around 
>>> the math axis, as explained in the article. For instance in the following 
>>> example
>>> 
>>> \setupbodyfont[lucidaot,12pt]
>>> \starttext
>>> \startformula
>>> f(x) := -(u|x) := - \langle u, x \rangle
>>> \stopformula
>>> \stopformula
>>> \startformula
>>> f : A \longrightarrow B
>>> \stopformula
>>> \stoptext
>>> 
>>> it seems to me that the lower dot (or square…) in the semicolumn of the 
>>> first formula (in front of the equal sign) is lower than in the second 
>>> formula.
>>> 
>>> Best regards: Otared
>> Thank you for the kind words, Otared,
>> Regarding the colons (and other symbols with "dots"), I would say it
>> is still not optimal in Lucida (and difficult to make it "consistent",
>> there are too many symbols that are at the moment different). But in
>> your example you can use \colonequals and \colon if you prefer. They
>> are centered around the math axis.
>> Best, Mikael
>> \setupbodyfont[lucidaot,12pt]
>> \starttext
>> \startformula
>> f(x) := -(u|x) \colonequals - \langle u, x \rangle
>> \stopformula
>> \startformula
>> f : A \longrightarrow B \breakhere
>> f \colon A \longrightarrow B
>> \stopformula
>> \startformula
>> \mathaxisbelow := \colonequals : \colon
>> \stopformula
>> \stoptext
> There is a (experimental as we played with it and then got distracted) 
> feature that makes some symbols adapt to spacing in the input.
> 
> \starttext
> 
>\setupmathematics[autospacing=yes]
> 
>\setupmathematics[collapsing=2]
> 
>\im{A:B} and \im{A : B}\par
>\im{A:=B} and \im{A := B}\par
>\im{A\colonequals B} and \im{A {\colonequals} B}\par
> 
> \stoptext
> 
> the second line is not yet ok as collapsing the := (old feature) comes at the 
> wrong time when we do autospacing (something Mikasl and I now need to discuss 
> and test)
> 
> This autospacing is part of some larger effort, for instance we can also auto 
> handle fences and so. All this relates to minimizing the input and make it a 
> bit more natural. Think (1,2) vb (1, 2) where we - due to the many more 
> classes that we have - want spacing to be right.
> 
> All will be revealed in the upcoming releases and the upcoming 3145 page math 
> manual.
> 
> 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 

[NTG-context] protected macro vs protected luacall

2023-01-26 Thread Henri Menke via ntg-context
Dear list,

I have noticed a somewhat strange difference between protected macros
and protected luacalls, namely that the latter cannot be expanded by
\the.  In the example below I define a Lua function that prints
\numexpr 17\relax to the token stream and I call it once from a
protected TeX macro wrapping \directlua and once from a protected
luacall registered with token.set_lua.


\directlua{
  userdata = userdata or {}
  function userdata.test()
tex.print("\string\\numexpr 17\string\\relax")
  end
}

\tt
\protected\def\test{\directlua{userdata.test()}}
\meaning\test\par
\edef\x{\test}\meaning\x\par
\the\test

\directlua{
  local t = lua.get_functions_table()
  t[\string#t + 1] = userdata.test
  token.set_lua("test", userdata.test, \string#t, "protected")
}
\meaning\test\par
\edef\x{\test}\meaning\x\par
\the\test

\bye


However, the second \the\test fails with the following error:


! You can't use `luacall 0' after \the.
l.21 \the\test


Is this asymmetry between luacalls and regular macros intended? Is
there a workaround where I can have a luacall that doesn't expand
inside of \edef but still expands after \the?

Cheers, Henri
___
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

2023-01-26 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
 general/manuals/
 general/manuals/luametatex.pdf
 
 sent 108,872 bytes  received 23,790,479 bytes  3,676,823.23 bytes/sec
 total size is 449,357,732  speedup is 18.80


Running archiver:

New dir: /var/www/aanhet.net/context//htdocs/archives/context-2023-01-26.19
122199385   
/var/www/aanhet.net/context//htdocs/archives/context-2023-01-26.19/latest
126745317   
/var/www/aanhet.net/context//htdocs/archives/context-2023-01-26.19/current
248948798   
/var/www/aanhet.net/context//htdocs/archives/context-2023-01-26.19
248948798   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
___


Re: [NTG-context] Lucida-1.901 (2023-01-21) available

2023-01-26 Thread Hans Hagen via ntg-context

On 1/25/2023 6:24 PM, Mikael Sundqvist via ntg-context wrote:

On Wed, Jan 25, 2023 at 11:02 AM Otared Kavian via ntg-context
 wrote:


Hi,

Thanks Hraban for the information and the link to the article by Hans and 
Mikael about the math fonts in Lucida.

I very much appreciated that article: one sees how the handling of almost 
impercebtile details in ConTeXt make us to adhere to and love LuaMetaTeX… So a 
great thank you to Hans and Mikael for all this work!

Regarding the details of vertical alignment in math, I wonder whether the 
column « : » in front of the equal sign « = », in the combination « := » (used 
to define for instance a new variable) should be alos centered around the math 
axis, as explained in the article. For instance in the following example

\setupbodyfont[lucidaot,12pt]
\starttext
\startformula
f(x) := -(u|x) := - \langle u, x \rangle
\stopformula
\stopformula
\startformula
f : A \longrightarrow B
\stopformula
\stoptext

it seems to me that the lower dot (or square…) in the semicolumn of the first 
formula (in front of the equal sign) is lower than in the second formula.

Best regards: Otared


Thank you for the kind words, Otared,

Regarding the colons (and other symbols with "dots"), I would say it
is still not optimal in Lucida (and difficult to make it "consistent",
there are too many symbols that are at the moment different). But in
your example you can use \colonequals and \colon if you prefer. They
are centered around the math axis.

Best, Mikael

\setupbodyfont[lucidaot,12pt]
\starttext
\startformula
f(x) := -(u|x) \colonequals - \langle u, x \rangle
\stopformula
\startformula
f : A \longrightarrow B \breakhere
f \colon A \longrightarrow B
\stopformula
\startformula
\mathaxisbelow := \colonequals : \colon
\stopformula
\stoptext
There is a (experimental as we played with it and then got distracted) 
feature that makes some symbols adapt to spacing in the input.


\starttext

\setupmathematics[autospacing=yes]

\setupmathematics[collapsing=2]

\im{A:B} and \im{A : B}\par
\im{A:=B} and \im{A := B}\par
\im{A\colonequals B} and \im{A {\colonequals} B}\par

\stoptext

the second line is not yet ok as collapsing the := (old feature) comes 
at the wrong time when we do autospacing (something Mikasl and I now 
need to discuss and test)


This autospacing is part of some larger effort, for instance we can also 
auto handle fences and so. All this relates to minimizing the input and 
make it a bit more natural. Think (1,2) vb (1, 2) where we - due to the 
many more classes that we have - want spacing to be right.


All will be revealed in the upcoming releases and the upcoming 3145 page 
math manual.


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
___