summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/context/base/strc-flt.mkiv
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/context/base/strc-flt.mkiv')
-rw-r--r--Master/texmf-dist/tex/context/base/strc-flt.mkiv280
1 files changed, 185 insertions, 95 deletions
diff --git a/Master/texmf-dist/tex/context/base/strc-flt.mkiv b/Master/texmf-dist/tex/context/base/strc-flt.mkiv
index 67023d701a6..32024a27695 100644
--- a/Master/texmf-dist/tex/context/base/strc-flt.mkiv
+++ b/Master/texmf-dist/tex/context/base/strc-flt.mkiv
@@ -21,12 +21,12 @@
%D strc-flt.tex and page-flt.mkiv cq. page-flt.mkii.
\ifdefined\addlocalbackgroundtobox\else \def\addlocalbackgroundtobox{\resetglobal\gobbleoneargument} \fi
-
+
\unexpanded\def\placefloats{\doflushfloats} % keep this one
-
+
\let\currentfloat\empty
-\def\letfloatparameter #1{\expandafter\csname\??fl\currentfloat#1\endcsname}
+\def\letfloatparameter #1{\expandafter\let\csname\??fl\currentfloat#1\endcsname}
\def\floatparameter #1{\csname\dofloatparameter{\??fl\currentfloat}#1\endcsname}
\def\floatsharedparameter#1{\csname \??fl #1\endcsname}
@@ -110,17 +110,18 @@
\c!textcolor=,
\c!align=,
\c!number=\v!yes,
-% \c!prefix=\v!no,
-% \c!prefixconnector=.,
-% \c!way=\v!by\v!chapter,
-% \c!prefixsegments=2:2,
-% \c!way=\@@nrway,
-% \c!blockway=\@@nrblockway,
-% \c!sectionnumber=\@@nrsectionnumber,
-% \c!separator=\@@koseparator,
-% \c!starter=\@@kostarter,
-% \c!stopper=\@@kostopper,
-% \c!suffix=\floatcaptionsuffix, % hook
+ % \c!prefix=\v!no,
+ % \c!prefixconnector=.,
+ % \c!way=\v!by\v!chapter,
+ % \c!prefixsegments=2:2,
+ % \c!way=\@@nrway,
+ % \c!blockway=\@@nrblockway,
+ % \c!sectionnumber=\@@nrsectionnumber,
+ % \c!separator=\@@koseparator,
+ % \c!starter=\@@kostarter,
+ % \c!stopper=\@@kostopper,
+ \c!suffixseparator=, % currently rather hard coded
+ \c!suffix=\floatcaptionsuffix,
\c!distance=1em,
\c!conversion=\v!numbers,
\c!command=]
@@ -169,7 +170,7 @@
\c!local=,
\c!bottombefore=, % e.g. \vfill
\c!bottomafter=,
- \c!default=\v!figure,
+ \c!default=, % default location
\c!numbering=\v!yes]
\def\@@bknumbering {\floatsharedparameter\c!numbering } % global one
@@ -180,6 +181,7 @@
\def\@@bknlines {\floatsharedparameter\c!nlines } % global one
\def\@@bkmargin {\floatsharedparameter\c!margin } % global one
\def\@@bkcache {\floatsharedparameter\c!cache } % global one
+\def\@@bklocation {\floatsharedparameter\c!location }
% float
%
@@ -205,7 +207,6 @@
% \c!sectionnumber=\floatcaptionparameter\c!sectionnumber,
% \c!conversion=\floatcaptionparameter\c!conversion]%
-
%D Individial settings:
\unexpanded\def\setupfloat {\dodoubleargument\dosetupfloat}
@@ -303,23 +304,35 @@
% \def\thecurrentfloatnumber
% {\ifnofloatcaption \else \ifnofloatnumber \else
-% % \labeltexts\currentfloat{\convertedstructurecounter[\currentfloat]}% ! ! todo: use a lua call instead
% \ifx\currentfloatnumber\relax\else
-% \labeltexts\currentfloat{\ctxlua{structure.lists.savednumber("\currentfloat",\currentfloatnumber)}}%
+% \dostarttagged\t!floattag\empty
+% \labeltexts\currentfloat{\ctxlua{structures.lists.savedprefixednumber("\currentfloat",\currentfloatnumber)}}%
+% \dostoptagged
% \fi
% \fi \fi}
+\unexpanded\def\thecurrentfloatnumbersuffix
+ {\doifsomething{\floatcaptionparameter\c!suffix}
+ {\floatcaptionparameter\c!suffixseparator
+ \floatcaptionparameter\c!suffix}}
+
\def\thecurrentfloatnumber
{\ifnofloatcaption \else \ifnofloatnumber \else
\ifx\currentfloatnumber\relax\else
- \labeltexts\currentfloat{\ctxlua{structure.lists.savedprefixednumber("\currentfloat",\currentfloatnumber)}}%
+ \dostarttagged\t!floattag\empty
+ \labeltexts\currentfloat
+ {\ctxlua{structures.lists.savedprefixednumber("\currentfloat",\currentfloatnumber)}%
+ \thecurrentfloatnumbersuffix}%
+ \dostoptagged
\fi
\fi \fi}
\def\thecurrentfloatcaption
{\ifnofloatcaption \else
\ifx\currentfloatnumber\relax\else
- \ctxlua{structure.lists.savedtitle("\currentfloat",\currentfloatnumber)}%
+ \dostarttagged\t!floattext\empty
+ \ctxlua{structures.lists.savedtitle("\currentfloat",\currentfloatnumber)}%
+ \dostoptagged
\fi
\fi}
@@ -367,11 +380,11 @@
\begingroup
\dosetfloatcaptionattributes\c!style\c!color
\begingroup
- \dosetfloatcaptionattributes\c!headstyle\c!headcolor
+ \dosetfloatcaptionattributes\c!headstyle\c!headcolor
\labeltexts{#1}{\preparednumber}%
\endgroup
\begingroup
- \dosetfloatcaptionattributes\c!textstyle\c!textcolor
+ \dosetfloatcaptionattributes\c!textstyle\c!textcolor
\dotfskip{\floatcaptionparameter\c!distance}#3%
\endgroup
\endgroup}%
@@ -467,10 +480,10 @@
\long\def\docheckcaptioncontent#1#2%
{\ifnofloatcaption \else
\setbox\tempcaptionbox\hbox
- {\trialtypesettingtrue
+ {\settrialtypesetting
\notesenabledfalse
\putcompletecaption{#1}{#2}}%
- % new, \placefigure{\XMLflush{somecaption}}{} passes earlier empty check
+ % new, \placefigure{\xmlfirst{#1}{somecaption}}{} passes earlier empty check
% so here we misuse the scratch box; actually this means that the previous
% test can go away (some day, when i redo this module)
\ifdim\wd\tempcaptionbox=\zeropoint
@@ -510,21 +523,21 @@
\newconditional\retainfloatnumber
-\def\preparefloatnumber#1%
+\def\preparefloatnumber#1% use in special case see below
{\xdef\floatcaptionnumber{#1}%
\doifelsenodelocation{\v!float\@@thenumber{#1}}
- \donothing {\chardef\nodelocationmode\zerocount}%
+ \donothing {\nodelocationmode\zerocount}%
\doifelse{\floatsharedparameter\c!numbering}\v!nocheck
{\incrementnumber[#1]%
\makesectionnumber[#1]%
\ifconditional\retainfloatnumber\decrementnumber[#1]\fi}
{\ifinsidecolumns
- \chardef\nodelocationmode\zerocount
+ \nodelocationmode\zerocount
% to be perfected:
- % \chardef\nodelocationmode\plustwo
+ % \nodelocationmode\plustwo
\fi
% FOR THE MOMENT NOT AVAILABLE
-\chardef\nodelocationmode\zerocount
+\nodelocationmode\zerocount
% BUT NOT THAT HARD TO DO
\ifcase\nodelocationmode
\incrementnumber[#1]%
@@ -610,6 +623,7 @@
\fi
\global\insidefloattrue
\begingroup % **
+ \dostarttagged\t!float\currentfloat
\ifmarginblocks
\doifinset\v!margin{#2}{\hsize\@@mbwidth}%
\fi
@@ -619,15 +633,17 @@
\dowithnextboxcontent % better a \the\everyfloattoks
{\setlocalfloathsize
\floatparameter\c!inner
+ \dostarttagged\t!floatcontent\empty
+ \aftergroup\dostoptagged % tricky, never change \dowithnextboxcontent
\postponenotes} % new
{\doifsomething{\floatparameter\c!criterium}
{\ifdim\wd\nextbox>\floatparameter\c!criterium\relax
- \edef\forcedfloatmethod{\floatvariable\c!fallback}%
+ \edef\forcedfloatmethod{\floatparameter\c!fallback}%
\ifx\forcedfloatmethod\empty\let\forcedfloatmethod\v!here\fi
\fi}%
- \xdocompletefloat{#1}{#3}{#2}{#4}% ** not yet done
- % we need to carry over the par because of side floats
- \doifnotinset\v!text{#2}{\carryoverpar\endgroup}%
+ \xdocompletefloat{#1}{#3}{#2}{#4}% ** not yet done
+ % we need to carry over the par because of side floats
+ \doifnotinset\v!text{#2}{\dostoptagged\carryoverpar\endgroup}% **
\global\sidefloatdownshift \zeropoint
\global\sidefloatextrashift\zeropoint
\ifparfloat
@@ -639,8 +655,9 @@
\def\xxdocompletefloat#1#2%
{\rightorleftpageaction{\let\@@extrafloat#1}{\let\@@extrafloat#2}}
-\chardef\textfloatmethod=0 % 0=raw 1=safe (.99) 2=tight (-1pt)
-\chardef\sidefloatmethod=1 % 0=raw 1=safe (.99) 2=tight (-1pt)
+\setnewconstant\sidefloatalign \zerocount
+\setnewconstant\textfloatmethod\zerocount % 0=raw 1=safe (.99) 2=tight (-1pt)
+\setnewconstant\sidefloatmethod\plusone % 0=raw 1=safe (.99) 2=tight (-1pt)
\let\floatrotation\!!zerocount
@@ -659,26 +676,26 @@
\fi
\global\sidefloatshift\zeropoint
\global\sidefloatmaximum\zeropoint
- \global\chardef\sidefloatmethod\floatparameter\c!sidemethod
- \global\chardef\textfloatmethod\floatparameter\c!textmethod
- \global\chardef\sidefloatalign\zerocount
+ \global\sidefloatmethod\floatparameter\c!sidemethod
+ \global\textfloatmethod\floatparameter\c!textmethod
+ \global\sidefloatalign\zerocount
\globallet\floatrotation\!!zerocount
\calculatefloatskips
\ifparfloat
\processaction
[\floatparameter\c!sidealign]
- [\v!height=>\global\chardef\sidefloatalign\plusone,%
- \v!line=>\global\chardef\sidefloatalign\plustwo,% (***)
- \v!depth=>\global\chardef\sidefloatalign\plusthree,%
- \v!grid=>\global\chardef\sidefloatalign\plusfour,%
- \v!halfline=>\global\chardef\sidefloatalign\plusfive]%
- % todo (test first): \doifinset\v!lokaal{#2}{\chardef\sidefloatalign\zerocount}%
+ [\v!height=>\global\sidefloatalign\plusone,%
+ \v!line=>\global\sidefloatalign\plustwo,% (***)
+ \v!depth=>\global\sidefloatalign\plusthree,%
+ \v!grid=>\global\sidefloatalign\plusfour,%
+ \v!halfline=>\global\sidefloatalign\plusfive]%
+ % todo (test first): \doifinset\v!lokaal{#2}{\global\sidefloatalign\zerocount}%
\ifcase\sidefloatalign\relax % todo: optie v!lokaal => \else
- \doifinset\v!height {#2}{\global\chardef\sidefloatalign\plusone}%
- \doifinset\v!line {#2}{\global\chardef\sidefloatalign\plustwo}%
- \doifinset\v!depth {#2}{\global\chardef\sidefloatalign\plusthree}%
- \doifinset\v!grid {#2}{\global\chardef\sidefloatalign\plusfour}%
- \doifinset\v!halfline{#2}{\global\chardef\sidefloatalign\plusfive}% meant for 'none'
+ \doifinset\v!height {#2}{\global\sidefloatalign\plusone}%
+ \doifinset\v!line {#2}{\global\sidefloatalign\plustwo}%
+ \doifinset\v!depth {#2}{\global\sidefloatalign\plusthree}%
+ \doifinset\v!grid {#2}{\global\sidefloatalign\plusfour}%
+ \doifinset\v!halfline{#2}{\global\sidefloatalign\plusfive}% meant for 'none'
\fi
\doifinset\v!high{#2}{\global\sidefloattopskip \zeropoint}%
\doifinset\v!low {#2}{\global\sidefloatbottomskip\zeropoint}%
@@ -751,9 +768,11 @@
\let\currentfloatattribute\empty % to be checked
\def\floatcaptionattribute
- {\iflocation \ifnofloatnumber \else \ifnofloatcaption \else
+ {\iflocation \ifnofloatnumber \else \ifnofloatcaption \else \ifinsidesplitfloat \else
attr \destinationattribute \currentfloatattribute
- \fi \fi \fi}
+ \fi \fi \fi \fi}
+
+\newconditional\usesamefloatnumber
\long\def\docompletefloat#1#2#3#4#5% #1:floatclass #2:reference #3:optionlist #4:caption #5:box number
{\presetfloatvariables{#1}{#3}{#2}{#5}% check this one
@@ -762,24 +781,32 @@
%
% \dofloatcomponent[\c!name=#1,\c!reference=#2,\c!bookmark=,\c!title={#4}][]% ifnofloatnumber ifnofloatcaption \tracefloatnumber{#1}%
%
- \dostructurecountercomponent
- {float}%
- \getcaptionparameters
- \floatcaptionparameter
- \detokenizedcaptionparameter
- \relax
- \relax
- \relax
- [\c!name=\currentfloat,\s!counter=\@@thestructurecounter\currentfloat,%
- \s!hascaption=\ifnofloatcaption \v!no\else\v!yes\fi,%
- \s!hasnumber=\ifnofloatnumber \v!no\else\v!yes\fi,%
- \s!hastitle=\ifemptyfloatcaption\v!no\else\v!yes\fi,%
- \c!reference=#2,\c!title={#4},\c!bookmark=]%
- []%
- \globallet\currentfloatnumber \laststructurecounternumber
- \globallet\currentfloatattribute \laststructurecounterattribute
- \globallet\currentfloatsynchronize\laststructurecountersynchronize
+ \ifconditional\usesamefloatnumber
+ \globallet\currentfloatnumber \previousfloatnumber
+ \globallet\currentfloatattribute \empty
+ \globallet\currentfloatsynchronize\relax
+ \else
+ \dostructurecountercomponent
+ {float}%
+ \getcaptionparameters
+ \floatcaptionparameter
+ \detokenizedcaptionparameter
+ \relax
+ \relax
+ \relax
+ [\c!name=\currentfloat,\s!counter=\@@thestructurecounter\currentfloat,%
+ \s!hascaption=\ifnofloatcaption \v!no\else\v!yes\fi,%
+ \s!hasnumber=\ifnofloatnumber \v!no\else\v!yes\fi,%
+ \s!hastitle=\ifemptyfloatcaption\v!no\else\v!yes\fi,%
+ \c!reference=#2,\c!title={#4},\c!bookmark=]%
+ []%
+ \globallet\previousfloatnumber \laststructurecounternumber
+ \globallet\currentfloatnumber \laststructurecounternumber
+ \globallet\currentfloatattribute \laststructurecounterattribute
+ \globallet\currentfloatsynchronize\laststructurecountersynchronize
+ \fi
%
+ \global\setfalse\usesamefloatnumber % one shot
% check float box
\setnaturalfloatdimensions#5%
\global\setbox\floatbox\vbox{\floatparameter\c!command{\box#5}}%
@@ -798,6 +825,7 @@
\egroup
% place the float
\dofloat{#3}{\thecurrentfloatnumber}{\thecurrentfloatcaption}%
+% \dostoptagged % tricky here, we need an extra mechanism (add to previous or so)
\global\insidefloatfalse}
\def\setlocalfloathsize
@@ -832,7 +860,7 @@
\fi}
\appendtoks
- \let\rightorleftpageaction\doifrightpagefloatelse
+ \let\rightorleftpageaction\doifrightpagefloatelse
\to \everyinsidefloat
\newif\ifextrafloatactions \extrafloatactionstrue
@@ -928,14 +956,14 @@
\ifextrafloatactions
\ifdim\sidefloatdownshift=\zeropoint\else
\global\setbox\floatbox\vbox
- {\vskip\sidefloatdownshift\nointerlineskip\box\floatbox}%
+ {\vskip\sidefloatdownshift\nointerlineskip\box\floatbox}%
\fi
\doifsomething{\floatparameter\c!minwidth}
{\scratchdimen\floatparameter\c!minwidth\relax
\ifdim\wd\floatbox<\scratchdimen
\global\setbox\floatbox\hbox to \scratchdimen
{\doifnot{\floatparameter\c!location}\v!left \hss
- \box\floatbox%
+ \box\floatbox
\doifnot{\floatparameter\c!location}\v!right\hss}%
\fi}%
% todo: rand / rug
@@ -947,8 +975,7 @@
\doifsomething{\floatparameter\c!maxwidth}
{\scratchdimen\floatparameter\c!maxwidth\relax
\ifdim\wd\floatbox>\scratchdimen
- \doifcommonelse{\v!inright,\v!rightmargin,\v!rightedge
- \v!inleft,\v!leftmargin,\v!leftedge}{#1}
+ \doifcommonelse{\v!inright,\v!rightmargin,\v!rightedge,\v!inleft,\v!leftmargin,\v!leftedge}{#1}
{\global\sidefloatmaximum\scratchdimen}
{\global\setbox\floatbox\hbox to \scratchdimen
{\doifcommonelse{\v!right,\v!left}{#1}
@@ -1128,8 +1155,10 @@
\doifnotinset\v!tall{#1}%
{\dp\floatbox\openstrutdepth}% dp\strutbox}% % toegevoegd
\box\floatbox
+ \dostoptagged
\blank[\floatsharedparameter\c!spaceafter]%
\endgroup % **
+% \dostoptagged
\doinsertfloatinfo}
\def\somefacefloat[#1]% links, rechts, midden, hoog, midden, laag
@@ -1202,14 +1231,14 @@
\ifdefined\moveboxontogrid\else \let\movecaptionontogrid\gobblethreearguments \fi
\def\locatefloatbox
- {\chardef\alignstrutmode\zerocount
+ {\alignstrutmode\zerocount
\shiftalignedline
{\floatparameter\c!leftmargin }{\floatparameter\c!rightmargin}%
{\floatparameter\c!innermargin}{\floatparameter\c!outermargin}%
\alignedline{\floatparameter\c!location}\v!middle}
\def\locatecaptionbox
- {\chardef\alignstrutmode\zerocount
+ {\alignstrutmode\zerocount
\shiftalignedline
{\floatcaptionparameter\c!leftmargin }{\floatcaptionparameter\c!rightmargin}%
{\floatcaptionparameter\c!innermargin}{\floatcaptionparameter\c!outermargin}%
@@ -1270,7 +1299,8 @@
\locatefloat{\copy\tempfloatbox}}}
\def\dopreparedocaption#1#2#3%
- {\doifinsetelse{\floatcaptionparameter\c!location}{\v!top,\v!bottom}
+ {\dostarttagged\t!floatcaption\empty
+ \doifinsetelse{\floatcaptionparameter\c!location}{\v!top,\v!bottom}
{\doifinsetelse{\floatcaptionparameter\c!width}{\v!fit,\v!max}
{\doifelse{\floatcaptionparameter\c!minwidth}\v!fit
{\doifelse{\floatcaptionparameter\c!width}\v!max
@@ -1286,7 +1316,8 @@
{\dopreparesidewidthcaption{#1}{#2}{#3}}}% new, special effects (see icare)
{\doifinsetelse{\floatcaptionparameter\c!width}{\v!fit,\v!max}
{\dopreparesideautocaption{#1}{#2}{#3}}
- {\dopreparesidewidthcaption{#1}{#2}{#3}}}}
+ {\dopreparesidewidthcaption{#1}{#2}{#3}}}%
+ \dostoptagged}
% \def\dosettempcaptionbox
% {\dosetraggedvbox{\floatcaptionparameter\c!align}%
@@ -1344,7 +1375,7 @@
\ifdim\captionhsize>\hsize
% float is wider than \hsize
\dosettempcaptionbox
- {\trialtypesettingtrue
+ {\settrialtypesetting
\hsize\captionhsize
\notesenabledfalse
\putcompletecaption{#2}{#3}}%
@@ -1368,7 +1399,7 @@
\edef\captionhsize{\the\scratchdimen}%
\fi
\setbox\scratchbox\vbox % test with overshoot
- {\trialtypesettingtrue
+ {\settrialtypesetting
\scratchdimen\captionhsize
\advance\scratchdimen \captionovershoot
\advance\scratchdimen 3em % an average word length
@@ -1720,7 +1751,7 @@
\newif\ifpostponecolumnfloats \postponecolumnfloatsfalse % don't change
-\chardef\postcenterfloatmethod\plusone
+\setnewconstant\postcenterfloatmethod\plusone
\def\postcenterfloatbox#1%
{\scratchdimen
@@ -1796,7 +1827,7 @@
\let\locatecaption\relax
\def\locatesidefloat##1%
{\begingroup
- \chardef\alignstrutmode\zerocount
+ \alignstrutmode\zerocount
\hsize\tempfloatwidth \forgetall
\alignedline{\floatparameter\c!location}\v!middle{##1}%
\endgroup}%
@@ -1859,25 +1890,34 @@
% float strategy, replaces some of the above macros
\let\floatmethod \empty
+\let\floatlabel \empty
\let\floatcolumn \empty
\let\floatrow \empty
\let\forcedfloatmethod\empty
+% \def\setfloatmethodvariables#1%
+% {\getfromcommalist[#1][1]%
+% \@EA\beforesplitstring\commalistelement\at:\to\floatmethod
+% \@EA\aftersplitstring \commalistelement\at:\to\floatcolumn
+% \@EA\aftersplitstring \floatcolumn\at*\to\floatrow
+% \@EA\beforesplitstring\floatcolumn\at*\to\floatcolumn}
+
+\def\setfloatmethodvariables#1% \floatmethod \floatlabel \floatrow \floatcolumn
+ {\ctxlua{floats.analysemethod("#1")}}
+
\def\dogetfloatbox#1#2%
{\ifvisible
- \doifelsenothing{#2}
- {\getfromcommalist[#1][1]%
- \@EA\beforesplitstring\commalistelement\at:\to\floatmethod
- \@EA\aftersplitstring \commalistelement\at:\to\floatcolumn
- \@EA\aftersplitstring \floatcolumn\at*\to\floatrow
- \@EA\beforesplitstring\floatcolumn\at*\to\floatcolumn
- % todo: nog algemeen otr
- \ifdefined\OTRSETsetpreferedcolumnslot
- \OTRSETsetpreferedcolumnslot\floatcolumn\floatrow
- \fi}
- {\let\floatcolumn\empty
- \let\floatrow\empty
- \edef\floatmethod{#2}}%
+ \let \floatlabel \empty
+ \let \floatcolumn\empty
+ \let \floatrow \empty
+ \edef\floatmethod{#2}%
+ \ifx\floatmethod\empty
+ \setfloatmethodvariables{#1}%
+ % todo: nog algemeen otr
+ \ifdefined\OTRSETsetpreferedcolumnslot
+ \OTRSETsetpreferedcolumnslot\floatcolumn\floatrow
+ \fi
+ \fi
\doifundefined{\string\floatmethod\floatmethod}
{\let\floatmethod\v!here}%
\doifsomething\forcedfloatmethod
@@ -1889,6 +1929,9 @@
\def\installfloathandler#1#2% #1=keyword #2=handler
{\setvalue{\string\floatmethod#1}{#2}}
+\def\somesomewherefloat[#1]%
+ {\dofloatssavesomewherefloat\s!somewhere{#1}}
+
\installfloathandler \v!here \someherefloat
\installfloathandler \v!force \somefixdfloat
\installfloathandler \v!left \someleftsidefloat
@@ -1910,6 +1953,8 @@
\installfloathandler \v!leftedge \someinleftedgefloat
\installfloathandler \v!rightedge \someinrightedgefloat
+\installfloathandler \v!somewhere \somesomewherefloat
+
\installfloathandler \v!backspace \somebackspacefloat
\installfloathandler \v!cutspace \somecutspacefloat
@@ -1953,6 +1998,7 @@
\unexpanded\def\placesomebotsfloat {\OTRcommand\somebotsfloat}
\unexpanded\def\placesomesidefloat {\OTRcommand\somesidefloat}
\unexpanded\def\placesomefacefloat {\OTRcommand\somefacefloat}
+%unexpanded\def\placesomesomewherefloat{\OTRcommand\somesomewherefloat}
\def\somefixdfloat {\placesomefixdfloat}
\def\somepagefloat {\placesomepagefloat}
@@ -1960,5 +2006,49 @@
\def\somerightpagefloat{\placesomerightpagefloat}
\def\somefacefloat {\placesomefacefloat}
\def\someslotfloat {\placesomeslotfloat}
-
+
+%D Local floats:
+
+\def\setuplocalfloats
+ {\getparameters[\??lf]}
+
+\setuplocalfloats
+ [%\c!before=\blank,
+ %\c!after=\blank,
+ \c!inbetween=\blank]
+
+\installfloathandler \v!local \somelocalfloat
+
+\initializeboxstack{localfloats}
+
+\newcounter\noflocalfloats
+
+\def\resetlocalfloats
+ {\doglobal\newcounter\noflocalfloats
+ \initializeboxstack{localfloats}}
+
+\def\somelocalfloat[#1]%
+ {\doglobal\increment\noflocalfloats
+ \savebox{localfloats}{\noflocalfloats}{\box\floatbox}}
+
+\def\getlocalfloats
+ {\dorecurse\noflocalfloats
+ {\ifnum\recurselevel=\plusone % 1\relax
+ \getvalue{\??lf\c!before}%
+ \else
+ \getvalue{\??lf\c!inbetween}%
+ \fi
+ \dontleavehmode\hbox{\foundbox{localfloats}\recurselevel}%
+ \ifnum\recurselevel=\noflocalfloats\relax
+ \getvalue{\??lf\c!after}%
+ \fi}}
+
+\def\flushlocalfloats
+ {\getlocalfloats
+ \resetlocalfloats}
+
+\def\getlocalfloat#1{\expanded{\foundbox{localfloats}{\number#1}}}
+
+\def\forcelocalfloats{\let\forcedfloatmethod\v!local}
+
\protect \endinput