On 2/2/2026 1:06 AM, Jim wrote:
On Wed, Jan 28, 2026 at 21:37 (+0100), Hans Hagen wrote:

On 1/28/2026 8:58 PM, Jim wrote:
Hi,

I am in the middle of trying to put a newsletter together.  A heading
occurred as the last line on a page, so I put
          \testpage[][1.5in]
in front of it.

All was good, the heading went onto the next page.

Then, higher up in the page, I put
          \blank[2*line]
to separate a couple of things.

Curiously, the afore-mentioned heading now appears on the page.

In desperation (publishing deadlines, you know) I can use brute force, but
I hate doing that.

I tried creating a minimal example, but (sort of unfortunately) that
behaved as expected.

Doing a binary search through my config may reveal what sin I have
committed to cause this, but that will have to wait (publishing deadline).

In the interim, does this situation tweak anyone's memory of seeing
something like this before?  If so, do you have any words of wisdom for me,
so I can narrow down the hunt?

It will always be unreliable as it triggers the output routine which can
interfere.

You can try several methods:

\testpage
\testpageonly
\testpagesync

If you're in experimental mode you can try this (\pagelastheight might be
more reliable that \pagetotal).

\unprotect

\defcsname\??pagecheckermethod 4\endcsname
   {\ifdim\pagegoal<\maxdimen \relax
      \ifdim\pagelastheight<\pagegoal \relax
        \ifdim{\page_check_amount-\pagegoal}>-\lineheight
          \pagecheckerparameter\c!before
          \penalty-\plustenthousand
          \pagecheckerparameter\c!after
        \else
          \pagecheckerparameter\c!inbetween
        \fi
      \else
        \pagecheckerparameter\c!inbetween
      \fi
    \else
      \goodbreak
      \pagecheckerparameter\c!inbetween
    \fi}

\definepagechecker[\s!unknown:4][\s!unknown:0][\c!method=4]

\protect

\showframe

\starttext
     \dorecurse{38}{test #1.1\par}
     \checkpage[unknown:4][lines=23,offset=0pt]
     \dorecurse{10}{test #1.2\par}
\stoptext

What with my deadline behind me, I am happy to go into experimental mode.
However, aside from running your example, I regret to report that I'm not
sure what I should learn from the above.

There are several ways to check if we have room and this is yet another one. Without a good minimal example it's not possible to say what happens in your case.

In related news, I managed to create a sorta-kinda-minimal example showing
(a) my issue with \testpage not ejecting the page when it "really should",
     (i.e., when I think it really should); and
(b) some other sources of confusion for me:
     (i)  change the "\iftrue" to "\iffalse", and although the word
          "Announcements" (in the middle of the page) stays in the same spot
          on the page (+/- epsilon), the page further down shifts around a
          bit and "Layout" gets to the next page, as called for.
          But why?
     (ii) If "%Word  " on the 7th last line is uncommented, even though this
          is after the page break, now "Layout" moves to the second page, as
          called for.

(This example doesn't exactly reproduce the problem I originally had, but I
didn't save the exact page contents for that problem, and so my example
below shows some closely related problems.)

you use \vskips so that interferes with the normal parskips and \blank that is the only reliable way to do vertical spacing

No doubt (*cough*) some of these issues have to do with ConTeXt's output
routines.  While I understand plain TeX's output routine enough to have
modified it for my own purposes on occasion, I have no familiarity with
ConTeXt's output routine.

not with the output routines ... these are token lists that get expanded when tex decides that the page overflows in which case it fires up that routine; skips and penalties trigger a run over the contribnutions so far. Until that happenes we have no real way to determine if we have room (ok, we might check the pending contributions bit even that is unreliable.

So either we test the last determined available space (with some slack for possible whitespace) or we trigger a build step (various methods) and hope for the best (again we need to add slack for whitespace).

In all these cases even a few points can make a difference.

But even in the face of my lack of understanding about the "(b)" sources of
confusion, I would like to know why neither of my \testpage commands give me
a page break.

you could try \tracingpages=10 \tracingonline=1

I apologize for my example not being minimum, but I think it is close to
minimal.

%%%%%%%%%%%%%%%%%%%%%%%%%%%% Line 0 of example %%%%%%%%%%%%%%%%%%%%%%%%%%%%
\setupwhitespace [big]
\setuppapersize [letter]
\setuplayout[
        backspace=0.5in,
        width=7.5in,
        topspace=37.77pt,
        header=12pt,
        headerdistance=20.5pt,
        height=705.70255,
        footerdistance=11.5pt,
        footer=12pt,
]

\starttext

Word\vskip 26pt

Word\vskip0.6in\relax word.

% If this \iftrue is changed to \iffalse, the word "Announcements" below
% is the same distance from the top of the page, but the rest of the page
% changes a bit and "Layout:" moves to the next page.
%\iffalse
\iftrue
Word \\ word \\ word \\ word \\ word \\ word \\ word.

Word \\ word.
\else
\vskip 134pt
\fi

\vskip 6pt

{\bfa Announcements:}
\startitemize[packed]
\item Word \\ word \\ word \\ word.
\item Word
     \startitemize[nowhite]
     \item Word
     \item More words
     \item More words
     \stopitemize
\stopitemize

\vskip 6 pt

{\bfa Word:}

Word \\ word \\ word.

{\bf Word:}
\startitemize[packed]
\item Word \\ word.
\item Word \\ word.
\item Word \\ word.
\stopitemize

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

{\bf Layout:}

\startitemize[packed]
\vskip-\parskip % Counter-measure to unwanted vertical space.

%Word  % If this line is uncommented, "Layout:" jumps to page 2(!).

\placefigure[right,none,height,low]{}{\externalfigure[doesNotMatter][width=3.3in]}
\item Word.
\stopitemize

\stoptext

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% end of example %%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% at least enable tracing:

\showframe \showmakeup[line,vglue,vpenalty]

\starttext

% and use \blank

Word \blank[4*big]

Word\blank word.

Word \\ word \\ word \\ word \\ word \\ word \\ word.

Word \\ word.

\blank[small]

% and a sectioning commend or something structural

{\bfa Announcements:}

\startitemize[packed]
\item Word \\ word \\ word \\ word.
\item Word
     \startitemize[nowhite]
     \item Word
     \item More words
     \item More words
     \stopitemize
\stopitemize

\blank[small] % % \vskip 6 pt

{\bfa Word:}

Word \\ word \\ word.

{\bf Word:}
\startitemize[packed]
\item Word \\ word.
\item Word \\ word.
\item Word \\ word.
\stopitemize

% works okay

\testpage[121]          % 121 lines left?

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

{\bf Layout:}

% move that one out of the itemize, no hanging in itemize

\placefigure[right,none,height,low]{}{\externalfigure[doesNotMatter][width=3.3in]}

% use \startitem ... \stopitem

\startitemize[packed]

% unstructured:
% Word  % If this line is uncommented, "Layout:" jumps to page 2(!).

    \item Word.

\stopitemize

\stoptext

side floats hook into the page builder / ourout routine ... it's already tricky enough so make that also work with a bullet in front; also side floats do some testing for available space

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