summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/context/base/page-one.mkiv
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/context/base/page-one.mkiv')
-rw-r--r--Master/texmf-dist/tex/context/base/page-one.mkiv598
1 files changed, 331 insertions, 267 deletions
diff --git a/Master/texmf-dist/tex/context/base/page-one.mkiv b/Master/texmf-dist/tex/context/base/page-one.mkiv
index babaf4f5ddb..89fd7d4a8a3 100644
--- a/Master/texmf-dist/tex/context/base/page-one.mkiv
+++ b/Master/texmf-dist/tex/context/base/page-one.mkiv
@@ -5,7 +5,7 @@
%D subtitle=Default Routine,
%D author=Hans Hagen,
%D date=\currentdate,
-%D copyright={PRAGMA / Hans Hagen \& Ton Otten}]
+%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
%C
%C This module is part of the \CONTEXT\ macro||package and is
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
@@ -20,22 +20,21 @@
% OTRONE: basic single column
-\activateotr{ONE}{} % the default one
+\newdimen\d_page_one_saved_vsize
-\newtoks\OTRONEoutput
+\unexpanded\def\page_one_command_next_page
+ {\page_otr_eject_page}
-\def\OTRONEgotonextpage
- {\ejectpage}
+\unexpanded\def\page_one_command_next_page_and_inserts
+ {\page_otr_eject_page_and_flush_inserts}
-\def\OTRONEgotonextpageX % will become obsolete
- {\superejectpage}
-
-\def\OTRONEsethsize
+\unexpanded\def\page_one_command_set_hsize
{\global\hsize\textwidth}
-\newdimen\oldvsize
+\unexpanded\def\page_one_command_set_float_hsize
+ {\global\hsize\textwidth}
-\def\OTRONEsetvsize
+\unexpanded\def\page_one_command_set_vsize
{\ifgridsnapping
\ifcase\layoutlines
\getrawnoflines\textheight
@@ -47,147 +46,180 @@
\global\vsize\textheight
\fi
\ifdim\pagegoal<\maxdimen
- \ifdim\oldvsize=\vsize
+ \ifdim\d_page_one_saved_vsize=\vsize
% let's assume that the layout didn't change
\else
- \bgroup
- \global\oldvsize\vsize
- \advance\vsize-\topinserted
- \advance\vsize-\botinserted
- \global\pagegoal\vsize
- \egroup
+ \global\d_page_one_saved_vsize\vsize
+ \global\pagegoal\dimexpr\vsize-\topinserted-\botinserted\relax
+% \bgroup
+% \global\d_page_one_saved_vsize\vsize
+% \advance\vsize-\topinserted
+% \advance\vsize-\botinserted
+% \global\pagegoal\vsize
+% \egroup
\fi
\fi}
-% can we avoind the extra vboxing here?
+% 1 = partial page, 2 = whole page, 3 = partial page
-\def\OTRONEregisteredtextarea#1%
- {\ifregistertextareas
- \setbox0\vbox{#1}%
- \wd0\makeupwidth % somehow a space creeps in
- \vbox{\registeredtextarea000}%
+\setnewconstant\kindofpagetextareas\plustwo % \plusone can become default some day
+
+\def\page_one_registered_text_area_a % two arguments: (un)vbox n
+ {\ifconditional\c_page_areas_enabled
+ \expandafter\page_one_registered_text_area_a_indeed
\else
- #1%
+ \expandafter\firstofoneargument
\fi}
-\def\doOTRONEregisteredtextareaA#1%
- {\ifregistertextareas
- \xypos{pbd:\realfolio:b}% we could save bytes by only saving the y
- \endgraf
- \begingroup
- \scratchdimen\dimexpr\MPy{pbd:\realfolio:b}-\MPy{pbd:\realfolio:e}\relax
- \setbox\scratchbox\emptyhbox
- \wd\scratchbox\makeupwidth
- \ht\scratchbox\scratchdimen
- \vsmash{\registeredtextarea00\scratchbox}%
- \endgroup
- #1%
- \endgraf
- \xypos{pbd:\realfolio:e}%
+\def\page_one_registered_text_area_b % one arguments: content
+ {\ifconditional\c_page_areas_enabled
+ \expandafter\page_one_registered_text_area_b_indeed
+ \else
+ \expandafter\firstofoneargument
+ \fi}
+
+\def\page_one_registered_text_area_a_indeed % two arguments: (un)vbox n
+ {\ifcase\kindofpagetextareas
+ \expandafter\firstofoneargument
+ \or % partial page (experimental)
+ \expandafter\page_areas_register_direct
+ \or % whole page (default)
+ \expandafter\firstofoneargument
\else
- #1%
+ \expandafter\firstofoneargument
\fi}
-\def\doOTRONEregisteredtextareaB#1%
- {\ifregistertextareas
- \setbox0\vbox{#1}%
- \wd0\makeupwidth % somehow a space creeps in
- \vbox{\registeredtextarea000}%
+\def\page_one_registered_text_area_b_indeed % one arguments: content
+ {\ifcase\kindofpagetextareas
+ % \expandafter\firstofoneargument
+ \or % partial page (experimental)
+ % \expandafter\firstofoneargument
+ \or % whole page (default)
+ \expandafter\page_areas_register_boxed
\else
- #1%
+ % \expandafter\firstofoneargument
\fi}
-\let\OTRONEregisteredtextareaA\firstofoneargument
-\let\OTRONEregisteredtextareaB\firstofoneargument
+\newdimen\d_page_one_natural_depth
+\newbox \b_page_one_bottom_notes
+\newbox \b_page_one_contents
-% 1 = partial page, 2 = whole page, 3 = partial page
+\let\page_one_command_package_show_state\relax
-\setnewconstant\kindofpagetextareas\plustwo
+% \fakepagenotes ... needs checking
+%
+% we can also have bottom notes on top of bottom insertions
-\def\OTRONEdopagecontents#1#2% \box<n> \unvbox<n>
- {\bgroup % niet breedte zetten, kan fractie zijn!
- \ifcase\kindofpagetextareas
- \or % partial page (experimental)
- \let\OTRONEregisteredtextareaA\doOTRONEregisteredtextareaA
- \or % whole page (default)
- \let\OTRONEregisteredtextareaB\doOTRONEregisteredtextareaB
- \or % partial page (only works well with no stretch!)
- \let\OTRONEregisteredtextareaA\doOTRONEregisteredtextareaB
- \fi
- \setbox0\vbox \ifbottomnotes to \textheight \fi
- {\edef\currentpagedepth{\the\dp#2}% still to be derived from #1
- \dotopinsertions
+\unexpanded\def\page_one_command_package_contents#1#2% \box<n> \unvbox<n> % this one will be redone (checked)
+ {\bgroup
+ \strc_notes_check_if_bottom_present
+ \d_page_one_natural_depth\dp#2\relax
+ % we need to set the height as otherwise the shrink will not kick in so the following
+ % no longer applies:
+ %
+ % \setbox\b_page_one_contents\vbox \ifconditional\c_notes_bottom_present to \textheight \fi
+ %
+ \setbox\b_page_one_contents\vbox to \textheight
+ {\page_otr_command_flush_top_insertions
+ % this is messy ... we will provide a more tight area (no big deal as we can
+ % do that at the lua end)
+ \page_one_registered_text_area_a#1#2% \unvbox <box>
+ %
\ifgridsnapping
- \OTRONEregisteredtextareaA{#1#2}%
- \vskip-\currentpagedepth\vskip\openstrutdepth
+ \vskip\dimexpr\openstrutdepth-\d_page_one_natural_depth\relax
\prevdepth\openstrutdepth
- \dobotinsertions
+ \page_otr_command_flush_bottom_insertions
\vfil
- \else\ifr@ggedbottom
- \OTRONEregisteredtextareaA{#1#2}%
- \vskip-\currentpagedepth\vskip\openstrutdepth
+ \else\ifcase\bottomraggednessmode
+ % ragged (default)
+ \vskip\dimexpr\openstrutdepth-\d_page_one_natural_depth\relax
\prevdepth\openstrutdepth
- \dobotinsertions
+ \page_otr_command_flush_bottom_insertions
\vfil
- \else\ifb@selinebottom
- \OTRONEregisteredtextareaA{#1#2}%
- \kern-\currentpagedepth\kern\maxdepth
- \dobotinsertions
- \else
- \OTRONEregisteredtextareaA{#1#2}%
- \dobotinsertions % added
- \fi\fi\fi
- \fakepagenotes}% was \fakenotes, but wrong! (check with \setupalign[height])
- \ifbottomnotes
+ \or
+ % align (normal)
+ \page_otr_command_flush_bottom_insertions
+ \or
+ % baseline
+ \kern\dimexpr\maxdepth-\d_page_one_natural_depth\relax
+ \page_otr_command_flush_bottom_insertions
+ \fi\fi
+ \fakepagenotes}%
+ \page_one_command_package_show_state
+ \ifconditional\c_notes_bottom_present
\ifgridsnapping
- \ifcase\layoutlines % todo: make macro of this
+ \ifcase\layoutlines
\getrawnoflines\textheight
\else
\noflines\layoutlines
- \fi
- \advance\noflines \minusone
- \scratchdimen\noflines\lineheight
- \advance\scratchdimen \topskip
+ \fi
+ \scratchoffset\dimexpr\numexpr\noflines-\plusone\relax\lineheight+\topskip\relax
\else
- \scratchdimen\ht0
+ \scratchoffset\ht\b_page_one_contents
\fi
+ \setbox\b_page_one_bottom_notes\hbox
+ {\checksinglecolumnfootnotes % why this check? ***
+ \lower\scratchoffset\vbox{\placebottomnotes\par\kern\zeropoint}}% kerns makes notes sit on bottom
+ \smashbox\b_page_one_bottom_notes
+ \ht\b_page_one_contents\zeropoint
+ \page_one_registered_text_area_b
+ {\vbox to \textheight
+ {\box\b_page_one_contents
+ \box\b_page_one_bottom_notes}}%
\else
- \scratchdimen\zeropoint
- \fi
- \setbox2\hbox
- {\checksinglecolumnfootnotes
- \lower\scratchdimen\vbox{\placebottomnotes}}%
- \smashbox2% % needed here
- \ifbottomnotes
- \ht0\zeropoint
+ \ht\b_page_one_contents\textheight
+ \page_one_registered_text_area_b
+ {\box\b_page_one_contents}%
\fi
- \OTRONEregisteredtextareaB
- {\vbox to \textheight
- {\box0\box2\ifbottomnotes\else\vfill\fi}}%
\egroup}
-\def\OTRONEfinalsidefloatoutput
- {\finaloutput\unvbox\normalpagebox}
+\unexpanded\def\page_one_command_side_float_output
+ {\page_otr_construct_and_shipout\unvbox\normalpagebox}
-\OTRONEoutput
- {\sidefloatoutput}
+\unexpanded\def\page_one_command_routine
+ {\page_sides_output_routine}
%D Insertions
-\newif\iftopofinsert
+\newconditional\c_page_one_top_of_insert
+\newconditional\c_page_one_correct_top_insert \settrue\c_page_one_correct_top_insert % false moves up (tight)
+\newskip \s_page_one_between_top_insert
+
+\def\page_one_prepare_top_float
+ {\ifdim\topinserted=\zeropoint
+ \settrue\c_page_one_top_of_insert
+ \else
+ \setfalse\c_page_one_top_of_insert
+ \fi
+ \s_page_one_between_top_insert\ifdim\floattopskip>\floatbottomskip\floattopskip\else\floatbottomskip\fi\relax
+ \global\advance\topinserted\dimexpr\ht\floatbox+\dp\floatbox+\s_page_one_between_top_insert\relax}
+
+\def\page_one_insert_top_float % maybe remember last beforeskip
+ {\insert\topins
+ {\forgetall
+ \ifconditional\c_page_one_top_of_insert
+ \ifconditional\c_page_one_correct_top_insert
+ \topskipcorrection % [xx] new: see icare topbleed
+ \kern-\lineskip
+ \par
+ \prevdepth\maxdimen
+ \fi
+ \fi
+ \page_otr_command_flush_float_box
+ \vskip\s_page_one_between_top_insert}}
-\def\OTRONEdosettopinserts
+\unexpanded\def\page_one_command_set_top_insertions
{\bgroup
\ifsomefloatwaiting
\noffloatinserts\zerocount
\let\totaltopinserted\!!zeropoint
- \OTRONEdodosettopinserts
- \ifnum\@@bknbottom=\zerocount
- \ifnum\@@bknlines>\zerocount
+ \page_one_command_set_top_insertions_indeed
+ \ifnum\rootfloatparameter\c!nbottom=\zerocount
+ \ifnum\rootfloatparameter\c!nlines>\zerocount
\ifdim\totaltopinserted>\zeropoint\relax
- \ifdim\dimexpr\@@bknlines\lineheight+\totaltopinserted\relax>\textheight
- \showmessage\m!floatblocks8\@@bknlines
- \vfilll\eject
+ \ifdim\dimexpr\rootfloatparameter\c!nlines\lineheight+\totaltopinserted\relax>\textheight
+ \showmessage\m!floatblocks8{\rootfloatparameter\c!nlines}%
+ \page_otr_fill_and_eject_page % was tripple: vfilll
\fi
\fi
\fi
@@ -195,29 +227,13 @@
\fi
\egroup}
-\def\OTRONEdodosettopinserts
+\def\page_one_command_set_top_insertions_indeed
{\ifnum\noffloatinserts<\noftopfloats
\dogetfloat
- \ifdim\topinserted=\zeropoint
- \topofinserttrue
- \else
- \topofinsertfalse
- \fi
- \global\advance\topinserted\dimexpr\ht\floatbox+\dp\floatbox+\floatbottomskip\relax
+ \page_one_prepare_top_float
\ifdim\topinserted<\textheight\relax
\xdef\totaltopinserted{\the\topinserted}%
- \insert\topins
- {\forgetall
- \iftopofinsert
- \topskipcorrection % [xx] new: see icare topbleed
- \kern-\lineskip\par
- \prevdepth\maxdimen
- \else
- %\blank[-\@@bkspaceafter,\@@bkspacebefore]% inserts can't look back
- \betweenfloatblanko
- \fi
- \flushfloatbox
- \blank[\@@bkspaceafter]}%
+ \page_one_insert_top_float
\ifsomefloatwaiting
\advance\noffloatinserts \plusone
\else
@@ -232,19 +248,19 @@
\ifsomefloatwaiting
\showmessage\m!floatblocks6{\the\noftopfloats}%
\fi
- \let\OTRONEdodosettopinserts\relax
+ \let\page_one_command_set_top_insertions_indeed\relax
\fi
- \OTRONEdodosettopinserts}
+ \page_one_command_set_top_insertions_indeed}
-\def\OTRONEdosetbotinserts
+\unexpanded\def\page_one_command_set_bottom_insertions
{\bgroup
\ifsomefloatwaiting
\noffloatinserts\zerocount
- \OTRONEdodosetbotinserts
+ \page_one_command_set_bottom_insertions_indeed
\fi
\egroup}
-\def\OTRONEdodosetbotinserts
+\def\page_one_command_set_bottom_insertions_indeed
{\ifnum\noffloatinserts<\nofbotfloats\relax
\dogetfloat
\global\advance\botinserted \ht\floatbox\relax
@@ -253,8 +269,8 @@
\ifdim\botinserted<\pagegoal\relax
\insert\botins
{\forgetall
- \blank[\@@bkspacebefore]%
- \flushfloatbox}%
+ \blank[\rootfloatparameter\c!spacebefore]%
+ \page_otr_command_flush_float_box}%
\ifsomefloatwaiting
\advance\noffloatinserts \plusone
\else
@@ -270,24 +286,13 @@
\ifsomefloatwaiting
\showmessage\m!floatblocks7{\the\nofbotfloats}%
\fi
- \let\OTRONEdodosetbotinserts\relax
+ \let\page_one_command_set_bottom_insertions_indeed\relax
\fi
- \OTRONEdodosetbotinserts}
-
-\def\OTRONEdosetbothinserts
- {\global\topinserted\zeropoint
- \global\botinserted\zeropoint
- \ifflushingfloats \else
- \OTRONEdosettopinserts
- \OTRONEdosetbotinserts
- \ifsomefloatwaiting
- \doif\@@bkcache\v!no\doflushfloats
- \fi
- \fi}
+ \page_one_command_set_bottom_insertions_indeed}
\newconstant\topinserttopskipmode % 1 = no topskip
-\def\OTRONEdotopinsertions
+\unexpanded\def\page_one_command_flush_top_insertions
{\ifvoid\topins\else
\ifgridsnapping
\box\topins
@@ -306,7 +311,7 @@
\fi
\global\topinserted\zeropoint}
-\def\OTRONEdobotinsertions
+\unexpanded\def\page_one_command_flush_bottom_insertions
{\ifvoid\botins\else
\ifgridsnapping
% \floatparameter\c!bottombefore
@@ -321,37 +326,40 @@
\global\botinserted\zeropoint
\global\nofloatpermittedfalse}
-\def\OTRONEdoflushfloats
+\unexpanded\def\page_one_command_flush_floats
{\global\flushingfloatstrue
\ifsomefloatwaiting
\par
% if kept, then option and definitely off in gridmode ! ! ! !
% \ifvmode \prevdepth\maxdimen \fi % prevents whitespace; problematic in icare tests
- \OTRONEdodoflushfloats
+ \page_one_command_flush_floats_indeed
\fi
\global\savednoffloats\zerocount
\global\somefloatwaitingfalse
\global\flushingfloatsfalse}
-\def\OTRONEflushfloatbox % nog verder doorvoeren en meer info in marge
+\unexpanded\def\page_one_command_flush_float_box
{\ifcenterfloatbox \ifdim\wd\floatbox<\hsize
\global\setbox\floatbox\hbox to \hsize{\hss\box\floatbox\hss}%
\fi \fi
\snaptogrid\hbox{\iftestfloatbox\ruledhbox\fi{\box\floatbox}}} % was copy
-\def\OTRONEdodoflushfloats % much in common with OTRSET
+\def\page_one_command_flush_floats_indeed % much in common with OTRSET
{\ifsomefloatwaiting
\ifpackflushedfloats
\centerfloatboxfalse % not needed as we do call directly
\dofloatscollect\s!text{\hsize}{1em}%
- \OTRONEsetvsize
+ %% no longer (interferes with footnotes):
+ %%
+ %% \page_one_command_set_vsize % test 2011.06.24.001
+ %%
\global\setbox\floatbox\hbox to \hsize
{\hfil
\dorecurse\nofcollectedfloats
{\ifcase\columndirection % nog document wide
\dofloatsflush\s!text{1}%
\else
- \dofloatsflushn\s!text{\the\numexpr\nofcollectedfloats-\recurselevel+1\relax}%
+ \dofloatsflush\s!text{\the\numexpr\nofcollectedfloats-\recurselevel+1\relax}%
\fi
\ifdim\wd\floatbox>\makeupwidth % \hsize
\hbox to \makeupwidth{\hss\box\floatbox\hss}%
@@ -369,10 +377,23 @@
% fits on a page where it was first rejected, in which case
% the prevdepth is -maxdimen and we cannot obey the grid
\doplacefloatbox
- \expandafter\OTRONEdodoflushfloats
+ \expandafter\page_one_command_flush_floats_indeed
+ \fi}
+
+\unexpanded\def\page_one_command_flush_margin_blocks
+ {\ifconditional\c_page_margin_blocks_present % \ifvoid\b_page_margin_blocks \else
+ \ifdim\pagetotal=\zeropoint
+ \null % \fixedspace
+ \fi
+ \page_otr_command_next_page % \page
+ \ifvoid\b_page_margin_blocks
+ \global\setfalse\c_page_margin_blocks_present
+ \else
+ \doubleexpandafter\page_one_command_flush_margin_blocks
+ \fi
\fi}
-\def\OTRONEdocheckiffloatfits % vervangen ivm downward comp
+\unexpanded\def\page_one_command_check_if_float_fits
{\ifnofloatpermitted
\global\roomforfloatfalse
\else
@@ -404,131 +425,174 @@
\fi
\fi}
-\def\OTRONEflushsavedfloats
- {\dosetbothinserts}
-
-% TODO: TEST FIRST, NO CORRECTION NEEDED IN GRID MODE, EVT OPTION
+\unexpanded\def\page_one_command_flush_saved_floats
+ {\global\topinserted\zeropoint
+ \global\botinserted\zeropoint
+ \ifflushingfloats \else
+ \page_one_command_set_top_insertions
+ \page_one_command_set_bottom_insertions
+ \ifsomefloatwaiting
+ \doif{\rootfloatparameter\c!cache}\v!no\page_one_command_flush_floats % could be _otr_
+ \else\ifconditional\c_page_margin_blocks_present
+ \page_one_command_flush_floats
+ \fi\fi
+ \fi}
-\def\OTRONEsomeherefloat[#1]% spacing between two successive must be better
- {\baselinecorrection % not really needed in grid mode:
- %\ifgridsnapping \else \baselinecorrection \fi % ! ! ! test test test ! ! ! !
+\def\page_one_place_float_here_indeed
+ {%\ifgridsnapping \else
+ \baselinecorrection
+ %\fi
\doplacefloatbox
\doinsertfloatinfo
\dohandlenextfloatindent}
-% \def\OTRONEsomefixdfloat % [#1]
-% {\docheckiffloatfits
-% \ifroomforfloat\else
-% \goodbreak
-% \fi
-% \showmessage\m!floatblocks9\empty
-% \someherefloat} % [#1]
-%
-% better:
-%
-% \dorecurse{50}
-% {[before normal] \input thuan
-% \placefigure{normal}{\framed[height=1cm,width=8cm]{}}
-% \placefigure{normal}{\framed[height=2cm,width=8cm]{}}
-% [before force] \input thuan
-% \placefigure[force]{force}{\framed[height=8cm,width=8cm]{}}}
-
-\setnewconstant\fixedfloatmethod\plusthree
-
-% \def\OTRONEsomefixdfloat % [#1]
-% {\docheckiffloatfits
-% \ifroomforfloat\else
-% \ifzeropt\pagetotal
-% % let's assume that there is room
-% \else
-% \ifcase\fixedfloatmethod
-% % disabled
-% \or % 1 (old method)
-% \goodbreak
-% \or % 2 (safe method)
-% \page
-% \or % 3 (keeps in stream)
-% \vskip\textheight
-% \vskip-\textheight
-% \or % 4 (also keeps in place)
-% \dosomebreak\nobreak
-% \fi
-% \fi
-% \fi
-% \showmessage\m!floatblocks9\empty
-% \someherefloat} % [#1]
-
-\def\OTRONEsomefixdfloat % [#1]
- {% there is (in mkii) no good way to prevent a break
- % so better fail than mess, we can get loose from
- % heads, so be it
- \showmessage\m!floatblocks9\empty
- \OTRONEsomeherefloat} % [#1]
-
-\def\OTRONEsomesidefloat[#1]% links, rechts NOG TESTEN EN AANPASSEN
- {\ifinsidecolumns
- \someelsefloat[\v!here]%
- \else
- %\checkwaitingfloats{#1}%
- \def\logsidefloat
- {\doinsertfloatinfo}%
- \setbox\floatbox\vbox{\box\floatbox}%
- \wd\floatbox\floatwidth
- \processfirstactioninset
- [#1]
- [ \v!left=>\leftfloat {\box\floatbox},
- \v!right=>\rightfloat {\box\floatbox},
- \v!inleft=>\leftmarginfloat {\box\floatbox},
- \v!inright=>\rightmarginfloat{\box\floatbox},
- \v!leftmargin=>\leftmarginfloat {\box\floatbox},
- \v!rightmargin=>\rightmarginfloat{\box\floatbox},
- \v!leftedge=>\leftedgefloat {\box\floatbox},
- \v!rightedge=>\rightedgefloat {\box\floatbox},
- \v!backspace=>\backspacefloat {\box\floatbox},
- \v!cutspace=>\cutspacefloat {\box\floatbox},
- \v!inmargin=>\cutspacefloat {\box\floatbox}]%
- \doifinset\v!tall{#1}\flushsidefloatsafterpar
- \fi}
+\def\page_one_place_float_force
+ {\showmessage\m!floatblocks9\empty
+ \page_one_place_float_here_indeed}
+
+\def\page_one_place_float_side_indeed#1%
+ {\setbox\floatbox\vbox{\box\floatbox}% ? can go
+ \wd\floatbox\floatwidth
+ #1{\box\floatbox}%
+ \doifinset\v!tall\floatlocationmethod\page_sides_flush_floats_after_par}
+
+\def\page_one_place_float_left {\page_one_place_float_side_indeed\page_sides_process_float_left\presetindentation}
+\def\page_one_place_float_right {\page_one_place_float_side_indeed\page_sides_process_float_right}
+\def\page_one_place_float_leftmargin {\page_one_place_float_side_indeed\page_sides_process_float_leftmargin}
+\def\page_one_place_float_rightmargin{\page_one_place_float_side_indeed\page_sides_process_float_rightmargin}
+\def\page_one_place_float_leftedge {\page_one_place_float_side_indeed\page_sides_process_float_leftedge}
+\def\page_one_place_float_rightedge {\page_one_place_float_side_indeed\page_sides_process_float_rightedge}
+\def\page_one_place_float_inmargin {\page_one_place_float_side_indeed\page_sides_process_float_cutspace}
+\def\page_one_place_float_backspace {\page_one_place_float_side_indeed\page_sides_process_float_backspace}
+\def\page_one_place_float_cutspace {\page_one_place_float_side_indeed\page_sides_process_float_cutspace}
+
+%def\page_one_place_float_margin {\page_one_place_float_side_indeed\page_sides_process_float_margin\nonoindentation} % wil be overloaded
+\def\page_one_place_float_margin {\page_margin_blocks_process_float}
+
+\def\page_one_place_float_page {\dofloatssavepagefloat \s!page \floatlocationmethod}
+\def\page_one_place_float_leftpage {\dofloatssavepagefloat \s!leftpage \floatlocationmethod}
+\def\page_one_place_float_rightpage {\dofloatssavepagefloat \s!rightpage\floatlocationmethod}
+\def\page_one_place_float_somewhere {\dofloatssavesomewherefloat\s!somewhere\floatlocationmethod}
+
+\def\page_one_place_float_here {\page_one_place_float_otherwise_here}
+\def\page_one_place_float_auto {\page_one_place_float_otherwise}
+\def\page_one_place_float_top {\page_one_place_float_otherwise\nonoindentation}
+\def\page_one_place_float_bottom {\page_one_place_float_otherwise}
+
+\def\page_one_place_float_otherwise
+ {\doifinsetelse\v!here\floatlocationmethod
+ \page_one_place_float_otherwise_here
+ \page_one_place_float_otherwise_else}
+
+\def\page_one_place_float_otherwise_here
+ {\doifinsetelse\v!always\floatlocationmethod
+ {\page[\v!preference]%
+ \page_otr_command_check_if_float_fits
+ \ifroomforfloat
+ \page_one_place_float_here_indeed
+ \else
+ \showmessage\m!floatblocks9\empty
+ \doreversesavefloat
+ \fi}
+ {\ifsomefloatwaiting
+ \dosavefloat
+ \else
+ \page[\v!preference]%
+ \page_otr_command_check_if_float_fits
+ \ifroomforfloat
+ \page_one_place_float_here_indeed
+ \else
+ \dosavefloat
+ \fi
+ \fi}}
-\def\OTRONEsomepagefloat [#1]{\dofloatssavepagefloat {\s!page} {#1}}
-\def\OTRONEsomeleftpagefloat [#1]{\dofloatssavepagefloat {\s!leftpage} {#1}}
-\def\OTRONEsomerightpagefloat[#1]{\dofloatssavepagefloat {\s!rightpage}{#1}}
+\def\page_one_place_float_otherwise_else
+ {\doifinsetelse\v!always\floatlocationmethod
+ {\page_otr_command_check_if_float_fits
+ \ifroomforfloat
+ \page_one_place_float_auto_top_bottom
+ \else
+ \showmessage\m!floatblocks9\empty
+ \doreversesavefloat
+ \fi}
+ {\page_otr_command_check_if_float_fits
+ \ifroomforfloat
+ \page_one_place_float_auto_top_bottom
+ \else
+ \dosavefloat
+ \fi}}
-%def\OTRONEsomesoemwherefloat[#1]{\dofloatssavesomewherefloat{\s!somewhere}{#1}}
+\def\floatautofactor{.5}
-\def\OTRONEsometopsfloat[#1]%
- {\ifdim\topinserted=\zeropoint
- \topofinserttrue
+\def\page_one_place_float_auto_top_bottom
+ {\ifx\floatmethod\v!auto
+ \ifdim\pagetotal<\floatautofactor\pagegoal % when empty page, maxdimen
+ \page_one_place_float_top_indeed
+ \else
+ \page_one_place_float_bottom_indeed
+ \fi
\else
- \topofinsertfalse
- \fi
- \global\advance\topinserted\dimexpr\ht\floatbox+\dp\floatbox+\floatbottomskip\relax
- \insert\topins
- {\forgetall
- \iftopofinsert
- \topskipcorrection % [xx] new: see icare topbleed
- \kern-\lineskip\par\prevdepth\maxdimen
- \else
- %\blank[-\@@bkspaceafter,\@@bkspacebefore]% inserts can't look back
- \betweenfloatblanko
- \fi
- \flushfloatbox
- \blank[\@@bkspaceafter]}%
+ \ifx\floatmethod\v!top
+ \page_one_place_float_top_indeed
+ \else\ifx\floatmethod\v!bottom
+ \page_one_place_float_bottom_indeed
+ \else
+ \page_one_place_float_here_indeed
+ \fi\fi
+ \fi}
+
+\def\page_one_place_float_top_indeed % maybe remember last beforeskip
+ {\page_one_prepare_top_float
+ \page_one_insert_top_float
\doinsertfloatinfo}
-\def\OTRONEsomebotsfloat[#1]%
+\def\page_one_place_float_bottom_indeed
{\global\advance\botinserted\dimexpr\ht\floatbox+\dp\floatbox+\floattopskip\relax
\insert\botins
{\forgetall
- \blank[\@@bkspacebefore]%
- \flushfloatbox}%
+ \blank[\rootfloatparameter\c!spacebefore]%
+ \page_otr_command_flush_float_box}%
%\global\nofloatpermittedtrue
\doinsertfloatinfo}
-\def\OTRONEsomefacefloat[#1]% untested
- {\startopposite\flushfloatbox\stopopposite}
-
-\def\OTRONEnextcolumn[#1]%
- {}
+\def\page_one_place_float_face % links, rechts, midden, hoog, midden, laag
+ {%\checkwaitingfloats{#1}%
+ \startopposite
+ \page_otr_command_flush_float_box
+ \stopopposite
+ }%\doinsertfloatinfo}
+
+\unexpanded\def\page_one_command_flush_side_floats
+ {\page_sides_flush_floats}
+
+\unexpanded\def\page_one_command_synchronize_side_floats
+ {\page_sides_synchronize_floats}
+
+\defineoutputroutine
+ [\s!singlecolumn]
+ [\s!page_otr_command_routine =\page_one_command_routine,
+ \s!page_otr_command_package_contents =\page_one_command_package_contents,
+ \s!page_otr_command_set_vsize =\page_one_command_set_vsize,
+ \s!page_otr_command_set_hsize =\page_one_command_set_hsize,
+ \s!page_otr_command_next_page =\page_one_command_next_page,
+ \s!page_otr_command_next_page_and_inserts =\page_one_command_next_page_and_inserts,
+ % \s!page_otr_command_synchronize_hsize =\page_one_command_synchronize_hsize,
+ \s!page_otr_command_set_top_insertions =\page_one_command_set_top_insertions,
+ \s!page_otr_command_set_bottom_insertions =\page_one_command_set_bottom_insertions,
+ \s!page_otr_command_flush_top_insertions =\page_one_command_flush_top_insertions,
+ \s!page_otr_command_flush_bottom_insertions=\page_one_command_flush_bottom_insertions,
+ % \s!page_otr_command_set_float_hsize =\page_one_command_set_float_hsize,
+ \s!page_otr_command_check_if_float_fits =\page_one_command_check_if_float_fits,
+ \s!page_otr_command_flush_float_box =\page_one_command_flush_float_box,
+ \s!page_otr_command_synchronize_side_floats=\page_one_command_synchronize_side_floats,
+ \s!page_otr_command_side_float_output =\page_one_command_side_float_output,
+ \s!page_otr_command_flush_floats =\page_one_command_flush_floats,
+ \s!page_otr_command_flush_side_floats =\page_one_command_flush_side_floats,
+ \s!page_otr_command_flush_saved_floats =\page_one_command_flush_saved_floats,
+ \s!page_otr_command_flush_margin_blocks =\page_one_command_flush_margin_blocks
+ ]
+
+% \setupoutputroutine
+% [\s!singlecolumn]
\protect \endinput