summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/context/base/page-mix.mkiv
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/context/base/page-mix.mkiv')
-rw-r--r--Master/texmf-dist/tex/context/base/page-mix.mkiv149
1 files changed, 94 insertions, 55 deletions
diff --git a/Master/texmf-dist/tex/context/base/page-mix.mkiv b/Master/texmf-dist/tex/context/base/page-mix.mkiv
index 57de14b88b4..b545e8f4c97 100644
--- a/Master/texmf-dist/tex/context/base/page-mix.mkiv
+++ b/Master/texmf-dist/tex/context/base/page-mix.mkiv
@@ -69,6 +69,7 @@
\c!maxheight=\textheight,
\c!maxwidth=\makeupwidth,
\c!grid=\v!tolerant,
+ \c!internalgrid=\v!line,
\c!step=.25\lineheight, % needs some experimenting
%\c!splitmethod=\v!fixed, % will be default
\c!method=\ifinner\s!box\else\s!otr\fi] % automatic as suggested by WS
@@ -167,6 +168,8 @@
[\c!n=\itemgroupparameter\c!n,
\c!separator=\v!none,
\c!splitmethod=\v!none,
+ \c!grid=\v!tolerant,
+ \c!internalgrid=\v!halfline, % new, we may still revert to \v!line
\c!balance=\v!yes]
\unexpanded\def\strc_itemgroups_start_columns
@@ -289,18 +292,32 @@
\installcorenamespace{mixedcolumnsseparator}
-\setvalue{\??mixedcolumnsseparator\v!rule}%
- {\starttextproperties
- \usemixedcolumnscolorparameter\c!rulecolor
- \vrule\s!width\mixedcolumnsparameter\c!rulethickness
- \stoptextproperties}
+\unexpanded\def\installmixedcolumnseparator#1#2%
+ {\setvalue{\??mixedcolumnsseparator#1}{#2}}
+
+\installmixedcolumnseparator\v!rule
+ {\vrule
+ \s!width \mixedcolumnsparameter\c!rulethickness
+ \s!height\mixedcolumnseparatorheight
+ \s!depth \mixedcolumnseparatordepth
+ \relax}
\unexpanded\def\page_mix_command_inject_separator
- {\bgroup
+ {\begingroup
+ \setbox\scratchbox\hbox to \zeropoint \bgroup
+ \hss
+ \starttextproperties
+ \usemixedcolumnscolorparameter\c!rulecolor
+ \csname\??mixedcolumnsseparator\p_separator\endcsname % was \c!rule
+ \stoptextproperties
+ \hss
+ \egroup
+ \ht\scratchbox\zeropoint
+ \dp\scratchbox\zeropoint
\hss
- \csname\??mixedcolumnsseparator\mixedcolumnsparameter\c!separator\endcsname % was \c!rule
+ \box\scratchbox
\hss
- \egroup}
+ \endgroup}
%D We've now arrived at the real code. The start command mostly sets up the
%D environment and variables that are used in the splitter. One of the last
@@ -348,13 +365,13 @@
\csname\??mixedcolumnsstart\currentmixedcolumnsmethod\endcsname}
\def\page_mix_start_columns_b[#1][#2]%
- {\doifassignmentelse{#1}%
+ {\doifelseassignment{#1}%
{\let\currentmixedcolumns\empty
\page_mix_error_b}
{\edef\currentmixedcolumns{#1}%
\firstargumentfalse}%
\edef\currentmixedcolumnsmethod{\mixedcolumnsparameter\c!method}%
- \mixedcolumnsparameter\c!before\relax % so, it doesn't list to local settings !
+ \mixedcolumnsparameter\c!before\relax % so, it doesn't listen to local settings !
\csname\??mixedcolumnsbefore\currentmixedcolumnsmethod\endcsname\relax
\begingroup
\iffirstargument
@@ -452,6 +469,8 @@
%
\usemixedcolumnscolorparameter\c!color
%
+ \insidecolumnstrue % new
+ %
\nofcolumns\c_page_mix_n_of_columns} % public
%D The otr method related hooks are defined next:
@@ -505,6 +524,10 @@
{\c_page_mix_routine\c_page_mix_routine_balance}%
{\penalty-\plustenthousand}% weird hack, we need to trigger the otr sometimes (new per 20140306, see balancing-001.tex)
\page_otr_trigger_output_routine
+ \ifvoid\b_page_mix_preceding \else
+ % empty columns so we need to make sure pending content is flushed
+ \unvbox\b_page_mix_preceding % new per 2014.10.25
+ \fi
\fi}
\setvalue{\??mixedcolumnsafter\s!otr}%
@@ -521,26 +544,52 @@
\unexpanded\def\page_mix_routine_construct#1%
{\d_page_mix_max_height\mixedcolumnsparameter\c!maxheight % can have changed due to header=high
- \ctxcommand{mixsetsplit {
- box = \number\b_page_mix_collected,
- nofcolumns = \number\c_page_mix_n_of_columns,
- maxheight = \number\d_page_mix_max_height,
- step = \number\d_page_mix_balance_step,
- cycles = \number\c_page_mix_balance_cycles,
- preheight = \number\d_page_mix_preceding_height,
- prebox = \number\b_page_mix_preceding,
- strutht = \number\strutht,
- strutdp = \number\strutdp,
- threshold = \number\d_page_mix_threshold,
- splitmethod = "\mixedcolumnsparameter\c!splitmethod",
- balance = "#1",
- alternative = "\mixedcolumnsparameter\c!alternative",
- grid = \ifgridsnapping true\else false\fi,
- }}%
+ \clf_mixsetsplit
+ box \b_page_mix_collected
+ nofcolumns \c_page_mix_n_of_columns
+ maxheight \d_page_mix_max_height
+ step \d_page_mix_balance_step
+ cycles \c_page_mix_balance_cycles
+ preheight \d_page_mix_preceding_height
+ prebox \b_page_mix_preceding
+ strutht \strutht
+ strutdp \strutdp
+ threshold \d_page_mix_threshold
+ splitmethod {\mixedcolumnsparameter\c!splitmethod}%
+ balance {#1}%
+ alternative {\mixedcolumnsparameter\c!alternative}%
+ internalgrid {\mixedcolumnsparameter\c!internalgrid}%
+ grid \ifgridsnapping true\else false\fi
+ \relax
\deadcycles\zerocount}
+\newdimen\mixedcolumnseparatorheight
+\newdimen\mixedcolumnseparatordepth
+\newdimen\mixedcolumnseparatorwidth
+
+\def\page_mix_routine_package_step
+ {% needs packaging anyway
+ \setbox\scratchbox\page_mix_command_package_column
+ \page_marks_synchronize_column\plusone\c_page_mix_n_of_columns\recurselevel\scratchbox
+ % backgrounds
+ \anch_mark_column_box\scratchbox
+ % for the moment a quick and dirty patch .. we need to go into the box (hence the \plusone) .. a slowdowner
+ \page_lines_add_numbers_to_box\scratchbox\recurselevel\c_page_mix_n_of_columns\plusone
+ % the framed needs a reset of strut, align, setups etc
+ \mixedcolumnseparatorheight\ht\scratchbox
+ \mixedcolumnseparatordepth \dp\scratchbox
+ \inheritedmixedcolumnsframedbox\currentmixedcolumns\scratchbox
+ % optional
+ \ifnum\recurselevel<\c_page_mix_n_of_columns
+ \ifcsname\??mixedcolumnsseparator\p_separator\endcsname
+ \page_mix_command_inject_separator
+ \else
+ \hss
+ \fi
+ \fi}
+
\unexpanded\def\page_mix_routine_package
- {\ctxcommand{mixfinalize()}%
+ {\clf_mixfinalize
\setbox\b_page_mix_collected\vbox \bgroup
\ifvoid\b_page_mix_preceding \else
\page_postprocessors_linenumbers_deepbox\b_page_mix_preceding
@@ -550,26 +599,16 @@
\fi
\hskip\d_page_mix_leftskip
\page_mix_hbox to \d_page_mix_max_width \bgroup
- \dorecurse\c_page_mix_n_of_columns{%
- % needs packaging anyway
- \setbox\scratchbox\page_mix_command_package_column
- \page_marks_synchronize_column\plusone\c_page_mix_n_of_columns\recurselevel\scratchbox
- % for the moment a quick and dirty patch .. we need to go into the box (hence the \plusone) .. a slowdowner
- \page_lines_add_numbers_to_box\scratchbox\recurselevel\c_page_mix_n_of_columns\plusone
- % the framed needs a reset of strut, align, setups etc
- \inheritedmixedcolumnsframedbox\currentmixedcolumns\scratchbox
- % optional
- \ifnum\recurselevel<\c_page_mix_n_of_columns
- \page_mix_command_inject_separator
- \fi
- }%
+ \edef\p_separator{\mixedcolumnsparameter\c!separator}%
+ \mixedcolumnseparatorwidth\d_page_mix_distance % \mixedcolumnsparameter\c!rulethickness\relax
+ \dorecurse\c_page_mix_n_of_columns\page_mix_routine_package_step
\egroup
\egroup}
\unexpanded\def\page_mix_command_package_column
{\page_mix_hbox to \d_page_mix_column_width \bgroup
% maybe intercept empty
- \ctxcommand{mixgetsplit(\recurselevel)}%
+ \clf_mixgetsplit\recurselevel\relax
\hskip-\d_page_mix_column_width
\page_mix_hbox to \d_page_mix_column_width \bgroup
\placenoteinserts
@@ -585,8 +624,8 @@
\page_mix_routine_construct\v!no
\page_mix_routine_package
\page_otr_construct_and_shipout\box\b_page_mix_collected
- \ctxcommand{mixflushrest()}%
- \ctxcommand{mixcleanup()}%
+ \clf_mixflushrest
+ \clf_mixcleanup
\egroup}
\unexpanded\def\page_mix_routine_balance
@@ -597,9 +636,9 @@
\doloop
{%writestatus\m!columns{construct continue (\the\htdp\b_page_mix_collected)}%
\page_mix_routine_construct\v!no
- \ifcase\ctxcommand{mixstate()}\relax
+ \ifcase\clf_mixstate\relax
% 0 = okay, we can balance
- \setbox\b_page_mix_collected\vbox{\ctxcommand{mixflushlist()}}% we could avoid this
+ \setbox\b_page_mix_collected\vbox{\clf_mixflushlist}% we could avoid this
%writestatus\m!columns{construct balance}%
\page_mix_routine_construct\v!yes
\page_mix_routine_package
@@ -614,16 +653,16 @@
\par
\nointerlineskip
\prevdepth\strutdp
- \ctxcommand{mixflushrest()}% rubish
- \ctxcommand{mixcleanup()}% rubish
+ \clf_mixflushrest% rubish
+ \clf_mixcleanup % rubish
\exitloop
\or
% 1 = we have stuff left, so flush and rebalance
%writestatus\m!columns{flush continue}%
\page_mix_routine_package
\page_otr_construct_and_shipout\box\b_page_mix_collected
- \setbox\b_page_mix_collected\vbox{\ctxcommand{mixflushrest()}}% we could avoid this
- \ctxcommand{mixcleanup()}%
+ \setbox\b_page_mix_collected\vbox{\clf_mixflushrest}% we could avoid this
+ \clf_mixcleanup
\ifdim\ht\b_page_mix_collected=\zeropoint
\exitloop
\fi
@@ -718,8 +757,8 @@
\page_mix_routine_construct\v!yes
\page_mix_routine_package
\dontleavehmode\box\b_page_mix_collected
- \ctxcommand{mixflushrest()}%
- \ctxcommand{mixcleanup()}%
+ \clf_mixflushrest
+ \clf_mixcleanup
\egroup}
%D As usual, floats complicates matters and this is where experimental code
@@ -760,11 +799,11 @@
% \unexpanded\def\page_mix_command_flush_top_insertions
% {\page_one_command_flush_top_insertions}
-% \unexpanded\def\page_mix_place_float_top
-% {\showmessage\m!columns4\empty\page_one_place_float_here}
+\unexpanded\def\page_mix_place_float_top
+ {\showmessage\m!columns4\empty\page_one_place_float_here}
-% \unexpanded\def\page_mix_place_float_bottom
-% {\showmessage\m!columns5\empty\page_one_place_float_here}
+\unexpanded\def\page_mix_place_float_bottom
+ {\showmessage\m!columns5\empty\page_one_place_float_here}
\unexpanded\def\page_mix_place_float_here
{\page_one_place_float_here}