# [NTG-context] a way to implement \testcolumn in mixedcolumns

Hello,

On this list I've been advised that mixedcolumns is the latest and
greatest implementation of columns; the one to use. We have switched
over from columnsets to mixedcolumns, and have been very pleased with
the column balancing (for some reason we couldn't get column balancing
to work in columnsets).

However one thing we do miss from columnsets is the control over widows
& orphans in two ways: \testcolumn, and \setupcolumnsetlines.
\testcolumn[n] allowed us to do a conditional column break, so when we
were about to start a new subsection heading, we could prevent it being
an orphan at the bottom of the column; and when starting a paragraph
with a hangaround graphic framed flushright and bottom, we could
similarly use \testcolumn to prevent the graphic from hanging down into
the footer (which is what sometimes happened otherwise).

So I'm wondering, is there some way to achieve the equivalent of
\testcolumn in mixedcolumns?

Is it theoretically impossible to implement this in mixedcolumns because
the required information (how many lines are left in the current column)
is not yet known?
Or could that information be gleaned from somewhere?

I see in page-brk.mkiv the following definition for \testcolumn:

\def\testcolumn
{\dodoubleempty\page_tests_columns_test}

\def\page_tests_columns_test[#1][#2]%
{\endgraf
\ifdim\pagegoal<\maxdimen
\ifdim\pagetotal<\pagegoal
\d_page_tests_test\dimexpr
\pagegoal
-\pagetotal
\ifdim\lastskip<\parskip+\parskip\fi
\ifsecondargument+#2\fi
\relax
\getrawnoflines\d_page_tests_test % (raw)
\ifnum#1>\noflines
\column
\fi
\else
\penalty-\plustenthousand % (untested)
\fi
\fi}

I'm not a low-level TeX programmer, and I don't understand a lot of
this, but it looks like
\getrawnoflines\d_page_tests_test
puts the number of remaining lines into \noflines

Any suggestions are appreciated.
(And I should have a MWE soon.)

Lars

___________________________________________________________________________________
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________