Hi Hraban,

yes, this makes perfect sense, and it’s very close to the first idea we discussed. Measuring the |\placesidebyside| material in a box and compensating the marginal with |voffset=-\ht0| already solves the main anchoring problem, and your use of |\starttextdisplay| definitely helps stabilizing the vertical placement. Under time pressure, manually helping page breaks is a perfectly reasonable trade-off. The fully “atomic” solution (insert inside the same box) would require a bit more restructuring, and that’s not something you want to risk at the very end. From a conceptual point of view, your current approach is sound, and much better than fighting the page builder blindly.

Good luck with the final stretch!

Best//JP

Le 19/02/2026 à 22:00, Henning Hraban Ramm a écrit :
Salut Jean-Pierre,

thank you for your in-depth analysis!

I’m a bit overwhelmed to integrate Pablo’s last-second corrections into my book which is already overdue and must get completed tonight.

I could use the idea from your first mail, my real code looks now like this:

"""
\definebuffer[CodeExampleS]

\define\stopCodeExampleS{%
\begingroup
\setbox0\vbox{%
  \placesidebyside%
  {\NarrowFramed{%
    \typeCodeExampleS[option=tex,lines=yes,numbering=line]}}%
  {\CodeExampleNarrowFramed{\start\getCodeExampleS\stop}}%
}%
\starttextdisplay
\doifnotmode{print}{\ininner[voffset=-\ht0,]
  {\comment[space=yes,buffer=\thedefinedbuffer{CodeExampleS}]{}}}%
\box0
\stoptextdisplay
\endgroup
}
"""

That works at least better than before.
Yes, it’s convoluted and not a complete MWE, but you get the idea.

I could solve most page breaking issues with inserting empty paragraphs and manual page breaks.

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