[NTG-context] Re: \lastpage incremented by one since 2026.02.10

2026-03-27 Thread Andreas Hof via ntg-context
Thanks a lot.
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : [email protected] / 
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
___


[NTG-context] Re: \lastpage incremented by one since 2026.02.10

2026-03-26 Thread Pablo Rodriguez via ntg-context
On 3/25/26 13:51, Andreas Hof via ntg-context wrote:
> Hi list,
> 
> could someone from the core-dev-team please have a look on this
> topic.

Hi Andreas,

it has been fixed in current latest from 2026.03.25 18:19.

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

maillist : [email protected] / 
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
___


[NTG-context] Re: \lastpage incremented by one since 2026.02.10

2026-03-25 Thread Andreas Hof via ntg-context
Hi list,

could someone from the core-dev-team please have a look on this topic. (see 
thread ...)
what I saw ist, that in texbuildpage.c insertonlycount is correctly initialized 
to 0.
In the mwes posted before for sure this count never gets incremented. 
So since Version 2026.02.10 the execution will always branch to not decrement 
page counters which will result in writing page counter one increment to high 
to the tuc file. 

I have a workaround (without modifying \strc_pagenumbers_decrement_counters), 
but I think someone needs to have a deeper look on this topic. 

Thanks a lot for your help 
Andreas
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : [email protected] / 
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
___


[NTG-context] Re: \lastpage incremented by one since 2026.02.10

2026-03-13 Thread Pablo Rodriguez via ntg-context
On 3/13/26 12:15, Andreas Hof via ntg-context wrote:
> Hi Pablo,
> 
> thanks for your response. 
> in the meantime I digged a bit deeper. 
> The documentation  about \insertonlycount says:
> When a page was wrapped up and there are {\em only} inserts left, 
> this variable hold the number of inserts. In \CONTEXT\ we use this 
> property to issue an insert boundary that then triggers (via a 
> callback) resetting some constraints with respect to note placement. 
> It's one of the more specialized features.

Many thanks for your explanation, Andreas.

BTW, the reference is
https://www.pragma-ade.com/general/manuals/luametatex.pdf#page=208.

> In the mwe there are for sure no inserts left. 
> Therefore \insertonlycount = 0 --> correct!

If the page counters have to decrement when the primitive is 0, I guess
the conditional should read:

 \protected\def\strc_pagenumbers_decrement_counters % only at the end
-   {\ifcase\insertonlycount\else
+   {\ifcase\insertonlycount
   \strc_counters_decrement\s!realpage
   \strc_counters_decrement\s!userpage
   \strc_counters_decrement\s!subpage
-\fi}
+\else\fi}

Otherwise, I think `\insertonlycount` won’t decrement counters when it
has a value (even zero).

I may be misunderstanding `\ifcase`
(https://tug.ctan.org/info/impatient/book.pdf#search=ifcase), but it may
be be something similar.

Many thanks for your help,

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

maillist : [email protected] / 
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
___


[NTG-context] Re: \lastpage incremented by one since 2026.02.10

2026-03-13 Thread Andreas Hof via ntg-context
Hi Pablo,

thanks for your response. 
in the meantime I digged a bit deeper. 
The documentation  about \insertonlycount says:
When a page was wrapped up and there are {\em only} inserts left, this variable
hold the number of inserts. In \CONTEXT\ we use this property to issue an insert
boundary that then triggers (via a callback) resetting some constraints with
respect to note placement. It's one of the more specialized features.

In the mwe there are for sure no inserts left. 
Therefore \insertonlycount = 0 --> correct!

However, in this case the page counters are not decremented in 
\strc_pagenumbers_decrement_counters
This macro is appended to \everygoodbye. So in case of no insertions only left  
\lastpage is always 1 to high. 

There is another position where \insertonlycount is used (page-one.mkxl). Here 
the \vsize is adapted in case of  \insertonlycount != 0. 

I guess in src_pag.mkxl the \ifcase shall be switched. so only in case of no 
insertions are left the page number will be decremented, in case of only 
insertions are left, the page number is not decremented.

For me a workaround on user level seems to work (in case I have no insertions 
only left), without modifications in the core code:
\def\insertonlycount{1} % force branch in \strc_pagenumbers_decrement_counters 
--> \everygoodbye
\pageinsertonlyfactor=0 % don't adjust \vsize

Maybe it helps to analyze in more detail 
Andreas
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : [email protected] / 
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
___


[NTG-context] Re: \lastpage incremented by one since 2026.02.10

2026-03-12 Thread Pablo Rodriguez via ntg-context
On 3/4/26 17:36, Andreas Hof via ntg-context wrote:
> Hi, 
> 
> recently I saw a difference between context 2026.01.08 23:24 and
> afterwards.
> 
> with the following mwe I get from Version: 2026.02.10 16:31 
> \lastpage (or \lastrealpagenumber) one increment to high (even with
> one page of output \lastrealpagenumber reports 2)

Hi Andreas,

I can confirm that I reproduce your issue with current latest
(2026.02.19 11:49):

  \starttext
  page \realpagenumber\ of \lastrealpagenumber
  \stoptext

It only happens with LMTX, not with LuaTeX.

As you mention, removing the conditional in lines 243-247 from
`strc-pag.mkxl` makes `\lastpage` behave properly, but I don’t know
whether there may be other side effects.

Wolfgang, could you check this issue and see whether the removal of the
`\ifcase\insertonlycount\else…\fi` in lines 243-247 from `strc-pag.mkxl`
is the right fix here?

Timing is complex, since the 2026 Spring Meeting of DANTE is taking
place these days (https://www.dante.de/veranstaltungen/dante2026/).

Many thanks for your help,

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

maillist : [email protected] / 
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
___