On 2/3/2026 3:32 PM, Jim wrote:
On Tue, Feb  3, 2026 at 10:28 (+0100), Hans Hagen via ntg-context wrote:

On 2/3/2026 3:16 AM, Jim wrote:

it has been a day of history reading for me.  Earlier today I came across
musings-plain.tex, which was an interesting read.

So I assume you're now reading musings-basic, also history, how plain etc
came to be?

Not yet, but I will put them on my reading list. :-)

But if anyone thinks their brain needs a puzzle showing peculiar (dare I
say "anomalous"?) behaviour involving \testpage and \placefigure (which is
no longer inside a \startitemize ... \stopitemize environment) let me know
and I'll be happy to share.

well, you can post the 17 lines

Well, since you asked... :-)

%%%%%%%%%%%%%%%%%%%%%%% this line doesn't count %%%%%%%%%%%%%%%%%%%%
\starttext

Word

\blank[288pt]

Word

\blank[170pt]

aaa

\blank[58pt]

{\bf Word:}

www

Go ahead, delete me!

\blank[138pt]

\testpage[121]          % 121 lines left?
\testpage[][4in]        % 4 inches left?

{\bf Layout:}

% Go ahead, uncomment me!

\placefigure[right,]{}{\externalfigure[doesNotMatter][width=2.3in]}

\stoptext
%%%%%%%%%%%%%%%%%%%%%%% this line doesn't count %%%%%%%%%%%%%%%%%%%%

[[ Yes, that is a most peculiar page, but minimizing my actual page
    to retain the curious behaviour was a bit fiddly. ]]

There are three peculiarities (to my (limited) way of thinking) on this page:

(1) When I run this, the word "Layout" is at the bottom of page 1, even
     though there are not 121 lines or 4 inches left on the page.
(Thus I would have expected \testpage to issue a \page command.)

(2) If I delete the line "Go ahead, delete me" (which conceptually
     should leave more room on Page 1 for following text, not less room),
     the word "Layout" moves to the next page.
(I find "less content above" causing "Layout" to move to the next page
     confounding.)

(3) If I uncomment the line "Go ahead ...", I might imagine that either
     (i) it could fit at the bottom of page 1, or
     (ii) it might not fit on page 1, thus it would appear on page 2.

     But I find it curious that adding a line *after* "Layout" (which is
     itself *after* \testpage) would cause "Layout" to move.

     In the absence of \testpage, if I squint just right, I can imagine widow
     / orphan / club penalties causing "Layout" to move to page 2 in this
     case.  But I wouldn't imagine \testpage to be prescient about the
     following lines, because the wiki says
         The command \testpage inserts a page break if there is less than
         the specified amount of space left on the current page.

     If instead the wiki said
         The command \testpage inserts a penalty which is likely to cause a
         page break here if there is less than the specified amount of space
         left on the current page.
     then I (with appropriate squinting) could see what is happening, at
     least if I assume some interesting things are going on with the
     \placefigure command.

Any enlightenment about
(a) what is happening, as well as
(b) how I can tell \testpage that "I *really* want a page break if there
     isn't the specified amount of space"
would be much appreciated.

You can sprinkle the test with:

\TRACE{1}

\TRACE{2}

etc

\def\TRACE#1%
  {\writestatus
     {HERE #1}
     {\the\pagegoal,
      \the\pagetotal,
      \the\pagestretch,
      \the\pageshrink}}

and see what gets reported as state.

Can you see if \testpagesync (same arguments) works better for you?

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

Reply via email to