diff options
Diffstat (limited to 'Master/texmf-dist/tex/context/base/page-flt.tex')
-rw-r--r-- | Master/texmf-dist/tex/context/base/page-flt.tex | 767 |
1 files changed, 516 insertions, 251 deletions
diff --git a/Master/texmf-dist/tex/context/base/page-flt.tex b/Master/texmf-dist/tex/context/base/page-flt.tex index 67c8013d3cc..a6c39efec22 100644 --- a/Master/texmf-dist/tex/context/base/page-flt.tex +++ b/Master/texmf-dist/tex/context/base/page-flt.tex @@ -13,9 +13,6 @@ \writestatus{loading}{Context OTR Macros / Floating Bodies} -%D This module is currently a mess, due to splitting float -%D handlers over specific otr's. Consider it work in progress. - %D Some of the sidefloat settings should move to page-sid; now it's quite %D fuzzy the way the variables are set/reset. @@ -62,6 +59,7 @@ 10: -- begrensd 11: geen blok opgegeven 12: niet gedefinieerd + 13: er is niets te splitsen \stopmessages \startmessages english library: floatblocks @@ -78,6 +76,7 @@ 10: -- limited 11: no block given 12: undefined + 13: there is nothing to split \stopmessages \startmessages german library: floatblocks @@ -94,6 +93,7 @@ 10: -- begrenzt 11: kein Block gegeben 12: undefiniert + 13: there is nothing to split \stopmessages \startmessages czech library: floatblocks @@ -110,6 +110,7 @@ 10: -- omezeno 11: nedan zadny blok 12: nedefinovano + 13: there is nothing to split \stopmessages \startmessages italian library: floatblocks @@ -126,6 +127,7 @@ 10: -- limitato 11: nessun oggetto specificato 12: non definito + 13: there is nothing to split \stopmessages \startmessages norwegian library: floatblocks @@ -134,14 +136,15 @@ 2: -- lagret 3: -- flyttet 4: -- plassert - 5: rekkefølge tilpasset - 6: maksimalt -- flytblokker øverst + 5: rekkefølge tilpasset + 6: maksimalt -- flytblokker øverst 7: maksimalt -- flytblokker nederst 8: mindre enn -- linjer - 9: rekkefølge endret + 9: rekkefølge endret 10: -- begrenset 11: ingen blokk oppgitt 12: udefinert + 13: there is nothing to split \stopmessages \startmessages romanian library: floatblocks @@ -158,6 +161,24 @@ 10: -- limitat 11: nu este dat nici un bloc 12: nedefinit + 13: there is nothing to split +\stopmessages + +\startmessages french library: floatblocks + title: blocs de flottants + 1: -- renuméroté / -- => -- + 2: -- sauvegardé + 3: -- déplacé + 4: -- placé + 5: ordre adapté + 6: n flottants de haut de page limité à -- + 7: n flottants de bas de page limité à -- + 8: moins de -- lignes + 9: ordre perturbé + 10: -- limité + 11: pas de bloc donné + 12: indéfini + 13: there is nothing to split \stopmessages \def\setupfloats @@ -183,7 +204,7 @@ \def\doemptyblock#1% {\localframed [\??fl#1][\c!frame=\v!on]% - {\getmessage\m!floatblocks{12}}} + {\getmessage\m!floatblocks{12}\empty}} % A complication is that we may have to handle a pagebreak % first, which in turn may issue a (postponed) float. @@ -191,6 +212,16 @@ % we're realy dealing with the float. Some day I'll root out % the global settings. +% \def\docomplexplacefloat[#1][#2]% [#3]#4% +% {\edef\floattype{#1}% +% \doifelsenothing\floattype +% {\let\floattype\v!figure} +% {\doifundefined{\??fl#1\c!default}{\let\floattype\v!figure}}% +% \doifelsenothing{#2} +% {\edef\floatlocation{\getvalue{\??fl\floattype\c!default}}} +% {\edef\floatlocation{#2}}% +% \expanded{\dodocomplexplacefloat[\floattype][\floatlocation]}} + \def\docomplexplacefloat[#1][#2]% [#3]#4% {\edef\floattype{#1}% \doifelsenothing\floattype @@ -199,35 +230,76 @@ \doifelsenothing{#2} {\edef\floatlocation{\getvalue{\??fl\floattype\c!default}}} {\edef\floatlocation{#2}}% - \expanded{\dodocomplexplacefloat[\floattype][\floatlocation]}} + \doifinsetelse\v!split{#2} + {\expanded{\dodocomplexsplitfloat[\floattype][\floatlocation]}} + {\expanded{\dodocomplexplacefloat[\floattype][\floatlocation]}}} + +\def\dodocomplexsplitfloat[#1][#2][#3]#4% + {\splitfloat{\dodocomplexplacefloat[#1][#2][#3]{#4}}} + +\def\flushfloatslist + {\v!left,\v!right,\v!inner,\v!outer,% + \v!backspace,\v!cutspace,% + \v!inleft,\v!inright,\v!inmargin,% + \v!leftmargin,\v!rightmargin,\v!leftedge,\v!rightedge,% + \v!innermargin,\v!outermargin,\v!inneredge,\v!outeredge,% + \v!text,\v!opposite}% \v!page + +% \def\dodocomplexplacefloat[#1][#2][#3]#4% +% {\flushnotes +% \flushsidefloats % here ! +% \ifsomefloatwaiting +% % this was \checkwaitingfloats spread all over +% \doifinsetelse\v!always{#2} +% {\showmessage\m!floatblocks5\empty} +% {\expanded{\doifcommonelse{#2}{\flushfloatslist}}\doflushfloats\donothing}% +% % but which should be done before using box \floatbox +% \fi +% \ifmargeblokken % waarschijnlijk gebroken ! ! ! ! +% \doifinset\v!margin{#2} +% {\endgraf +% \bgroup\everypar{\egroup\the\everypar}% +% \hsize\@@mbwidth}% +% \fi +% \global\insidefloattrue +% \begingroup % ** +% \the\everyinsidefloat +% \let\@@extrafloat\empty +% \presetmorefloatvariables{#2}% +% \dowithnextboxcontent % better a \the\everyfloattoks +% {\setlocalfloathsize +% \getvalue{\??fl#1\c!inner}% +% \fuzzysnappingfalse +% \postponenotes} % new +% {\xdocompletefloat{#1}{#3}{#1}{#2}{#1}{#4}% ** not yet done +% % we need to carry over the par because of side floats +% \doifnotinset\v!text{#2}{\carryoverpar\endgroup}% +% \global\sidefloatdownshift \zeropoint +% \global\sidefloatextrashift\zeropoint +% \ifparfloat +% \doifinset\v!reset{#2}\forgetsidefloats +% \doinhibitblank +% \fi}% better move this to side floats +% \vbox} \def\dodocomplexplacefloat[#1][#2][#3]#4% {\flushnotes -\flushsidefloats % here ! + \flushsidefloats % here ! \ifsomefloatwaiting % this was \checkwaitingfloats spread all over \doifinsetelse\v!always{#2} {\showmessage\m!floatblocks5\empty} - {\doifcommonelse - {#2} - {\v!left,\v!right,\v!inner,\v!outer,% - \v!backspace,\v!cutspace,% - \v!inleft,\v!inright,\v!inmargin,% - \v!leftmargin,\v!rightmargin,\v!leftedge,\v!rightedge,% - \v!innermargin,\v!outermargin,\v!inneredge,\v!outeredge,% - \v!text,\v!opposite}% \v!page - {\doflushfloats} - {}}% + {\expanded{\doifcommonelse{#2}{\flushfloatslist}}\doflushfloats\donothing}% % but which should be done before using box \floatbox \fi - \ifmargeblokken % waarschijnlijk gebroken ! ! ! ! - \doifinset\v!margin{#2} - {\endgraf - \bgroup\everypar{\egroup\the\everypar}% - \hsize\@@mbwidth}% + \ifmargeblokken + \doifinset\v!margin{#2}\endgraf \fi \global\insidefloattrue \begingroup % ** + \ifmargeblokken + \doifinset\v!margin{#2}{\hsize\@@mbwidth}% + \fi \the\everyinsidefloat \let\@@extrafloat\empty \presetmorefloatvariables{#2}% @@ -236,7 +308,11 @@ \getvalue{\??fl#1\c!inner}% \fuzzysnappingfalse \postponenotes} % new - {\xdocompletefloat{#1}{#3}{#1}{#2}{#1}{#4}% ** not yet done + {\doifvaluesomething{\??fl#1\c!criterium} + {\ifdim\wd\nextbox>\getvalue{\??fl#1\c!criterium}\relax + \edef\forcedfloatmethod{\executeifdefined{\??fl#1\c!fallback}\v!here}% + \fi}% + \xdocompletefloat{#1}{#3}{#1}{#2}{#1}{#4}% ** not yet done % we need to carry over the par because of side floats \doifnotinset\v!text{#2}{\carryoverpar\endgroup}% \global\sidefloatdownshift \zeropoint @@ -356,7 +432,7 @@ %\to \everyinsidefloat %\def\doifrightpagefloatelse % watch out: other default ! ! ! -% {\ifdubbelzijdig +% {\ifdoublesided % \ifodd\purenumber\twopassfloatdata\space % \@EAEAEA\firstoftwoarguments % \else @@ -367,8 +443,8 @@ % \fi} \def\doifrightpagefloatelse - {\ifdubbelzijdig - \ifenkelzijdig + {\ifdoublesided + \ifsinglesided \@EAEAEA\firstoftwoarguments \else \@EAEAEA\doifoddfloatpageelse @@ -395,7 +471,7 @@ % new : \place...[leftmargin,-2*line]; we need to catch fxtb:2*3 % watch out: line alone aligns on the line ! ! ! -\def\movesidefloat[#1]% (-)line|x=,y= +\def\movesidefloat[#1]% (-)n*line|x=,y= {\global\sidefloatdownshift \zeropoint \global\sidefloatextrashift\zeropoint \doifassignmentelse{#1}% @@ -416,17 +492,26 @@ \cleanupfeatures \doifinstringelse{:}{#1} \donothing - {\donefalse - \def\movedownsidefloat##1% + {\def\docommand##1% {\processaction [##1]% - [ \v!line=>\docommando+,% - +\v!line=>\docommando+,% - -\v!line=>\docommando-]}% - \def\docommando##1% + [ \v!line=>\dodocommand+,% + +\v!line=>\dodocommand+,% + -\v!line=>\dodocommand-]}% + \def\dodocommand##1% {\ifdone\else\global\sidefloatdownshift\zeropoint\donetrue\fi \global\advance\sidefloatdownshift##1\lineheight}% - \expanded{\dorepeatwithcommand[#1]}\movedownsidefloat}% + \donefalse\expanded{\dorepeatwithcommand[#1]}\docommand + \def\docommand##1% + {\processaction + [##1]% + [ \v!hang=>\dodocommand+,% + +\v!hang=>\dodocommand+,% + -\v!hang=>\dodocommand-]}% + \def\dodocommand##1% inefficient but who cares + {\ifdone\else\global\sidefloatsidelines\zeropoint\donetrue\fi + \global\advance\sidefloatsidelines\plusone\relax}% + \donefalse\expanded{\dorepeatwithcommand[#1]}\docommand}% \egroup} \def\hangsidefloat[#1]% @@ -442,17 +527,18 @@ % already be set at this point \processallactionsinset [#4] % ininner/inouter : for old times sake - [ \v!inner=>\xxdocompletefloat\v!left \v!right, - \v!outer=>\xxdocompletefloat\v!right \v!left, + [ \v!inner=>\xxdocompletefloat\v!left \v!right, + \v!outer=>\xxdocompletefloat\v!right \v!left, \v!innermargin=>\xxdocompletefloat\v!leftmargin \v!rightmargin, \v!outermargin=>\xxdocompletefloat\v!rightmargin\v!leftmargin, - \v!inneredge=>\xxdocompletefloat\v!leftedge \v!rightedge, - \v!outeredge=>\xxdocompletefloat\v!rightedge \v!leftedge, - \v!backspace=>\xxdocompletefloat\v!backspace \v!cutspace, - \v!cutspace=>\xxdocompletefloat\v!cutspace \v!backspace, - \v!left=>\xxdocompletefloat\v!left \v!left, - \v!right=>\xxdocompletefloat\v!right \v!right, - \v!line=>, % only -n*line is handled (see ***) + \v!inneredge=>\xxdocompletefloat\v!leftedge \v!rightedge, + \v!outeredge=>\xxdocompletefloat\v!rightedge \v!leftedge, + \v!backspace=>\xxdocompletefloat\v!backspace \v!cutspace, + \v!cutspace=>\xxdocompletefloat\v!cutspace \v!backspace, +% \v!margin=>\xxdocompletefloat\v!cutspace \v!backspace, + \v!left=>\xxdocompletefloat\v!left \v!left, + \v!right=>\xxdocompletefloat\v!right \v!right, + \v!line=>, % only -n*line is handled (see ***) \s!unknown=>{\movedownsidefloat[\commalistelement]}]% \ifx\@@extrafloat\empty \docompletefloat{#1}{#2}{#3}{#4}{#5}{#6}\nextbox @@ -528,12 +614,14 @@ \dododefinefloat[#1][#1]% \fi\fi} +% todo: \floatparameter + \currentfloat - saves many hash entries + \def\dododefinefloat[#1][#2]% {\presetlocalframed[\??fl#1]% \setupfloat [#1] - [\c!width=8\lineheight, % 15\korpsgrootte, - \c!height=6\lineheight, % 10\korpsgrootte, + [\c!width=8\lineheight, % 15\bodyfontsize, + \c!height=6\lineheight, % 10\bodyfontsize, \c!minwidth=, \c!maxwidth=, \c!maxheight=, @@ -584,6 +672,8 @@ \c!sectionnumber=\@@kjsectionnumber, \c!distance=\@@kjdistance, \c!separator=\@@kjseparator, + \c!stopper=\@@kjstopper, + \c!suffix=\@@kjsuffix, % hook \c!command=\@@kjcommand, \c!conversion=\@@kjconversion]% \definenumber % \definelabel @@ -595,6 +685,7 @@ \c!sectionnumber=\getvalue{\??kj#1\c!sectionnumber}, \c!conversion=\getvalue{\??kj#1\c!conversion}]% \presetlabeltext[#1=\Word{#1}~]% + \checkfloatracer{\v!float#1}% \dodefinefloatcommands[#1][#2]} \def\dodefinefloatcommands[#1][#2]% @@ -631,7 +722,7 @@ \c!width,\c!headstyle,\c!headcolor,\c!style,\c!color, \c!textstyle,\c!textcolor,\c!minwidth, \c!align,\c!number,\c!way,\c!blockway, - \c!sectionnumber,\c!separator,\c!distance,\c!conversion]% + \c!sectionnumber,\c!separator,\c!stopper,\c!suffix,\c!distance,\c!conversion]% \definenumber[#1][#3]% \presetlabeltext[#1=\labeltext{#3}]% \dodefinefloatcommands[#1][#2]} @@ -679,6 +770,7 @@ \def\dosavefloatdata % \expanded {\bgroup + \doglobal\increment\noffloatdata \edef\dosavefloatdata {\writeutilitycommand {\twopassentry @@ -700,48 +792,108 @@ % Er wordt bij \v!altijd als dat nodig is hernummerd. % Daarbij wordt gebruik gemaakt van de opgeslagen nummers en % volgorde. - -\definetwopasslist\s!float - -% \def\dofloatreference -% {\doglobal\increment\numberedfloat -% \edef\dodofloatreference -% {\writeutilitycommand -% {\twopassentry -% {\s!float}% -% {\numberedfloat}% -% {\hetnummer}}}% -% \dodofloatreference} - +% +% replaced code: +% +% \definetwopasslist\s!float +% +% \def\dofloatreference#1% +% {\doifnot\@@bknumbering\v!nocheck +% {\doglobal\increment\numberedfloat +% \doifelse\@@bknumbering\v!text % alternative to yes|page +% {\let\next\immediatewriteutilitycommand} +% {\let\next\writeutilitycommand}% +% \expanded{\next +% {\noexpand\twopassentry +% {\s!float}% +% {\numberedfloat}% +% {\composedsectionnumber}}}}} +% % \def\redofloatorder#1% -% {\doglobal\increment\nofplacedfloats\relax -% \gettwopassdata\s!float -% \iftwopassdatafound -% \doifnot\hetnummer\twopassdata -% {\edef\oldhetnummer{\hetnummer}% -% \xdef\hetnummer{\twopassdata}% -% \showmessage\m!floatblocks1{\nofplacedfloats,#1 \oldhetnummer,\hetnummer}}% -% \fi} +% {\doifnot\@@bknumbering\v!nocheck +% {\doglobal\increment\nofplacedfloats\relax +% \gettwopassdata\s!float +% \iftwopassdatafound +% \doifnot\composedsectionnumber\twopassdata +% {\edef\oldcomposedsectionnumber{\composedsectionnumber}% +% \xdef\composedsectionnumber{\twopassdata}% +% \showmessage\m!floatblocks1{\nofplacedfloats,#1 \oldcomposedsectionnumber,\composedsectionnumber}}% +% \fi}} +% +% \def\preparefloatnumber#1% +% {\incrementnumber[#1]% +% \makesectionnumber[#1]} +% +% \def\tracefloatnumber#1% +% {\dofloatreference{#1}% +% \redofloatorder{#1}} +% +% \def\checkfloatracer#1% +% {} -\def\dofloatreference - {\doifnot\@@bknumbering\v!nocheck - {\doglobal\increment\numberedfloat - \expanded{\writeutilitycommand - {\noexpand\twopassentry - {\s!float}% - {\numberedfloat}% - {\hetnummer}}}}} - -\def\redofloatorder#1% +\def\checkfloatracer#1% + {\newnodelocation{#1}} + +\def\tracefloatnumber#1% {\doifnot\@@bknumbering\v!nocheck - {\doglobal\increment\nofplacedfloats\relax - \gettwopassdata\s!float - \iftwopassdatafound - \doifnot\hetnummer\twopassdata - {\edef\oldhetnummer{\hetnummer}% - \xdef\hetnummer{\twopassdata}% - \showmessage\m!floatblocks1{\nofplacedfloats,#1 \oldhetnummer,\hetnummer}}% + {\checkfloatracer{\v!float#1}% will go + \tagnodelocation{\v!float#1}}} + +\newconditional\retainfloatnumber + +\def\preparefloatnumber#1% + {\xdef\floatcaptionnumber{#1}% + \doifelse\@@bknumbering\v!nocheck + {\incrementnumber[#1]% + \makesectionnumber[#1]% + \ifconditional\retainfloatnumber\decrementnumber[#1]\fi} + {\ifinsidecolumns + \chardef\nodelocationmode\zerocount + % to be perfected: + % \chardef\nodelocationmode\plustwo + \fi + \ifcase\nodelocationmode + \incrementnumber[#1]% + \makesectionnumber[#1]% + \ifconditional\retainfloatnumber\decrementnumber[#1]\fi + \else + % force check, so that we get a proper way-sync and + % can use the accumulated number + % \checknumber[#1]% \incrementnumber does this + \incrementnumber[#1]% + \savenumber[#1]% + % the real work is done here + \checkfloatracer{\v!float#1}% will go + \nextnodelocation{\v!float#1}% better \nextfloatnumber + \analyzenodelocation{\v!float#1}% + \scratchcounter\getnodelocationo{\v!float#1}% + \advance\scratchcounter\minusone + % here we correct for 'per whatever handling' + \advance\scratchcounter-\accumulatednumber[#1]% + \setnumber[#1]\scratchcounter + \incrementnumber[#1]% + \makesectionnumber[#1]% + \restorenumber[#1]% + % now we're back to normal numbering \fi}} + +%D test case: +%D +%D \starttyping +%D \setupfloat[figure][criterium=\marginwidth,fallback=bottom] +%D \dorecurse{3}{ +%D \chapter{test} +%D \placefigure[bottom]{1}{\framed{bottom}} +%D test +%D \placetable[bottom]{1}{\framed{table}} +%D test +%D \placetable{2}{\framed{table}} +%D test +%D \placefigure[left]{2}{\framed{left but way too wide}} +%D \input tufte +%D \placefigure[left]{3}{\framed{left but ok}} +%D \input tufte } +%D \stoptyping % In \dofloatinfomessage wordt {{ }} gebruikt omdat anders % binnen \startpostponing...\stoppostponing geen goede @@ -766,6 +918,29 @@ \def\doinsertfloatinfo {\dofloatinfomessage<4{\the\totalnoffloats}} +% \def\dogetfloat +% {\ifsomefloatwaiting +% \global\setbox\floatlist\vbox +% {\unvbox\floatlist +% \global\setbox\globalscratchbox\lastbox}% +% \ifcenterfloatbox +% \ifdim\wd\globalscratchbox<\hsize +% \setbox\floatbox\hbox to \hsize{\hss\box\globalscratchbox\hss}% +% \else +% \setbox\floatbox\box\globalscratchbox % local ! +% \fi +% \else +% \setbox\floatbox\box\globalscratchbox % local ! +% \fi +% \global\advance\savednoffloats \minusone +% \ifcase\savednoffloats +% \global\somefloatwaitingfalse +% \fi +% \else +% \global\savednoffloats\zerocount +% \global\setbox\floatbox\box\voidb@x +% \fi} + \def\dogetfloat {\ifsomefloatwaiting \global\setbox\floatlist\vbox @@ -776,6 +951,12 @@ \setbox\floatbox\hbox to \hsize{\hss\box\globalscratchbox\hss}% \else \setbox\floatbox\box\globalscratchbox % local ! + % retain special alignments + \ifinsidecolumns + \ifdim\wd\floatbox>\makeupwidth + \wd\floatbox\makeupwidth + \fi + \fi \fi \else \setbox\floatbox\box\globalscratchbox % local ! @@ -839,6 +1020,8 @@ \global\somefloatwaitingtrue \dosavefloatinfo} +% better (todo): \savednofsavedfloats + \def\dosavefloatstatus {\global\setbox\savedfloatlist\copy\floatlist \global\setbox\savedfloatbox \copy\floatbox @@ -852,6 +1035,45 @@ \ifx\doflushfloats\undefined \let\doflushfloats\relax \fi \ifx\flushfloatbox\undefined \let\flushfloatbox\relax \fi +% needed in the splitter: + +\newcount\savedsavednoffloats + +\let\dopopsavedfloats\relax + +\def\dopushsavedfloats + {\global\setbox\savedfloatlist\box\floatlist + \global\savedsavednoffloats\savednoffloats + \global\savednoffloats\savednoffloats + \global\somefloatwaitingfalse + \gdef\dopopsavedfloats + {\global\advance\savednoffloats\savedsavednoffloats + \global\setbox\floatlist\vbox\bgroup + \ifvoid\floatlist \else\unvbox\floatlist \fi + \ifvoid\savedfloatlist\else\unvbox\savedfloatlist\fi + \egroup + \global\ifcase\savednoffloats + \somefloatwaitingfalse\else\somefloatwaitingtrue\fi + \globallet\dopopsavedfloats\relax}} + +\def\doflushsavedfloats % simplified \OTRONEdodoflushfloats + {\doloop + {\ifsomefloatwaiting + \dogetfloat + \dofloatflushedinfo + \docheckiffloatfits + \ifroomforfloat + \doplacefloatbox + \else + \doreversesavefloat + \exitloop + \fi + \else + \exitloop + \fi}} + +% top and bottom + \newif\iftopofinsert \newif\iftestfloatbox \newif\ifcenterfloatbox \centerfloatboxtrue @@ -866,7 +1088,7 @@ \setbox0\vbox{\strut\blank[\@@bkspacebefore]\strut}% \setbox2\vbox{\strut\blank[\@@bkspaceafter ]\strut}% \ifdim\ht0>\ht2 - \blank[-\@@bkspaceafter,\@@bkspacebefore] + \blank[-\@@bkspaceafter,\@@bkspacebefore]% \fi \egroup} @@ -889,16 +1111,35 @@ % brr, wordt deze niet overladen in page-one? weg er mee -\def\somepagefloat[#1]% links, rechts, midden, hoog, midden, laag - {%\checkwaitingfloats{#1}% - \global\setbox\collectedpagefloats\vbox - {\unvbox\collectedpagefloats - \vbox to \textheight - {\doifnotinset\v!high{#1}\vfill - \box\floatbox - \doifnotinset\v!low{#1}\vfill}% - \goodbreak}% - \doinsertfloatinfo} +% \def\somepagefloat[#1]% links, rechts, midden, hoog, midden, laag +% {%\checkwaitingfloats{#1}% +% \global\setbox\collectedpagefloats\vbox +% {\unvbox\collectedpagefloats +% \vbox to \textheight +% {\doifnotinset\v!high{#1}\vfill +% \box\floatbox +% \doifnotinset\v!low{#1}\vfill}% +% \goodbreak}% +% \doinsertfloatinfo} + +% \def\OTRONEsomepagefloat[#1]% +% {%\checkwaitingfloats{#1}% +% \global\setbox\collectedpagefloats\vbox +% {\ifvoid\collectedpagefloats\else\unvbox\collectedpagefloats\fi +% \vbox to \textheight % vss and unvbox catch too high and limited floats +% {\vss +% \doifnotinset\v!high{#1}\vfill +% \unvbox\floatbox +% \doifnotinset\v!low{#1}\vfill +% \vss}% +% \goodbreak}% +% \doinsertfloatinfo} + +% test case: +% +% \placefigure[page,none]{}{\blackrule[width=\textwidth,height=0.9\textheight,color=green]} +% \placefigure[page,none]{}{\blackrule[width=\textwidth,height=1.0\textheight,color=green]} +% \placefigure[page,none]{}{\blackrule[width=\textwidth,height=1.1\textheight,color=green]} \def\sometextfloat[#1]% lang, links, rechts, hoog, midden, laag, offset {%\checkwaitingfloats{#1}% @@ -957,7 +1198,7 @@ {\doifinset\v!offset{#1}{\whitespace\blank}% \box\floattext \vfill}}}% - \doifinsetelse\v!right{#1}% + \doifinsetelse\v!right{#1}% \floatmethod {\setbox\floatbox\hbox to \hsize {\box\floattext \hfill @@ -1006,31 +1247,45 @@ {\doifinsetelse\v!always{#1} {\docheckiffloatfits \ifroomforfloat - \doifinsetelse\v!top{#1} - {\placesometopsfloat[#1]} - {\doifinsetelse\v!bottom{#1} - {\placesomebotsfloat[#1]} - {\placesomeherefloat[#1]}}% - % more compact and efficient, but quite ugly - % \doifinsetelse\v!top{#1} - % \placesometopsfloat - % {\doifinsetelse\v!bottom{#1} - % \placesomebotsfloat - % \placesomeherefloat}[#1]% + \sometopbottomfloat[#1] \else \showmessage\m!floatblocks9\empty \doreversesavefloat \fi} {\docheckiffloatfits \ifroomforfloat - \doifinsetelse\v!top{#1} - {\placesometopsfloat[#1]} - {\doifinsetelse\v!bottom{#1} - {\placesomebotsfloat[#1]} - {\placesomeherefloat[#1]}}% + \sometopbottomfloat[#1] \else \dosavefloat \fi}}} + +\def\floatautofactor{.5} + +% \def\sometopbottomfloat[#1]% +% {\doifinsetelse\v!auto{#1} +% {\ifdim\pagetotal<\floatautofactor\pagegoal % when empty page, maxdimen +% \placesometopsfloat[#1]% +% \else +% \placesomebotsfloat[#1]% +% \fi} +% {\doifinsetelse\v!top{#1} +% {\placesometopsfloat[#1]} +% {\doifinsetelse\v!bottom{#1} +% {\placesomebotsfloat[#1]} +% {\placesomeherefloat[#1]}}}} + +\def\sometopbottomfloat[#1]% + {\doifelse\floatmethod\v!auto + {\ifdim\pagetotal<\floatautofactor\pagegoal % when empty page, maxdimen + \placesometopsfloat[#1]% + \else + \placesomebotsfloat[#1]% + \fi} + {\doifelse\floatmethod\v!top + {\placesometopsfloat[#1]} + {\doifelse\floatmethod\v!bottom + {\placesomebotsfloat[#1]} + {\placesomeherefloat[#1]}}}} % De onderstaande macro wordt gebruikt bij de macros % voor het plaatsen van tabellen en figuren (klopt niet @@ -1133,23 +1388,17 @@ \letgvalue{@fl@r@#1}\relax \letgvalue{@fl@t@#1}\relax \else - \incrementnumber[#1]% - \makesectionnumber[#1]% - % \globallet\flhetnummer\hetnummer % beware, not unique should be done on a per class base - \letgvalue{@fl@n@#1}\hetnummer + \preparefloatnumber{#1}% + \letgvalue{@fl@n@#1}\composedsectionnumber % indirect macro can be more efficient \setgvalue{@fl@r@#1}% - {\dofloatreference - \redofloatorder{#1}% - % \dowritetolist{#1}{\flhetnummer}{#3}{#1}% + {\tracefloatnumber{#1}% \dowritetolist{#1}{\getvalue{@fl@n@#1}}{#3}{#1}% \doglobal\convertargument#3\to\flasciititle % \asciititle is global - % \doifsomething{#2}{\rawreference\s!flt{#2}{{\flhetnummer}{\flasciititle}}}% \doifsomething{#2}{\rawreference\s!flt{#2}{{\getvalue{@fl@n@#1}}{\flasciititle}}}% \letgvalue{@fl@r@#1}\relax}% nils \setgvalue{@fl@t@#1}% - % {\preparethenumber{\??kj#1}\flhetnummer\preparednumber - {\preparethenumber{\??kj#1}{\getvalue{@fl@n@#1}}\preparednumber + {\preparefullnumber{\??kj#1}{\getvalue{@fl@n@#1}}\preparednumber \doattributes{\??kj#1}\c!style\c!color {\doattributes{\??kj#1}\c!headstyle\c!headcolor {\labeltexts{#1}{\preparednumber}}% @@ -1158,6 +1407,7 @@ \fi} \def\placefloatcaptiontext [#1]{\getvalue{@fl@t@#1}} +\def\placefloatcaptionnumber [#1]{\getvalue{@fl@n@#1}} \def\placefloatcaptionreference[#1]{\getvalue{@fl@r@#1}} % still needed for uguide @@ -1179,37 +1429,15 @@ % \floatparameter -% \def\putcompletecaption#1#2#3#4% -% {\noindent -% \xdef\lastcaptiontag{\strut#2\floatcaptionsuffix}% -% \xdef\floatcaptionnumber{#1}% -% \dostartattributes{\??kj#1}\c!style\c!color\empty -% \ifnofloatnumber -% \else -% \hbox{\doattributes{\??kj#1}\c!headstyle\c!headcolor{\strut#2\floatcaptionsuffix}}% -% \ifnofloatcaption \else \ifemptyfloatcaption \else -% \ifcase#4\relax -% \scratchskip\@@kjkjdistance\relax -% \dotfskip\scratchskip\emergencystretch.5\scratchskip -% \else -% \ifx\@@kjkjinbetween\empty\else\unskip\@@kjkjinbetween\fi -% \fi -% \fi \fi -% \fi -% \ifnofloatcaption \else -% \doattributes{\??kj#1}\c!textstyle\c!textcolor -% {\begstrut#3\endstrut\endgraf}% -% \fi -% \dostopattributes} - \def\putcompletecaption#1#2#3#4% {\noindent - \xdef\lastcaptiontag{\strut#2\floatcaptionsuffix}% - \xdef\floatcaptionnumber{#1}% +% \xdef\lastcaptiontag{\strut#2\floatcaptionsuffix}% + \xdef\lastcaptiontag{\strut#2}% +% \xdef\floatcaptionnumber{#1}% \dostartattributes{\??kj#1}\c!style\c!color\empty \ifnofloatnumber \else - \hbox{\doattributes{\??kj#1}\c!headstyle\c!headcolor{\strut#2\floatcaptionsuffix}}% + \hbox{\doattributes{\??kj#1}\c!headstyle\c!headcolor{\strut#2}}% \ifnofloatcaption \else \ifemptyfloatcaption \else \ifcase#4\relax \scratchskip\@@kjkjdistance\relax @@ -1314,7 +1542,7 @@ \def\addlocalbackgroundtobox{\resetglobal\gobbleoneargument}% \fi -\def\captionminwidth {15\korpsgrootte} +\def\captionminwidth {15\bodyfontsize} \def\captionovershoot {2em} \def\dopreparenocaption#1#2#3#4% @@ -1358,7 +1586,8 @@ % float is wider than \hsize \dosetraggedvbox\@@kjkjalign \setbox\scratchbox\raggedbox % trial run - {\hsize\captionhsize + {\trialtypesettingtrue + \hsize\captionhsize \notesenabledfalse \putcompletecaption{#4}{#2}{#3}{0}}% \ifdim\ht\scratchbox>\lineheight % more lines @@ -1382,7 +1611,8 @@ \edef\captionhsize{\the\scratchdimen}% \fi \setbox\scratchbox\vbox % test with overshoot - {\scratchdimen\captionhsize + {\trialtypesettingtrue + \scratchdimen\captionhsize \advance\scratchdimen \captionovershoot \advance\scratchdimen 3em % an average word length \ifdim\scratchdimen<\hsize \hsize\scratchdimen \fi @@ -1522,14 +1752,19 @@ % % {\hfill\box\floatbox\hfill}} % geen \hss, gaat mis in kolommen ! % {\hss \box\floatbox\hss }} % wel \hss, anders mis in colset +\chardef\postcenterfloatmethod\plusone + \def\postcenterfloatbox#1% - {\scratchdimen \ifinsidecolumns - \ifpostponecolumnfloats\makeupwidth\else#1\fi - \else\ifdim#1>\hsize - \hsize - \else - \wd\floatbox - \fi\fi + {\scratchdimen + \ifcase\postcenterfloatmethod + #1% \wd\floatbox + \or\ifinsidecolumns + \ifpostponecolumnfloats\makeupwidth\else#1\fi + \else\ifdim#1>\hsize + \hsize + \else + \wd\floatbox + \fi\fi\fi \global\setbox\floatbox\hbox to \scratchdimen % {\hfill\box\floatbox\hfill}} % geen \hss, gaat mis in kolommen ! % {\hss \box\floatbox\hss }} % wel \hss, anders mis in colset @@ -1607,6 +1842,7 @@ \edef\@@kjkjminwidth {\getvalue{\??kj#4\c!minwidth}}% in geval van automatisch \edef\@@kjkjdistance {\getvalue{\??kj#4\c!distance}}% \edef\@@kjkjalign {\getvalue{\??kj#4\c!align}}% + \def\@@kjkjstopper {\getvalue{\??kj#4\c!stopper}}% \edef\@@flfllocation {\getvalue{\??fl#4\c!location}}% \ifparfloat \@EA\dosetparfloat % {#1}{#2}{#3}{#4}% @@ -1640,16 +1876,21 @@ \newcounter\noxfloatlocations +% \long\def\dofloat#1#2#3#4% +% {\dosetfloatbox{#1}{#2}{#3}{#4}% +% \doifelsevaluenothing{\??fl#4\c!criterium} +% {\dogetfloatbox{#1}\empty} +% {\ifdim\wd\floatbox>\getvalue{\??fl#4\c!criterium}\relax +% \postcenterfloatbox{\wd\floatbox}% else we get left aligned +% %dogetfloatbox{#1}\v!here % see details/pascal +% \dogetfloatbox{#1}{\executeifdefined{\??fl#4\c!fallback}\v!here}% +% \else +% \dogetfloatbox{#1}\empty +% \fi}} + \long\def\dofloat#1#2#3#4% {\dosetfloatbox{#1}{#2}{#3}{#4}% - \doifelsevaluenothing{\??fl#4\c!criterium} - {\dogetfloatbox{#1}\empty} - {\ifdim\wd\floatbox>\getvalue{\??fl#4\c!criterium}\relax - \postcenterfloatbox{\wd\floatbox}% else we get left aligned - \dogetfloatbox{#1}\v!here % see details/pascal - \else - \dogetfloatbox{#1}\empty - \fi}} + \dogetfloatbox{#1}\empty} \let\naturalfloatheight\!!zeropoint \let\naturalfloatwidth \!!zeropoint @@ -1660,6 +1901,51 @@ \xdef\naturalfloatwidth {\the\wd#1}% \xdef\naturalfloatdepth {\the\dp#1}} +% \long\def\docompletefloat#1#2#3#4#5#6#7% #7 = box number +% {%\flushsidefloats % moved +% \presetfloatvariables{#1}{#4}{#2}{#6}% +% \bgroup +% \setnaturalfloatdimensions#7% +% \global\setbox\floatbox\vbox +% {\executeifdefined{\??fl#1\c!command}\firstofoneargument{\box#7}}% +% \setnaturalfloatdimensions\floatbox +% \dimen0 \ht\floatbox +% \advance\dimen0 \dp\floatbox +% \ifdim\dimen0=\zeropoint +% \showmessage\m!floatblocks{11}\empty +% \global\setbox\floatbox\vbox{\doemptyblock{#3}}% +% \fi +% \ifnofloatcaption +% \global\setbox\floatbox\vbox +% {\unvbox\floatbox +% \vss % gets rid of the depth (unless tabulate) +% \rawpagereference\s!flt{#2}}% +% \egroup +% \dofloat{#4}{}{#6}{#1}% +% \else +% \doglobal\convertargument#6\to\asciititle % \asciititle is global +% \ifnofloatnumber +% \global\setbox\floatbox\vbox +% {\unvbox\floatbox % no \vss, keep the depth +% \rawreference\s!flt{#2}{{}{\asciititle}}}% +% \egroup +% \dofloat{#4}{}{#6}{#1}% +% \else +% \incrementnumber[#1]% +% \makesectionnumber[#1]% +% \global\setbox\floatbox\vbox +% {\unvbox\floatbox % no \vss, keep the depth +% \dofloatreference +% \redofloatorder{#1}% +% \rawreference\s!flt{#2}{{\composedsectionnumber}{\asciititle}}% +% \dowritetolist{#3}{\composedsectionnumber}{#6}{#3}}% +% \egroup +% \preparefullnumber{\??kj#1}\composedsectionnumber\preparednumber +% \dofloat{#4}{\labeltexts{#5}{\preparednumber}}{#6}{#1}% +% \fi +% \fi +% \global\insidefloatfalse} + \long\def\docompletefloat#1#2#3#4#5#6#7% #7 = box number {%\flushsidefloats % moved \presetfloatvariables{#1}{#4}{#2}{#6}% @@ -1690,16 +1976,14 @@ \egroup \dofloat{#4}{}{#6}{#1}% \else - \incrementnumber[#1]% - \makesectionnumber[#1]% + \preparefloatnumber{#1}% \global\setbox\floatbox\vbox {\unvbox\floatbox % no \vss, keep the depth - \dofloatreference - \redofloatorder{#1}% - \rawreference\s!flt{#2}{{\hetnummer}{\asciititle}}% - \dowritetolist{#3}{\hetnummer}{#6}{#3}}% + \tracefloatnumber{#1}% + \rawreference\s!flt{#2}{{\composedsectionnumber}{\asciititle}}% + \dowritetolist{#3}{\composedsectionnumber}{#6}{#3}}% \egroup - \preparethenumber{\??kj#1}\hetnummer\preparednumber + \preparefullnumber{\??kj#1}\composedsectionnumber\preparednumber \dofloat{#4}{\labeltexts{#5}{\preparednumber}}{#6}{#1}% \fi \fi @@ -1866,14 +2150,35 @@ % \ifinpostponing: handhaven, want gebruikt in stijlen ! ! ! ! ! +\def\flushpagefloats + {\doifoddpageelse + {\ifvoid\collectedleftpagefloats + \ifvoid\collectedrightpagefloats\else + \unvbox\collectedrightpagefloats + \page + %\the\everytopofpage + \fi + \fi} + {\ifvoid\collectedleftpagefloats\else + \unvbox\collectedleftpagefloats + \page + %\the\everytopofpage + \fi + \ifvoid\collectedrightpagefloats\else + \unvbox\collectedrightpagefloats + \page + %\the\everytopofpage + \fi}% + \ifvoid\collectedpagefloats\else + % message + \unvbox\collectedpagefloats + \fi} + \def\dopostponeblock {\bgroup % new may 2004 \setsystemmode\v!postponing % new may 2004 \the\everytopofpage - \ifvoid\collectedpagefloats\else - % message - \unvbox\collectedpagefloats - \fi + \flushpagefloats \donefalse \ifinpostponing \else \ifcase\nofpostponedblocks \else \donetrue \fi @@ -1926,56 +2231,6 @@ \dostartbuffer[pbuf-\nofpostponedblocks]% [\e!start\v!postponing][\e!stop\v!postponing]} -\definenumber - [\??si] - [\c!way=\v!by\v!text, - \c!conversion=\@@siconversion] - -\def\setupfloatsplitting - {\dodoubleargument\getparameters[\??si]} - -% ook (continued) - -\def\dosplitfloat[#1]#2% nog dubbele refs - {\ifinsidecolumns % tzt ook nog figuren splitten - % not yet supported - \else - \bgroup - \insidefloattrue - \getparameters[\??si][#1]% - \resetnumber[\??si]% - \def\floatcaptionsuffix{\convertednumber[\??si]}% - \TABLEcaptionheight\@@silines\lineheight % brrr - \simplifypagebreak % \page becomes \goodbreak - \dowithnextbox - {\forgetall - \dontcomplain - \doloop - {\setbox2\vsplit\nextbox to \lineheight - \setbox2\vbox{\unvbox2} - \ifdim\ht2>\lineheight - \incrementnumber[\??si]% - \ifcase\rawnumber[\??si]\or \ifdim\nextboxht=\zeropoint - \let\floatcaptionsuffix\empty - \fi \fi - \bgroup - #2{\unvbox2} - \egroup - \ifdim\nextboxht>\zeropoint - \page - \decrementnumber[\floatcaptionnumber]% - \fi - \fi - \ifdim\nextboxht>\zeropoint\else - \expandafter\exitloop - \fi}% - \egroup} - \vbox - \fi} - -\def\splitfloat - {\dosingleempty\dosplitfloat} - \def\dooutput{\sidefloatoutput} % redefinition of \dooutput \setupmarginblocks @@ -2033,6 +2288,8 @@ \c!blockway=\@@nrblockway, \c!sectionnumber=\@@nrsectionnumber, \c!separator=\@@koseparator, + \c!stopper=\@@kostopper, + \c!suffix=\floatcaptionsuffix, % hook \c!distance=1em, \c!command=, \c!conversion=\v!numbers] @@ -2043,7 +2300,7 @@ \c!height=\v!fit, \c!offset=\v!overlay, \c!frame=\v!off, - \c!radius=.5\korpsgrootte, + \c!radius=.5\bodyfontsize, \c!corner=\v!rectangular, \c!background=, \c!backgroundscreen=\@@rsscreen, @@ -2073,16 +2330,13 @@ \c!local=, \c!default=\v!figure, \c!numbering=\v!yes] - -\setupfloatsplitting - [\c!conversion=\v!character, % \v!romannumerals - \c!lines=3] % float strategy, replaces some of the above macros -\let\floatmethod\empty -\let\floatcolumn\empty -\let\floatrow \empty +\let\floatmethod \empty +\let\floatcolumn \empty +\let\floatrow \empty +\let\forcedfloatmethod\empty \def\dogetfloatbox#1#2% {\ifvisible @@ -2100,8 +2354,11 @@ \let\floatrow\empty \edef\floatmethod{#2}}% \doifundefined{\string\floatmethod\floatmethod} - {\let\floatmethod\v!here}% - \getvalue{\string\floatmethod\floatmethod}[#1]% + {\let\floatmethod\v!here}% + \doifsomething\forcedfloatmethod + {\edef\floatmethod{\forcedfloatmethod}}% + %\getvalue{\string\floatmethod\floatmethod}[#1]% + \getvalue{\string\floatmethod\floatmethod}[\floatmethod,#1]% \fi} \def\installfloathandler#1#2% #1=keyword #2=handler @@ -2114,9 +2371,12 @@ \installfloathandler \v!text \sometextfloat \installfloathandler \v!top \sometopfloat \installfloathandler \v!bottom \somebottomfloat +\installfloathandler \v!auto \someautofloat \installfloathandler \v!margin \somemarginfloat \installfloathandler \v!opposite \somefacefloat \installfloathandler \v!page \somepagefloat +\installfloathandler \v!leftpage \someleftpagefloat +\installfloathandler \v!rightpage \somerightpagefloat \installfloathandler \v!inmargin \someinmarginfloat \installfloathandler \v!inleft \someinleftmarginfloat \installfloathandler \v!inright \someinrightmarginfloat @@ -2139,19 +2399,22 @@ \installfloathandler {fxtb} \someslotfloat \installfloathandler {fxbt} \someslotfloat -\def\placesomeslotfloat {\OTRcommand\someslotfloat} -\def\placesomeherefloat {\OTRcommand\someherefloat} -\def\placesomefixdfloat {\OTRcommand\somefixdfloat} -\def\placesomepagefloat {\OTRcommand\somepagefloat} -\def\placesometopsfloat {\OTRcommand\sometopsfloat} -\def\placesomebotsfloat {\OTRcommand\somebotsfloat} -\def\placesomesidefloat {\OTRcommand\somesidefloat} -\def\placesomefacefloat {\OTRcommand\somefacefloat} +\def\placesomeslotfloat {\OTRcommand\someslotfloat} +\def\placesomeherefloat {\OTRcommand\someherefloat} +\def\placesomefixdfloat {\OTRcommand\somefixdfloat} +\def\placesomepagefloat {\OTRcommand\somepagefloat} +\def\placesomeleftpagefloat {\OTRcommand\someleftpagefloat} +\def\placesomerightpagefloat{\OTRcommand\somerightpagefloat} +\def\placesometopsfloat {\OTRcommand\sometopsfloat} +\def\placesomebotsfloat {\OTRcommand\somebotsfloat} +\def\placesomesidefloat {\OTRcommand\somesidefloat} +\def\placesomefacefloat {\OTRcommand\somefacefloat} \def\someleftsidefloat [#1]{\somesidefloat[#1]\presetindentation} \def\somerightsidefloat [#1]{\somesidefloat[#1]} \def\sometopfloat [#1]{\someelsefloat[#1]\nonoindentation} \def\somebottomfloat [#1]{\someelsefloat[#1]} +\def\someautofloat [#1]{\someelsefloat[#1]} \def\somemarginfloat [#1]{\somenextfloat[#1]\nonoindentation} \def\someinleftmarginfloat [#1]{\somesidefloat[#1]} \def\someinrightmarginfloat[#1]{\somesidefloat[#1]} @@ -2163,9 +2426,11 @@ \def\somebackspacefloat [#1]{\somesidefloat[#1]} \def\somecutspacefloat [#1]{\somesidefloat[#1]} -\def\somefixdfloat {\placesomefixdfloat} -\def\somepagefloat {\placesomepagefloat} -\def\somefacefloat {\placesomefacefloat} -\def\someslotfloat {\placesomeslotfloat} +\def\somefixdfloat {\placesomefixdfloat} +\def\somepagefloat {\placesomepagefloat} +\def\someleftpagefloat {\placesomeleftpagefloat} +\def\somerightpagefloat{\placesomerightpagefloat} +\def\somefacefloat {\placesomefacefloat} +\def\someslotfloat {\placesomeslotfloat} \protect \endinput |