ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* [NTG-context] new upload
@ 2025-02-04 16:59 Hans Hagen
  2025-02-04 18:12 ` [NTG-context] " Rik Kabel
  0 siblings, 1 reply; 7+ messages in thread
From: Hans Hagen @ 2025-02-04 16:59 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Hi,

NOTA BENE:

The next upload is kind of special so best save the old tex tree if you 
update.


For quite a while we have an extended expression scanner on board (in 
luametatex) and after recently testing it a bit more I decided to start 
using it. A side effect is that we can also use more clever assignments 
to dimensions and numbers.

We already had:

   \scratchcounter  10

   \scratchcounter = 10

   \scratchcounter \numexpr       1 + 10\relax
   \scratchcounter \numexpression 1 + 10\relax

etc but these expr have a potential lookahead problem, not so much when 
used liek this but when we have cases like

   \numexpr 1 + 10 - #1\relax

because no one can predict what #1 is, maybe

   \numexp 1  - 10/5

which effectively is:

   \numexpr 1 + 10 -  \numexp 1  - 10/5\relax

which can run wild so in the end that is not suitable for use in key 
value situations. As part of our column set experiments we actually want 
to pass 'expressions', think

   \framed[height=2\lineheight-\strutdp]{...}

or even

   \framed[height=2 * \lineheight - \strutdp]{...}

or even

   \framed[height=2 * lh - sd]{...}

etc. where the 2 * dimension is something not possibel with \dimexpr.

So, to keep a long explanation short, we now also support

   \dimexpr{....}

and also

   \scratchdimen{...}

where in the later case we actually use

   \dimexpression{....}

There's also \dimexperimental which has proper priority handler and can 
mix with integers and floats as well as limited boolean expressions 
(comparison) while its \numexperimental sibbling can also do bitwise 
operations. (Actually \dimexpression also can do some of that but one 
needs to use more ( ) around subexpressions; so \dimexpression 
conceptually sits between \dimexpr and \dimexperimental).

Anyway, more about that in manuals and articles, and it's kind of old 
news already.

The main impact is that now keys that refer to numbers and dimensions 
can also accept expressions without the need to be explicit, so

   width=3em + 2em * 4

   lines=4 + (5*2 - 1)

eventually will all be seen as {something} which as it is valid in 
assignments will trigger the right expression scanner.

The \todimension and \tointeger primitives also accept {} because they 
scan for a dimension or number as again as side effect do all primitives 
and engine keyword that matter. They are serializers.

Deep down context is now adapted to this: adding many {} in assignments, 
wrapping parameters in {} so that they can properly nest, replacing 
/removing redundant \dimexpr etc. All this can have introduced temporary 
issues but they can be fixed easily, so I think that the benefits 
outweight temporary issues. Think 'beta'. 	

In case one wonders, there is no real impact on performance because 
expressions were already quite optimized and the (already kind of old) 
new scanners even more so.

In due time more of the now possible features will be revealed.

Hans (and mikael who tested intermediate versions on real documents)


-----------------------------------------------------------------
                                           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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [NTG-context] Re: new upload
  2025-02-04 16:59 [NTG-context] new upload Hans Hagen
@ 2025-02-04 18:12 ` Rik Kabel
  2025-02-04 20:12   ` Wolfgang Schuster
  0 siblings, 1 reply; 7+ messages in thread
From: Rik Kabel @ 2025-02-04 18:12 UTC (permalink / raw)
  To: ntg-context


[-- Attachment #1.1: Type: text/plain, Size: 1450 bytes --]


On 2025-02-04 11:59, Hans Hagen wrote:
> Hi,
>
> NOTA BENE:
>
> The next upload is kind of special so best save the old tex tree if 
> you update.
>
Indeed. The following

    \normalizefontwidth \FontA {ABCDEF} {\textwidth} {SerifItalic}
    \starttext
       \FontA ABCDEF
    \stoptext

fails with:

    Tex error       > tex error on line 1 in file
    G:/Projects/Testing/bad.tex: Extra \else

    \endgroup \always \edef \normalizedfontsize {37.77924pt=\zeropoint
    \bodyfontsize

    <macro> \typo_normalizers_size
         #1#2->\dimexpr {#1\b_typo_normalizers }=\zeropoint
    \bodyfontsize \else
         \luaexpr {\number \dimexpr 10pt\relax *\number \dimexpr
    #2\relax /\number #1\b_typo_normalizers }\scaledpoint \fi \relax
    <macro> \typo_normalizers_font_at_size
         #1#2#3#4#5->\begingroup \setbox \b_typo_normalizers \hbox
    {\definedfont [#5 at 10pt]\settrialtypesetting #3}\normalexpanded
    {\endgroup \always \edef \noexpand \normalizedfontsize {\the
    \typo_normalizers_size {#1}{#4}
         }}\definefont [\strippedcsname #2]
    <line 3.1>
         \normalizefontwidth \FontA {ABCDEF} {\textwidth} {SerifItalic}

    1 >>  \normalizefontwidth \FontA {ABCDEF} {\textwidth} {SerifItalic}
    2     \starttext
    3       \FontA ABCDEF
    4     \stoptext
    5
    I'm ignoring this; it doesn't match any \if.

-- 
Rik




[-- Attachment #1.2: Type: text/html, Size: 2738 bytes --]

[-- Attachment #2: Type: text/plain, Size: 511 bytes --]

___________________________________________________________________________________
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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [NTG-context] Re: new upload
  2025-02-04 18:12 ` [NTG-context] " Rik Kabel
@ 2025-02-04 20:12   ` Wolfgang Schuster
  0 siblings, 0 replies; 7+ messages in thread
From: Wolfgang Schuster @ 2025-02-04 20:12 UTC (permalink / raw)
  To: ntg-context

Am 04.02.2025 um 19:12 schrieb Rik Kabel:
> 
> On 2025-02-04 11:59, Hans Hagen wrote:
>> Hi,
>>
>> NOTA BENE:
>>
>> The next upload is kind of special so best save the old tex tree if 
>> you update.
>>
> Indeed. The following
> 
>     \normalizefontwidth \FontA {ABCDEF} {\textwidth} {SerifItalic}
>     \starttext
>        \FontA ABCDEF
>     \stoptext


typo-txt.mklx:

\def\typo_normalizers_size#axis#size%
% {\dimexpr\ifdim#1\b_typo_normalizers=\zeropoint
   {\dimexpr\ifzeropt#1\b_typo_normalizers
      \bodyfontsize
    \else
  
\luaexpr{\number\dimexpr10pt\relax*\number\dimexpr#size\relax/\number#axis\b_typo_normalizers}\scaledpoint
    \fi\relax}

Wolfgang

___________________________________________________________________________________
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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [NTG-context] new upload
@ 2024-06-18 20:15 Hans Hagen
  0 siblings, 0 replies; 7+ messages in thread
From: Hans Hagen @ 2024-06-18 20:15 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Hi,

three fixes / improvements:

- math composities get more generous bounding boxes
- tikz inclusion (also new compact=tikz option that strips some nops)
- more fonts got the get-rid-of-bad-apply-characters tweak enabled

- for pablo to test signing

Hans

ps. i'm looking a bit into csl but nothing yet

-----------------------------------------------------------------
                                           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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [NTG-context] new upload
@ 2023-09-04 17:22 Hans Hagen
  0 siblings, 0 replies; 7+ messages in thread
From: Hans Hagen @ 2023-09-04 17:22 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Hi,

new upload with packed itemize fix .. hopefyully no side effects of some 
work in progress (but no crashes in test suite so likely ok)

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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [NTG-context] new upload
@ 2023-08-15 17:08 Hans Hagen
  0 siblings, 0 replies; 7+ messages in thread
From: Hans Hagen @ 2023-08-15 17:08 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Hi,

I uploaded a new lmtx (some new - experimental - things will be 
explained after the ctx meeting), but there's one thing that is somewhat 
important.

In addition to the built in units we can now have so called user units. 
There is some more info about this in the lowlevel-registers manual. One 
of the predefined units is 'uu' with an associated \ununit (dimension) 
variable and it's is also interfaced to metafun. That means that when 
you use uu in metapost graphics you have to make sure that you save the 
meaning and/or numeric uu now.

The idea is that just as in mp one can say 20xx with xx being a (sort 
of) unit, one can do the same in tex. Think of

\newdimension \MyUnitA  \MyUnitA 1.23pt

\pushoverloadmode % just in case
     \newuserunit\MyUnitA ua % binds the unit to the variable
\popoverloadmode

x\hskip 10ua\relax x

The units starting with 'u' are considered user units but be carefulk 
with other combinations as we have (and will have more) built into 
context ones, like

pi : pi for Mikael
ft : foot for Alan
fs : (global body) font size
tw : (layout) text width
th : (layout) text height
hs : (current) hsize
vs : (current) vsize
cd : (when set) column distance
cw : (when set) column width
cx : combination cell width
uu : user unit (\METAFUN)

So Mikael can now have

   test \hskip 3pi\relax test

and Alan can have

   \setuplayout
     [width=1ft]

to be consistent with inches.

The reason why we have this mechanism is that it provides a level of 
abstraction. It might evolve over time but don't expect the 600+ units 
possible to show up because one needs sensible shortcuts. Already built 
in unit always win and you cna only bind to already defined quantities.

Here's one for those who want to go beyond the normal:

\newdimension \FooA   \FooA 1.23pt
\newdimen     \FooB   \FooB 12.3pt
\protected\def\FooC   {\the\dimexpr\FooA +\FooB\relax}

So you can now figure how 'cx' is defined in a dynamic way.


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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [NTG-context] new upload
@ 2023-07-18 20:12 Hans Hagen
  0 siblings, 0 replies; 7+ messages in thread
From: Hans Hagen @ 2023-07-18 20:12 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Hi,

In todays upload there is a follow up on a new feature that is already 
present in the previous upload (but that was not yet advertised):

   context --parallel test1.tex test2.tex test3.tex

   context --parallel --pattern=test*.tex

   context --parallellist myfile.cmd  (filters context processing lines)

   context --parallel test1.tex test2.tex test3.tex --terminal

The --parellel feature will run in parallel, By default upto 8 jobs but 
you can specify less or more depending on your hardware but on my 
machine this is reasonable.

See workflows-parrallel at the end for more info. That one also mentions 
the new --forceinput flag which makes that when these

   context foo-1.tex --mode=m-1 --forceinput=whatever.tex
   context foo-3.tex --mode=m-3 --forceinput=whatever.tex

are run in parallel there is no clash in tuc/pdf. Of course not all 
scenarios might work out well. Commandline arguments given are passed on 
to the different jobs but it's good enough for the purpose I have in mind.

fwiw: a single pass teststuite run (some 1950 files) goes down from 1350 
to 700 seconds but another run with 1200 complex xml documents goes 4 
times faster. In the end this is way cheaper than updating a 5 year old 
dev machine (a new one would run about twice as fast which would bring 
about the same gain).

Hans

ps. Because tex is a memory intense application it doesn't scale with 
the number of cores unless one has the latest greatest fast memory as 
well as generous cpu caches. There's only so much one can do in the code 
base about it.

-----------------------------------------------------------------
                                           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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2025-02-04 20:16 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-02-04 16:59 [NTG-context] new upload Hans Hagen
2025-02-04 18:12 ` [NTG-context] " Rik Kabel
2025-02-04 20:12   ` Wolfgang Schuster
  -- strict thread matches above, loose matches on Subject: below --
2024-06-18 20:15 [NTG-context] " Hans Hagen
2023-09-04 17:22 Hans Hagen
2023-08-15 17:08 Hans Hagen
2023-07-18 20:12 Hans Hagen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).