summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/context/base/page-flt.mkiv
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/context/base/page-flt.mkiv')
-rw-r--r--Master/texmf-dist/tex/context/base/page-flt.mkiv95
1 files changed, 75 insertions, 20 deletions
diff --git a/Master/texmf-dist/tex/context/base/page-flt.mkiv b/Master/texmf-dist/tex/context/base/page-flt.mkiv
index 944626b8e9c..6d23891767c 100644
--- a/Master/texmf-dist/tex/context/base/page-flt.mkiv
+++ b/Master/texmf-dist/tex/context/base/page-flt.mkiv
@@ -75,6 +75,10 @@
{\ctxlua{floats.flush("#1",\number#2)}%
\the\everyfloatscheck}
+\def\dofloatsflushbylabel#1#2%
+ {\ctxlua{floats.flush("#1","#2",true)}%
+ \the\everyfloatscheck}
+
\def\dofloatssave#1%
{\ctxlua{floats.save("#1")}%
\the\everyfloatscheck}
@@ -95,7 +99,7 @@
{\ctxlua{floats.consult("#1")}}
\def\doifsavedfloatelse#1%
- {\ctxlua{commands.doifsavedfloatelse("#1")}}
+ {\ctxcommand{doifsavedfloatelse("#1")}}
\def\dofloatscollect#1#2#3%
{\ctxlua{floats.collect("#1",\number\dimexpr#2,\number\dimexpr#3)}}
@@ -112,6 +116,41 @@
\def\dofloatssavepagefloat#1#2%
{\ctxlua{floats.save("#1", { specification = "#2" })}}
+\def\dofloatssavesomewherefloat#1#2% #1=method
+ {\ctxlua{floats.save("#1", { specification = "#2", label = "\floatlabel" })}}
+
+%D This is an experimental new feature (for Alan Braslau), a prelude to more:
+%D
+%D \starttyping
+%D test \placefigure{}{}
+%D test \placefigure[somewhere:alpha][whatever]{}{}
+%D test \placefigure[somewhere:beta] [whatever]{}{}
+%D test \placefigure[somewhere:gamma][whatever]{}{}
+%D test \placefigure[somewhere:delta][whatever]{}{}
+%D test \placefigure{}{}
+%D
+%D in \in{figure}[whatever] bla bla
+%D
+%D \placenamedfloat[figure][*l*]
+%D \placenamedfloat[figure][gamma]
+%D \placenamedfloat[figure][beta]
+%D \stoptyping
+
+\def\placenamedfloat
+ {\dodoubleargument\doplacenamedfloat}
+
+\def\doplacenamedfloat[#1][#2]%
+ {\doloop
+ {\dofloatsflushbylabel\s!somewhere{#2}%
+ \ifvoid\floatbox
+ \exitloop
+ \else
+ \def\currentfloat{#1}%
+ \blank[\@@bkspacebefore]%
+ \box\floatbox
+ \blank[\@@bkspaceafter]
+ \fi}}
+
%D The following code is in transition as we don't want to break the
%D current single column, multi column, and columnset mechanism.
%D
@@ -119,7 +158,7 @@
\def\dogetfloat
{\ifsomefloatwaiting
- \dofloatsflush{text}{1}%
+ \dofloatsflush\s!text{1}%
\ifcenterfloatbox
\ifdim\wd\globalscratchbox<\hsize
\global\setbox\floatbox\hbox to \hsize{\hss\box\floatbox\hss}%
@@ -138,14 +177,14 @@
\fi}
\def\dosavefloat
- {\dofloatssave{text}%
+ {\dofloatssave\s!text
\nonoindentation} % brrr nonoindentation here
\def\doresavefloat
- {\dofloatsresave{text}}
+ {\dofloatsresave\s!text}
\def\doreversesavefloat
- {\dofloatsresave{text}}
+ {\dofloatsresave\s!text}
\def\doflushsavedfloats % simplified \OTRONEdodoflushfloats
{\doloop
@@ -177,21 +216,21 @@
% \def\doflushpagefloats
% {\doifoddpageelse
-% {\ifnum\dofloatsnofstacked{rightpage}>\zerocount
-% \doflushsomepagefloat{rightpage}%
-% \else\ifnum\dofloatsnofstacked{page}>\zerocount
-% \doflushsomepagefloat{page}
-% \else\ifnum\dofloatsnofstacked{leftpage}>\zerocount
-% \null\vfill\eject
-% %\doflushsomepagefloat{leftpage}%
+% {\ifnum\dofloatsnofstacked\s!rightpage>\zerocount
+% \doflushsomepagefloat\s!rightpage
+% \else\ifnum\dofloatsnofstacked\s!page>\zerocount
+% \doflushsomepagefloat\s!page
+% \else\ifnum\dofloatsnofstacked\s!leftpage>\zerocount
+% \emptyhbox\vfill\eject
+% %\doflushsomepagefloat\s!leftpage
% \fi\fi\fi}
-% {\ifnum\dofloatsnofstacked{leftpage}>\zerocount
-% \doflushsomepagefloat{leftpage}%
-% \else\ifnum\dofloatsnofstacked{page}>\zerocount
-% \doflushsomepagefloat{page}
-% \else\ifnum\dofloatsnofstacked{rightpage}>\zerocount
-% \null\vfill\eject
-% %\doflushsomepagefloat{rightpage}%
+% {\ifnum\dofloatsnofstacked\s!leftpage>\zerocount
+% \doflushsomepagefloat\s!leftpage
+% \else\ifnum\dofloatsnofstacked\s!page>\zerocount
+% \doflushsomepagefloat\s!page
+% \else\ifnum\dofloatsnofstacked\s!rightpage>\zerocount
+% \emptyhbox\vfill\eject
+% %\doflushsomepagefloat\s!rightpage
% \fi\fi\fi}}
\def\doflushpagefloats
@@ -199,7 +238,7 @@
\ifx\checkedpagefloat\empty
% nothing
\else\ifx\checkedpagefloat\v!empty
- \null\vfill\eject
+ \emptyhbox\vfill\eject
\else
\doflushsomepagefloat\checkedpagefloat
\fi\fi}
@@ -230,4 +269,20 @@
\ifdefined\doflushfloats\else \let\doflushfloats\relax \fi
\ifdefined\flushfloatbox\else \let\flushfloatbox\relax \fi
+% temp hack, needed to prevent floatbox being forgotten during
+% output, this will change to using another box for flushing
+%
+% \dorecurse{700}{text } \placefigure[top][]{First} {\framed{bla 1}}
+% \placefigure[top][]{Second}{\framed{bla 2}}
+% \dorecurse {40}{text } \placefigure[top][]{Third} {\framed{bla 3}}
+
+\newbox\savedfloatbox
+
+\appendtoks
+ \global\setbox\savedfloatbox\box\floatbox
+\to \everybeforeoutput
+\appendtoks
+ \global\setbox\floatbox\box\savedfloatbox
+\to \everyafteroutput
+
\protect \endinput