summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tex/context/base/cont-new.mkii2
-rw-r--r--tex/context/base/cont-new.mkiv2
-rw-r--r--tex/context/base/context-version.pdfbin4141 -> 4145 bytes
-rw-r--r--tex/context/base/context-version.pngbin105732 -> 105702 bytes
-rw-r--r--tex/context/base/context.mkii2
-rw-r--r--tex/context/base/context.mkiv2
-rw-r--r--tex/context/base/page-flt.mkiv13
-rw-r--r--tex/context/base/page-ini.mkiv4
-rw-r--r--tex/context/base/page-not.mkiv4
-rw-r--r--tex/context/base/page-one.mkiv80
-rw-r--r--tex/context/base/page-set.mkiv60
-rw-r--r--tex/context/base/page-sid.mkiv25
-rw-r--r--tex/context/base/status-files.pdfbin24505 -> 24488 bytes
-rw-r--r--tex/context/base/status-lua.pdfbin182713 -> 182713 bytes
-rw-r--r--tex/context/base/status-mkiv.lua3
-rw-r--r--tex/context/base/strc-flt.mkvi799
-rw-r--r--tex/context/base/strc-mat.mkiv4
-rw-r--r--tex/generic/context/luatex/luatex-fonts-merged.lua2
18 files changed, 475 insertions, 527 deletions
diff --git a/tex/context/base/cont-new.mkii b/tex/context/base/cont-new.mkii
index eea9250ad..95d396b14 100644
--- a/tex/context/base/cont-new.mkii
+++ b/tex/context/base/cont-new.mkii
@@ -11,7 +11,7 @@
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.
-\newcontextversion{2012.07.04 10:42}
+\newcontextversion{2012.07.04 14:44}
%D This file is loaded at runtime, thereby providing an
%D excellent place for hacks, patches, extensions and new
diff --git a/tex/context/base/cont-new.mkiv b/tex/context/base/cont-new.mkiv
index 794733f23..7ba8675f5 100644
--- a/tex/context/base/cont-new.mkiv
+++ b/tex/context/base/cont-new.mkiv
@@ -11,7 +11,7 @@
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.
-\newcontextversion{2012.07.04 10:42}
+\newcontextversion{2012.07.04 14:44}
%D This file is loaded at runtime, thereby providing an
%D excellent place for hacks, patches, extensions and new
diff --git a/tex/context/base/context-version.pdf b/tex/context/base/context-version.pdf
index f95cc016a..508d9771d 100644
--- a/tex/context/base/context-version.pdf
+++ b/tex/context/base/context-version.pdf
Binary files differ
diff --git a/tex/context/base/context-version.png b/tex/context/base/context-version.png
index 70c4214dc..9b8c7fd31 100644
--- a/tex/context/base/context-version.png
+++ b/tex/context/base/context-version.png
Binary files differ
diff --git a/tex/context/base/context.mkii b/tex/context/base/context.mkii
index 232902240..ec464bdf8 100644
--- a/tex/context/base/context.mkii
+++ b/tex/context/base/context.mkii
@@ -20,7 +20,7 @@
%D your styles an modules.
\edef\contextformat {\jobname}
-\edef\contextversion{2012.07.04 10:42}
+\edef\contextversion{2012.07.04 14:44}
%D For those who want to use this:
diff --git a/tex/context/base/context.mkiv b/tex/context/base/context.mkiv
index 9f6d4e3c3..c0fc2ede4 100644
--- a/tex/context/base/context.mkiv
+++ b/tex/context/base/context.mkiv
@@ -25,7 +25,7 @@
%D up and the dependencies are more consistent.
\edef\contextformat {\jobname}
-\edef\contextversion{2012.07.04 10:42}
+\edef\contextversion{2012.07.04 14:44}
%D For those who want to use this:
diff --git a/tex/context/base/page-flt.mkiv b/tex/context/base/page-flt.mkiv
index 4655d92af..a608df0c8 100644
--- a/tex/context/base/page-flt.mkiv
+++ b/tex/context/base/page-flt.mkiv
@@ -20,6 +20,16 @@
\unprotect
+\installinsertion\c_page_floats_insertions_top
+\installinsertion\c_page_floats_insertions_bottom
+
+\newdimen \d_page_floats_inserted_bottom
+\newdimen \d_page_floats_inserted_top
+\newcount \c_page_floats_n_of_top \c_page_floats_n_of_top \plustwo
+\newcount \c_page_floats_n_of_bottom \c_page_floats_n_of_bottom\zerocount
+
+\newconstant \c_page_floats_insertions_topskip_mode % 1 = no topskip
+
%def\page_floats_report_saved {\showmessage\m!floatblocks2{\the\totalnoffloats}}
\def\page_floats_report_total {\showmessage\m!floatblocks4{\the\totalnoffloats}}
\def\page_floats_report_flushed{\showmessage\m!floatblocks3{\the\numexpr\totalnoffloats-\savednoffloats\relax}}
@@ -39,9 +49,10 @@
\newcount\totalnoffloats % these will be redone ... handled at the lua end anyway
\newcount\savednoffloats % these will be redone ... handled at the lua end anyway
-\newcount\noffloatinserts % these will be redone ... handled at the lua end anyway
\newcount\nofcollectedfloats % communication channel
+\newcount\noffloatinserts % these will be redone ... handled at the lua end anyway
+
\newbox \floattext
\newdimen\floatwidth
diff --git a/tex/context/base/page-ini.mkiv b/tex/context/base/page-ini.mkiv
index 59fcb38b6..e582bef64 100644
--- a/tex/context/base/page-ini.mkiv
+++ b/tex/context/base/page-ini.mkiv
@@ -66,8 +66,8 @@
{%\flushnotes already done
\ifconditional\c_page_floats_some_waiting
\begingroup
- \noftopfloats\plusthousand
- \nofbotfloats\zerocount
+ \c_page_floats_n_of_top\plusthousand
+ \c_page_floats_n_of_bottom\zerocount
% this is needed in case a float that has been stored
% ends up at the current page; this border case occurs when
% the calculated room is 'eps' smaller that the room available
diff --git a/tex/context/base/page-not.mkiv b/tex/context/base/page-not.mkiv
index ddc9b1522..7fae16419 100644
--- a/tex/context/base/page-not.mkiv
+++ b/tex/context/base/page-not.mkiv
@@ -44,8 +44,8 @@
\def\settotalinsertionheight
{\calculatetotalnoteheight
\totalinsertionheight\totalnoteheight
- \addinsertionheight\topins\to\totalinsertionheight
- \addinsertionheight\botins\to\totalinsertionheight}
+ \addinsertionheight\c_page_floats_insertions_top \to\totalinsertionheight
+ \addinsertionheight\c_page_floats_insertions_bottom\to\totalinsertionheight}
% hm
diff --git a/tex/context/base/page-one.mkiv b/tex/context/base/page-one.mkiv
index 025a9aa1a..2246bf78d 100644
--- a/tex/context/base/page-one.mkiv
+++ b/tex/context/base/page-one.mkiv
@@ -20,7 +20,9 @@
% OTRONE: basic single column
-\newdimen\d_page_one_saved_vsize
+\newdimen \d_page_one_saved_vsize
+
+\newconstant \c_page_one_float_method
\unexpanded\def\page_one_command_next_page
{\page_otr_eject_page}
@@ -50,11 +52,11 @@
% let's assume that the layout didn't change
\else
\global\d_page_one_saved_vsize\vsize
- \global\pagegoal\dimexpr\vsize-\topinserted-\botinserted\relax
+ \global\pagegoal\dimexpr\vsize-\d_page_floats_inserted_top-\d_page_floats_inserted_bottom\relax
% \bgroup
% \global\d_page_one_saved_vsize\vsize
-% \advance\vsize-\topinserted
-% \advance\vsize-\botinserted
+% \advance\vsize-\d_page_floats_inserted_top
+% \advance\vsize-\d_page_floats_inserted_bottom
% \global\pagegoal\vsize
% \egroup
\fi
@@ -186,16 +188,16 @@
\newskip \s_page_one_between_top_insert
\def\page_one_prepare_top_float
- {\ifdim\topinserted=\zeropoint
+ {\ifdim\d_page_floats_inserted_top=\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}
+ \s_page_one_between_top_insert\ifdim\d_strc_floats_top>\d_strc_floats_bottom\d_strc_floats_top\else\d_strc_floats_bottom\fi\relax
+ \global\advance\d_page_floats_inserted_top\dimexpr\ht\floatbox+\dp\floatbox+\s_page_one_between_top_insert\relax}
\def\page_one_insert_top_float % maybe remember last beforeskip
- {\insert\topins
+ {\insert\c_page_floats_insertions_top
{\forgetall
\ifconditional\c_page_one_top_of_insert
\ifconditional\c_page_one_correct_top_insert
@@ -228,25 +230,25 @@
\egroup}
\def\page_one_command_set_top_insertions_indeed
- {\ifnum\noffloatinserts<\noftopfloats
+ {\ifnum\noffloatinserts<\c_page_floats_n_of_top
\page_floats_get
\page_one_prepare_top_float
- \ifdim\topinserted<\textheight\relax
- \xdef\totaltopinserted{\the\topinserted}%
+ \ifdim\d_page_floats_inserted_top<\textheight\relax
+ \xdef\totaltopinserted{\the\d_page_floats_inserted_top}%
\page_one_insert_top_float
\ifconditional\c_page_floats_some_waiting
\advance\noffloatinserts \plusone
\else
- \noffloatinserts\noftopfloats\relax
+ \noffloatinserts\c_page_floats_n_of_top\relax
\fi
\page_floats_report_flushed
\else
\page_floats_resave\s!text
- \noffloatinserts\noftopfloats\relax
+ \noffloatinserts\c_page_floats_n_of_top\relax
\fi
\else
\ifcoditional\c_page_floats_some_waiting
- \showmessage\m!floatblocks6{\the\noftopfloats}%
+ \showmessage\m!floatblocks6{\the\c_page_floats_n_of_top}%
\fi
\let\page_one_command_set_top_insertions_indeed\relax
\fi
@@ -261,69 +263,65 @@
\egroup}
\def\page_one_command_set_bottom_insertions_indeed
- {\ifnum\noffloatinserts<\nofbotfloats\relax
+ {\ifnum\noffloatinserts<\c_page_floats_n_of_bottom\relax
\page_floats_get
- \global\advance\botinserted \ht\floatbox\relax
- \global\advance\botinserted \dp\floatbox\relax
- \global\advance\botinserted \floattopskip\relax
- \ifdim\botinserted<\pagegoal\relax
- \insert\botins
+ \global\advance\d_page_floats_inserted_bottom\dimexpr\ht\floatbox+\dp\floatbox+\d_strc_floats_top\relax
+ \ifdim\d_page_floats_inserted_bottom<\pagegoal\relax
+ \insert\c_page_floats_insertions_bottom
{\forgetall
\blank[\rootfloatparameter\c!spacebefore]%
\page_otr_command_flush_float_box}%
\ifconditional\c_page_floats_some_waiting
\advance\noffloatinserts \plusone
\else
- \noffloatinserts\nofbotfloats
+ \noffloatinserts\c_page_floats_n_of_bottom
\fi
\page_floats_report_flushed
\else
\page_floats_resave\s!text
- \noffloatinserts\nofbotfloats\relax
+ \noffloatinserts\c_page_floats_n_of_bottom\relax
\fi
\global\settrue\c_page_floats_not_permitted % vgl topfloats s!
\else
\ifconditional\c_page_floats_some_waiting
- \showmessage\m!floatblocks7{\the\nofbotfloats}%
+ \showmessage\m!floatblocks7{\the\c_page_floats_n_of_bottom}%
\fi
\let\page_one_command_set_bottom_insertions_indeed\relax
\fi
\page_one_command_set_bottom_insertions_indeed}
-\newconstant\topinserttopskipmode % 1 = no topskip
-
\unexpanded\def\page_one_command_flush_top_insertions
- {\ifvoid\topins\else
+ {\ifvoid\c_page_floats_insertions_top\else
\ifgridsnapping
- \box\topins
+ \box\c_page_floats_insertions_top
\vskip-\topskip
\vskip\strutheight % [xx] new: see icare topbleed
\else
- \ifcase\topinserttopskipmode
+ \ifcase\c_page_floats_insertions_topskip_mode
% 0: default, do nothing
\or
% 1: no topskip (crossed fingers)
\vskip-\topskip
\vskip\strutheight
\fi
- \unvbox\topins
+ \unvbox\c_page_floats_insertions_top
\fi
\fi
- \global\topinserted\zeropoint}
+ \global\d_page_floats_inserted_top\zeropoint}
\unexpanded\def\page_one_command_flush_bottom_insertions
- {\ifvoid\botins\else
+ {\ifvoid\c_page_floats_insertions_bottom\else
\ifgridsnapping
% \floatparameter\c!bottombefore
- \snaptogrid\hbox{\box\botins}%
+ \snaptogrid\hbox{\box\c_page_floats_insertions_bottom}%
% \floatparameter\c!bottomafter
\else
\floatparameter\c!bottombefore
- \unvbox\botins
+ \unvbox\c_page_floats_insertions_bottom
\floatparameter\c!bottomafter
\fi
\fi
- \global\botinserted\zeropoint
+ \global\d_page_floats_inserted_bottom\zeropoint
\global\setfalse\c_page_floats_not_permitted}
\unexpanded\def\page_one_command_flush_floats
@@ -342,7 +340,7 @@
{\ifconditional\c_page_floats_center_box \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
+ \snaptogrid\hbox{\box\floatbox}} % was copy
\def\page_one_command_flush_floats_indeed % much in common with OTRSET
{\ifconditional\c_page_floats_some_waiting
@@ -405,10 +403,10 @@
\fi
% should be an option
\endgroup
- \dimen0\dimexpr\pagetotal+\floatheight+\floattopskip-\pageshrink\relax
+ \dimen0\dimexpr\pagetotal+\floatheight+\d_strc_floats_top-\pageshrink\relax
\dimen2\pagegoal
\relax % needed
- \ifcase\textfloatmethod
+ \ifcase\c_page_one_float_method
% method 0 : raw
\or
% method 1 : safe
@@ -426,8 +424,8 @@
\fi}
\unexpanded\def\page_one_command_flush_saved_floats
- {\global\topinserted\zeropoint
- \global\botinserted\zeropoint
+ {\global\d_page_floats_inserted_top\zeropoint
+ \global\d_page_floats_inserted_bottom\zeropoint
\ifconditional\c_page_floats_flushing \else
\page_one_command_set_top_insertions
\page_one_command_set_bottom_insertions
@@ -550,8 +548,8 @@
\page_floats_report_total}
\def\page_one_place_float_bottom_indeed
- {\global\advance\botinserted\dimexpr\ht\floatbox+\dp\floatbox+\floattopskip\relax
- \insert\botins
+ {\global\advance\d_page_floats_inserted_bottom\dimexpr\ht\floatbox+\dp\floatbox+\d_strc_floats_top\relax
+ \insert\c_page_floats_insertions_bottom
{\forgetall
\blank[\rootfloatparameter\c!spacebefore]%
\page_otr_command_flush_float_box}%
diff --git a/tex/context/base/page-set.mkiv b/tex/context/base/page-set.mkiv
index 88382282f..79a2fb211 100644
--- a/tex/context/base/page-set.mkiv
+++ b/tex/context/base/page-set.mkiv
@@ -1286,7 +1286,7 @@
\page_floats_resave\s!text}
\unexpanded\def\page_set_command_flush_float_box
- {\iftestfloatbox\ruledhbox\fi{\box\floatbox}}
+ {\box\floatbox}
\unexpanded\def\page_set_command_flush_floats
{\bgroup
@@ -1984,7 +1984,7 @@
\def\page_set_place_float_bottom{\def\floatmethod{BOTS}\page_set_place_float_slot} % check
\def\OTRSETflushfloatbox % nog verder doorvoeren en meer info in marge
- {\iftestfloatbox\ruledhbox\fi{\box\floatbox}}
+ {\box\floatbox}
\def\page_set_place_float_slot
{\setbox\floatbox\vbox{\page_otr_command_flush_float_box}%
@@ -2020,9 +2020,9 @@
\egroup}
\def\OTRSETdodosettopinserts
- {\ifnum\noffloatinserts<\noftopfloats
+ {\ifnum\noffloatinserts<\c_page_floats_n_of_top
\page_floats_get
- \ifdim\topinserted=\zeropoint\relax
+ \ifdim\d_page_floats_inserted_top=\zeropoint\relax
\settrue\c_page_set_top_of_insert
\else
\setfalse\c_page_set_top_of_insert
@@ -2038,25 +2038,25 @@
\fi
\page_otr_command_flush_float_box
\blank[\rootfloatparameter\c!spaceafter]}%
- \global\advance\topinserted \ht\scratchbox\relax
- \ifdim\topinserted>\vsize % was \textheight\relax
+ \global\advance\d_page_floats_inserted_top \ht\scratchbox\relax
+ \ifdim\d_page_floats_inserted_top>\vsize % was \textheight\relax
\OTRSETresavebox\floatbox
- \noffloatinserts\noftopfloats\relax
- \global\advance\topinserted -\ht\scratchbox
+ \noffloatinserts\c_page_floats_n_of_top\relax
+ \global\advance\d_page_floats_inserted_top -\ht\scratchbox
\let\OTRSETdodosettopinserts\relax % to be tested
\else
- \xdef\totaltopinserted{\the\topinserted}%
- \insert\topins{\forgetall\box\scratchbox}% interlineskip ?
+ \xdef\totaltopinserted{\the\d_page_floats_inserted_top}%
+ \insert\c_page_floats_insertions_top{\forgetall\box\scratchbox}% interlineskip ?
\ifconditional\c_page_floats_some_waiting
\advance\noffloatinserts \plusone
\else
- \noffloatinserts\noftopfloats\relax
+ \noffloatinserts\c_page_floats_n_of_top\relax
\fi
\page_floats_report_flushed
\fi
\else
\ifconditional\c_page_floats_some_waiting
- \showmessage\m!floatblocks6{\the\noftopfloats}%
+ \showmessage\m!floatblocks6{\the\c_page_floats_n_of_top}%
\fi
\let\OTRSETdodosettopinserts\relax
\fi
@@ -2071,60 +2071,58 @@
\egroup}
\def\OTRSETdodosetbotinserts
- {\ifnum\noffloatinserts<\nofbotfloats\relax
+ {\ifnum\noffloatinserts<\c_page_floats_n_of_bottom\relax
\page_floats_get
- \global\advance\botinserted \ht\floatbox\relax
- \global\advance\botinserted \dp\floatbox\relax
- \global\advance\botinserted \floattopskip\relax
- \ifdim\botinserted<\pagegoal\relax
- \insert\botins
+ \global\advance\d_page_floats_inserted_bottom\dimexpr\ht\floatbox+\dp\floatbox+\d_strc_floats_top\relax
+ \ifdim\d_page_floats_inserted_bottom<\pagegoal\relax
+ \insert\c_page_floats_insertions_bottom
{\forgetall
\blank[\rootfloatparameter\c!spacebefore]%
\page_otr_command_flush_float_box}%
\ifconditional\c_page_floats_some_waiting
\advance\noffloatinserts \plusone
\else
- \noffloatinserts\nofbotfloats
+ \noffloatinserts\c_page_floats_n_of_bottom
\fi
\page_floats_report_flushed
\else
\OTRSETresavebox\floatbox
- \noffloatinserts\nofbotfloats\relax
+ \noffloatinserts\c_page_floats_n_of_bottom\relax
\fi
\global\settrue\c_page_floats_not_permitted % vgl topfloats s!
\else
\ifconditional\c_page_floats_some_waiting
- \showmessage\m!floatblocks7{\the\nofbotfloats}%
+ \showmessage\m!floatblocks7{\the\c_page_floats_n_of_bottom}%
\fi
\let\OTRSETdodosetbotinserts\relax
\fi
\OTRSETdodosetbotinserts}
\unexpanded\def\page_set_command_flush_top_insertions
- {\ifvoid\topins\else
+ {\ifvoid\c_page_floats_insertions_top\else
\ifvoid\columntopbox\mofcolumns
- \columnsettopbox\mofcolumns\box\topins
+ \columnsettopbox\mofcolumns\box\c_page_floats_insertions_top
\else
\columnsettopbox\mofcolumns\vbox % temp, must be better
{\forgetall
\offinterlineskip
\box\columntopbox\mofcolumns
- \box\topins}
+ \box\c_page_floats_insertions_top}
\fi
\fi
- \global\topinserted\zeropoint\relax} % goes away
+ \global\d_page_floats_inserted_top\zeropoint\relax} % goes away
\unexpanded\def\page_set_command_flush_bottom_insertions
- {\ifvoid\botins \else
- \columnsetbotbox\mofcolumns\box\botins
+ {\ifvoid\c_page_floats_insertions_bottom \else
+ \columnsetbotbox\mofcolumns\box\c_page_floats_insertions_bottom
% \else
% \columnsetbotbox\mofcolumns\vbox % temp, must be better
% {\forgetall
% \offinterlineskip
-% \box\botins
+% \box\c_page_floats_insertions_bottom
% \box\columnbotbox\mofcolumns}
\fi
- \global\botinserted\zeropoint\relax} % goes away
+ \global\d_page_floats_inserted_bottom\zeropoint\relax} % goes away
% set ipv text
@@ -2538,8 +2536,8 @@
% \stopcolumnset
\unexpanded\def\page_set_command_flush_saved_floats % rather similar to _one_ ut this might change
- {\global\topinserted\zeropoint
- \global\botinserted\zeropoint
+ {\global\d_page_floats_inserted_top\zeropoint
+ \global\d_page_floats_inserted_bottom\zeropoint
\ifconditional\c_page_floats_flushing \else
\page_set_command_set_top_insertions
\page_set_command_set_bottom_insertions
diff --git a/tex/context/base/page-sid.mkiv b/tex/context/base/page-sid.mkiv
index f3b54e430..69d23b59e 100644
--- a/tex/context/base/page-sid.mkiv
+++ b/tex/context/base/page-sid.mkiv
@@ -68,29 +68,8 @@
\newdimen \d_page_sides_bottomskip
\newdimen \d_page_sides_downshift
-\setnewconstant \c_page_sides_align \zerocount
\setnewconstant \c_page_sides_method \plusone % 0=raw 1=safe (.99) 2=tight (-1pt)
-
-% begin of public variables, this will change
-%
-% we need a setter and resetter .. or maybe a \placesidefloat[settings] to
-% keep variables separated
-
-\let\sidefloatshift \d_page_sides_shift
-\let\sidefloatextrashift\d_page_sides_extrashift
-\let\sidefloatleftshift \d_page_sided_leftshift
-\let\sidefloatrightshift\d_page_sided_rightshift
-\let\sidefloatleftskip \d_page_sides_leftskip
-\let\sidefloatrightskip \d_page_sides_rightskip
-\let\sidefloatmaximum \d_page_sides_maximum
-\let\sidefloattopskip \d_page_sides_topskip
-\let\sidefloatbottomskip\d_page_sides_bottomskip
-\let\sidefloatdownshift \d_page_sides_downshift
-
-\let\sidefloatsidelines \c_page_sides_n_of_lines
-
-\let\sidefloatalign \c_page_sides_align
-\let\sidefloatmethod \c_page_sides_method
+\setnewconstant \c_page_sides_align \zerocount
\def\page_sides_process_float_backspace {\global\c_page_sides_float_type\plusone \page_sides_handle_float}
\def\page_sides_process_float_leftedge {\global\c_page_sides_float_type\plustwo \page_sides_handle_float}
@@ -578,7 +557,7 @@
\else\ifnum\c_page_sides_float_type>\plusfive
\global\d_page_sides_width\zeropoint
\else
- \global\d_page_sides_width\dimexpr\wd\floatbox+\floatsideskip\relax
+ \global\d_page_sides_width\dimexpr\wd\floatbox+\d_strc_floats_margin\relax
\fi\fi
\ifdim\d_page_sides_width<\zeropoint
\global\d_page_sides_width\zeropoint
diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf
index 2a6807dc6..95cd32f6a 100644
--- a/tex/context/base/status-files.pdf
+++ b/tex/context/base/status-files.pdf
Binary files differ
diff --git a/tex/context/base/status-lua.pdf b/tex/context/base/status-lua.pdf
index 273b84d23..1c316874d 100644
--- a/tex/context/base/status-lua.pdf
+++ b/tex/context/base/status-lua.pdf
Binary files differ
diff --git a/tex/context/base/status-mkiv.lua b/tex/context/base/status-mkiv.lua
index 094859290..d5c2f72eb 100644
--- a/tex/context/base/status-mkiv.lua
+++ b/tex/context/base/status-mkiv.lua
@@ -771,7 +771,8 @@ return {
{
filename = "strc-flt",
marktype = "mkvi",
- status = "todo",
+ status = "okay",
+ comment = "in due time we need a further cleanup",
},
{
filename = "page-pst",
diff --git a/tex/context/base/strc-flt.mkvi b/tex/context/base/strc-flt.mkvi
index 06fd02bdc..aaed43b34 100644
--- a/tex/context/base/strc-flt.mkvi
+++ b/tex/context/base/strc-flt.mkvi
@@ -23,8 +23,10 @@
%
% todo: strc_floats_analyze_variables_two could trigger a setup
% and we could have nofmethods of them
-
-% Less globals!
+%
+% todo: move variables from page-flt to strc-flt
+%
+% todo: less globals!
%D This module is being converted into a mkvi one.
%D
@@ -44,7 +46,7 @@
\let\setupcaption \setupfloatcaption
\let\setupcaptions\setupfloatcaption
-\def\dohandlenextfloatindent
+\unexpanded\def\dohandlenextfloatindent
{\useindentnextparameter\floatparameter
\dorechecknextindentation}
@@ -118,7 +120,7 @@
\c!textmethod=\ifgridsnapping2\else0\fi, % 0=raw 1=safe (.99pg) 2=tight (-1pt) % THIS WILL CHANGE
\c!sidemethod=\ifgridsnapping2\else1\fi, % 0=raw 1=safe (.99pg) 2=tight (-1pt) % THIS WILL CHANGE
\c!indentnext=\v!no,
- \c!margin=1em,
+ \c!margin=1\emwidth,
\c!method=1,
\c!cache=\v!yes, % when no, then intermediate flush
\c!leftmargin=\zeropoint, % displacement in 'normal floats'
@@ -129,7 +131,7 @@
\c!rightmargindistance=\floatparameter\c!leftmargindistance,
\c!ntop=2,
\c!nbottom=0,
- \c!nlines=4,
+ \c!nlines=4, % used?
%\c!local=,
%\c!bottombefore=, % e.g. \vfill
%\c!bottomafter=,
@@ -153,36 +155,36 @@
\let\saveddefinefloat\definefloat
\unexpanded\def\definefloat
- {\dotripleempty\dodefinefloat}
+ {\dotripleempty\strc_floats_define}
-\def\dodefinefloat[#1][#2][#3]% #1=naam #2=meervoud #3=parent
+\def\strc_floats_define[#1][#2][#3]% #1=naam #2=meervoud #3=parent
{\ifthirdargument
- \redodefinefloat[#1][#2][#3]%
+ \strc_floats_define_cloned[#1][#2][#3]%
\else\ifsecondargument
- \dododefinefloat[#1][#2]%
+ \strc_floats_define_normal[#1][#2]%
\else
- \dododefinefloat[#1][#1]%
+ \strc_floats_define_normal[#1][#1]%
\fi\fi}
-\def\dododefinefloat[#1][#2]%
+\def\strc_floats_define_normal[#1][#2]%
{\definefloatcaption[#1]%
\definecounter[#1]%
\definelist[#1]%
\presetlabeltext[#1=\Word{#1}~]%
\presetheadtext[#2=\Word{#2}]%
\saveddefinefloat[#1]%
- \dodefinefloatcommands[#1][#2]}
+ \strc_floats_define_commands{#1}{#2}}
-\def\redodefinefloat[#1][#2][#3]%
+\def\strc_floats_define_cloned[#1][#2][#3]%
{\definefloatcaption[#1][#3]%
\definecounter[#1][#3]%
\definelist[#1][#3]%
\presetlabeltext[#1=\Word{#3}~]%
\presetheadtext[#2=\Word{#2}]%
\saveddefinefloat[#1][#3]%
- \dodefinefloatcommands[#1][#2]}
+ \strc_floats_define_commands{#1}{#2}}
-\def\dodefinefloatcommands[#1][#2]%
+\def\strc_floats_define_commands#1#2%
{\setuvalue {\e!place\e!listof#2}{\dodoubleempty\strc_lists_place[#1]}% call will change
\setuvalue {\e!complete\e!listof#2}{\dotripleempty\strc_lists_complete_indeed[#1][#2]}% call will change
\setuevalue {\e!place#1}{\strc_floats_place{#1}}%
@@ -254,11 +256,11 @@
% begin of todo
-\unexpanded\def\placefloatcaption{\dodoubleempty\doplacefloatcaption}
-\unexpanded\def\setfloatcaption {\dodoubleempty\dodosetfloatcaption}
+\unexpanded\def\placefloatcaption{\dodoubleempty\strc_floats_place_caption}
+\unexpanded\def\setfloatcaption {\dodoubleempty\strc_floats_set_caption}
-\def\doplacefloatcaption[#tag][#reference]#caption{[not supported]}
-\def\dodosetfloatcaption[#tag][#reference]#caption{[not supported]} % \dosetfloatcaption already in use
+\def\strc_floats_place_caption[#tag][#reference]#caption{[not supported]}
+\def\strc_floats_set_caption [#tag][#reference]#caption{[not supported]}
\unexpanded\def\placefloatcaptiontext [#tag]{[not suported yet]}
\unexpanded\def\placefloatcaptionnumber [#tag]{[not suported yet]}
@@ -569,15 +571,18 @@
% special hack
-\def\strc_floats_begin_group {\begingroup}
-\def\strc_floats_end_group {\carryoverpar\endgroup}
-\def\strc_floats_end_split_group {\endgroup}
-
-\def\strc_floats_begin_text_group {\begingroup\let\strc_floats_end_group\relax}
-\def\strc_floats_end_text_group {\endgroup}
+\def\strc_floats_begin_group {\begingroup}
+\def\strc_floats_end_group {\carryoverpar\endgroup}
+\def\strc_floats_end_split_group {\endgroup}
+\def\strc_floats_begin_text_group{\begingroup\let\strc_floats_end_group\relax}
+\def\strc_floats_end_text_group {\endgroup}
% implementation
+%setnewconstant\c_page_one_float_method \zerocount % 0=raw 1=safe (.99) 2=tight (-1pt) / belongs in page-one
+\setnewconstant\c_strc_floats_rotation \zerocount % 0 90 180 270
+\newconditional\c_strc_floats_par_float
+
\ifdefined\page_margin_strc_floats_before \else \let\page_margin_strc_floats_before \relax \fi
\ifdefined\page_margin_strc_floats_set_hsize \else \let\page_margin_strc_floats_set_hsize\relax \fi
@@ -628,63 +633,58 @@
\strc_floats_place_packaged_boxes
\dostoptagged % tricky ... needs checking
% we need to carry over the par because of side floats
- \global\sidefloatdownshift \zeropoint
- \global\sidefloatextrashift\zeropoint
- \ifparfloat
+ \global\d_page_sides_downshift \zeropoint
+ \global\d_page_sides_extrashift\zeropoint
+ \ifconditional\c_strc_floats_par_float
\doifinset\v!reset\floatlocation\page_sides_forget_floats
\doinhibitblank
\fi
\strc_floats_end_group}
-\setnewconstant\textfloatmethod\zerocount % 0=raw 1=safe (.99) 2=tight (-1pt)
-\setnewconstant\floatrotation \zerocount % 0 90 180 270
-
% nicer is a bunch of states and one loop that sets those states
\def\strc_floats_analyze_variables_two
{\ifinsidecolumns
- \global\parfloatfalse
+ \global\setfalse\c_strc_floats_par_float
\else
- \doifcommonelse
- {\floatlocation}
- {\flushfloatslist}
- {\global\parfloattrue}
- {\global\parfloatfalse}%
+ \doifcommonelse\floatlocation\flushfloatslist
+ {\global\settrue \c_strc_floats_par_float}
+ {\global\setfalse\c_strc_floats_par_float}%
\fi
- \global\sidefloatshift\zeropoint
- \global\sidefloatmaximum\zeropoint
- \global\sidefloatmethod\floatparameter\c!sidemethod
- \global\textfloatmethod\floatparameter\c!textmethod
- \global\sidefloatalign\zerocount
- \global\floatrotation\zerocount
+ \global\d_page_sides_shift \zeropoint
+ \global\d_page_sides_maximum \zeropoint
+ \global\c_page_sides_method \floatparameter\c!sidemethod
+ \global\c_page_one_float_method\floatparameter\c!textmethod
+ \global\c_page_sides_align \zerocount
+ \global\c_strc_floats_rotation \zerocount
\strc_floats_calculate_skips
- \ifparfloat
+ \ifconditional\c_strc_floats_par_float
\processaction
[\floatparameter\c!sidealign]
- [\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]%
- \ifcase\sidefloatalign\relax % todo: optie v!lokaal => \else
- \doifinset\v!height \floatlocation{\global\sidefloatalign\plusone}%
- \doifinset\v!line \floatlocation{\global\sidefloatalign\plustwo}%
- \doifinset\v!depth \floatlocation{\global\sidefloatalign\plusthree}%
- \doifinset\v!grid \floatlocation{\global\sidefloatalign\plusfour}%
- \doifinset\v!halfline\floatlocation{\global\sidefloatalign\plusfive}% meant for 'none'
+ [\v!height=>\global\c_page_sides_align\plusone ,%
+ \v!line=>\global\c_page_sides_align\plustwo ,% (***)
+ \v!depth=>\global\c_page_sides_align\plusthree,%
+ \v!grid=>\global\c_page_sides_align\plusfour ,%
+ \v!halfline=>\global\c_page_sides_align\plusfive ]%
+ \ifcase\c_page_sides_align\relax % todo: optie v!lokaal => \else
+ \doifinset\v!height \floatlocation{\global\c_page_sides_align\plusone }%
+ \doifinset\v!line \floatlocation{\global\c_page_sides_align\plustwo }%
+ \doifinset\v!depth \floatlocation{\global\c_page_sides_align\plusthree}%
+ \doifinset\v!grid \floatlocation{\global\c_page_sides_align\plusfour }%
+ \doifinset\v!halfline\floatlocation{\global\c_page_sides_align\plusfive }% meant for 'none'
\fi
- \doifinset\v!high\floatlocation{\global\sidefloattopskip \zeropoint}%
- \doifinset\v!low \floatlocation{\global\sidefloatbottomskip\zeropoint}%
+ \doifinset\v!high\floatlocation{\global\d_page_sides_topskip \zeropoint}%
+ \doifinset\v!low \floatlocation{\global\d_page_sides_bottomskip\zeropoint}%
\doifinset\v!fit \floatlocation
- {\global\sidefloattopskip \zeropoint
- \global\sidefloatbottomskip\zeropoint
- \global\floatsideskip \zeropoint}%
+ {\global\d_page_sides_topskip \zeropoint
+ \global\d_page_sides_bottomskip\zeropoint
+ \global\floatsideskip \zeropoint}%
\else
\processallactionsinset
[\floatlocation]
- [ 90=>\global\floatrotation\commalistelement\relax,%
- 180=>\global\floatrotation\commalistelement\relax,%
- 270=>\global\floatrotation\commalistelement\relax]%
+ [ 90=>\global\c_strc_floats_rotation\commalistelement\relax,%
+ 180=>\global\c_strc_floats_rotation\commalistelement\relax,%
+ 270=>\global\c_strc_floats_rotation\commalistelement\relax]%
\fi
\doifinsetelse\v!nonumber\floatlocation
{\global\nofloatnumbertrue}
@@ -812,16 +812,6 @@
\strc_floats_get_box
\global\insidefloatfalse}
-% \def\strc_floats_set_local_hsize
-% {\ifconditional\c_page_floats_center_box_local
-% \seteffectivehsize
-% \hsize\localhsize
-% \else
-% \doifinset\v!margin\floatlocation % brr, really needed! see wm will be redone
-% {\let\currentmarginblock\empty
-% \hsize\marginblockparameter\c!width}%
-% \fi}
-
\newdimen\availablefloatwidth
\newdimen\availablefloatheight
@@ -874,18 +864,18 @@
% watch out: line alone aligns on the line ! ! !
\unexpanded\def\movesidefloat[#settings]% (-)n*line|x=,y=
- {\global\sidefloatdownshift \zeropoint
- \global\sidefloatextrashift\zeropoint
+ {\global\d_page_sides_downshift \zeropoint
+ \global\d_page_sides_extrashift\zeropoint
\doifassignmentelse{#settings}%
{\begingroup
\setupcurrentfloat[\c!x=\zeropoint,\c!y=\zeropoint,#settings]%
\ifgridsnapping
\getnoflines{\floatparameter\c!y}%
- \global\sidefloatdownshift\noflines\lineheight
+ \global\d_page_sides_downshift\noflines\lineheight
\else
- \global\sidefloatdownshift\floatparameter\c!y
+ \global\d_page_sides_downshift\floatparameter\c!y
\fi
- \global\sidefloatextrashift\floatparameter\c!x
+ \global\d_page_sides_extrashift\floatparameter\c!x
\endgroup}
{\movedownsidefloat[#settings]}}
@@ -905,17 +895,17 @@
\def\strc_floats_move_down_line#sign%
{\if!!donea \else
- \global\sidefloatdownshift\zeropoint
+ \global\d_page_sides_downshift\zeropoint
\!!doneatrue
\fi
- \global\advance\sidefloatdownshift#sign\lineheight}
+ \global\advance\d_page_sides_downshift#sign\lineheight}
\def\strc_floats_move_down_hang#lines%
{\if!!doneb \else
- \global\sidefloatsidelines\zerocount
+ \global\c_page_sides_n_of_lines\zerocount
\!!donebtrue
\fi
- \global\advance\sidefloatsidelines#lines\relax}
+ \global\advance\c_page_sides_n_of_lines#lines\relax}
\unexpanded\def\movedownsidefloat[#settings]% already in core
{\doifnotinstring{:}{#settings}
@@ -926,7 +916,7 @@
\endgroup}}
\unexpanded\def\hangsidefloat[#number]%
- {\global\sidefloatsidelines#number\relax}
+ {\global\c_page_sides_n_of_lines#number\relax}
\def\strc_floats_set_extra_action#rightpagelocation#leftpagelocation%
{\rightorleftpageaction
@@ -952,7 +942,7 @@
\def\strc_floats_check_extra_actions % less tracingthis way ...
{\doifnotinset\v!text\floatlocation % fuzzy, text overloads left, since then it's a directive
{\let\extrafloatlocation\empty
- % \sidefloatdownshift will be reset afterwards, and can
+ % \d_page_sides_downshift will be reset afterwards, and can
% already be set at this point
\processcommacommand[\floatlocation]\strc_floats_check_extra_actions_step
\ifx\extrafloatlocation\empty \else
@@ -967,11 +957,11 @@
% pas op, maxbreedte niet instellen als plaats=links/rechts
\def\strc_floats_set_local_dimensions
- {\global\sidefloatshift \zeropoint % duplicate
- \global\sidefloatmaximum\zeropoint\relax % duplicate
- \ifdim\sidefloatdownshift=\zeropoint\else
+ {\global\d_page_sides_shift \zeropoint % duplicate
+ \global\d_page_sides_maximum\zeropoint\relax % duplicate
+ \ifdim\d_page_sides_downshift=\zeropoint\else
\global\setbox\floatbox\vbox
- {\vskip\sidefloatdownshift
+ {\vskip\d_page_sides_downshift
\nointerlineskip
\box\floatbox}%
\fi
@@ -998,7 +988,7 @@
\scratchwidth\p_maxwidth\relax
\ifdim\wd\floatbox>\scratchwidth
\doifcommonelse{\v!inright,\v!rightmargin,\v!rightedge,\v!inleft,\v!leftmargin,\v!leftedge}\floatlocation
- {\global\sidefloatmaximum\scratchwidth}
+ {\global\d_page_sides_maximum\scratchwidth}
{\doifcommonelse{\v!right,\v!left}\floatlocation
\strc_floats_realign_floatbox_horizontal_one
\strc_floats_realign_floatbox_horizontal_two}%
@@ -1020,20 +1010,9 @@
\unexpanded\def\placefloats
{\page_otr_command_flush_floats}
-\installinsertion\topins
-\installinsertion\botins
-
-\newdimen\botinserted
-\newdimen\topinserted
-
-\newif\iftestfloatbox
-
-\newdimen\floatsideskip \floatsideskip 12pt
-\newdimen\floattopskip \floattopskip \floattopskip
-\newdimen\floatbottomskip \floatbottomskip \floattopskip
-
-\newcount\noftopfloats \noftopfloats=2
-\newcount\nofbotfloats \nofbotfloats=0
+\newdimen\d_strc_floats_margin
+\newdimen\d_strc_floats_top
+\newdimen\d_strc_floats_bottom
\def\strc_floats_calculate_skip#target#skip%
{\edef\askedfloatskip{#skip}%
@@ -1048,29 +1027,17 @@
\def\strc_floats_calculate_skips
{\begingroup
- \strc_floats_calculate_skip\floattopskip {\rootfloatparameter\c!spacebefore}%
- \strc_floats_calculate_skip\floatbottomskip {\rootfloatparameter\c!spaceafter}%
- \strc_floats_calculate_skip\sidefloattopskip {\rootfloatparameter\c!sidespacebefore}%
- \strc_floats_calculate_skip\sidefloatbottomskip{\rootfloatparameter\c!sidespaceafter}%
- \global\floatsideskip \rootfloatparameter\c!margin
- \global\sidefloatleftshift \floatparameter\c!leftmargindistance
- \global\sidefloatrightshift\floatparameter\c!rightmargindistance
- \global\noftopfloats \rootfloatparameter\c!ntop\relax
- \global\nofbotfloats \rootfloatparameter\c!nbottom\relax
+ \strc_floats_calculate_skip\d_strc_floats_top {\rootfloatparameter\c!spacebefore }%
+ \strc_floats_calculate_skip\d_strc_floats_bottom {\rootfloatparameter\c!spaceafter }%
+ \strc_floats_calculate_skip\d_page_sides_topskip {\rootfloatparameter\c!sidespacebefore}%
+ \strc_floats_calculate_skip\d_page_sides_bottomskip{\rootfloatparameter\c!sidespaceafter }%
+ \global\d_strc_floats_margin \rootfloatparameter\c!margin
+ \global\d_page_sided_leftshift \floatparameter \c!leftmargindistance
+ \global\d_page_sided_rightshift\floatparameter \c!rightmargindistance
+ \global\c_page_floats_n_of_top \rootfloatparameter\c!ntop
+ \global\c_page_floats_n_of_bottom \rootfloatparameter\c!nbottom
\endgroup}
-% beter de laatste skip buiten de \insert uitvoeren,
-% bovendien bij volle flush onder baseline.
-
-% \def\betweenfloatblanko% assumes that spaceafter is present
-% {\bgroup
-% \setbox0\vbox{\strut\blank[\rootfloatparameter\c!spacebefore]\strut}%
-% \setbox2\vbox{\strut\blank[\rootfloatparameter\c!spaceafter]\strut}%
-% \ifdim\ht0>\ht2
-% \blank[-\rootfloatparameter\c!spaceafter,\rootfloatparameter\c!spacebefore]%
-% \fi
-% \egroup}
-
\unexpanded\def\betweenfloatblanko% assumes that spaceafter is present
{\blank[\rootfloatparameter\c!spacebefore]} % or v!back,....
@@ -1092,20 +1059,16 @@
\def\page_one_place_float_text % this macro should be defined elsewhere
{%\checkwaitingfloats\floatlocationmethod
% todo: check if #1 is indeed \floatlocation or maybe more
- \global\floattextwidth\hsize
- \global\floatwidth\wd\floatbox
- \global\floatheight\ht\floatbox % forget about the depth
- \global\advance\floattextwidth -\floatwidth
- \global\advance\floattextwidth -\rootfloatparameter\c!margin\relax
+ \global\floatwidth \wd\floatbox
+ \global\floatheight \ht\floatbox % forget about the depth
+ \global\floattextwidth\dimexpr\hsize-\floatwidth-\rootfloatparameter\c!margin\relax
\edef\floatlocation{\floatlocationmethod}% to be sure .. why
\doifinsetelse\v!tall\floatlocationmethod
- {\floattextheight\pagegoal
- \advance\floattextheight -\pagetotal
- \advance\floattextheight -\bigskipamount % lelijk
+ {\floattextheight\dimexpr\pagegoal-\pagetotal-\bigskipamount\relax % ugly, this bigskip
\ifdim\floattextheight>\textheight
\floattextheight\textheight
\fi
- \boxmaxdepth\zeropoint \relax % toegevoegd
+ \boxmaxdepth\zeropoint\relax % toegevoegd
\ifdim\floattextheight<\floatheight
\floattextheight\floatheight
\fi
@@ -1122,11 +1085,7 @@
\def\strc_floats_stop_text_indeed
{\egroup
\doifnotinset\v!tall\floatlocation
- {\ifdim\ht\floattext<\floatheight
- \floattextheight\floatheight
- \else
- \floattextheight\ht\floattext
- \fi}%
+ {\floattextheight\ifdim\ht\floattext<\floatheight\floatheight\else\ht\floattext\fi}%
\setbox\floatbox\vbox to \floattextheight
{\hsize\floatwidth
\doifinsetelse\v!both\floatlocation
@@ -1193,11 +1152,16 @@
\alignedline{\floatparameter\c!location}\v!middle}
\newdimen\d_strc_floats_content
+\newdimen\d_strc_float_temp_height
+\newdimen\d_strc_float_temp_width
+
+\def\captionminwidth {15\bodyfontsize}
+\def\captionovershoot{2\emwidth}
\def\strc_floats_set_page_variant
{\bgroup
\strc_floats_set_local_hsize
- \ifcase\floatrotation\else
+ \ifcase\c_strc_floats_rotation\else
\swapdimens\hsize\vsize
\fi
\forgetall
@@ -1207,9 +1171,11 @@
\let\strc_floats_align_content\strc_floats_align_content_indeed
\let\strc_floats_align_caption\strc_floats_align_caption_indeed
\strc_floats_check_caption_content
-\d_strc_floats_content\wd\b_strc_floats_content
+ \d_strc_floats_content\wd\b_strc_floats_content
\ifcase\floatparameter\c!method
- \or % automatic
+ % nothing
+ \or
+ % automatic
\ifnofloatcaption
\strc_floats_prepare_no_caption
%\page_backgrounds_add_local_to_box\floatbox % was \doglobal but not needed
@@ -1223,21 +1189,20 @@
%\page_backgrounds_add_local_to_box\b_strc_floats_caption
\strc_floats_build_box
\fi
- \or % semi automatic
- \or % manual
+ \or
+ % semi automatic
+ \or
+ % manual
\fi
- \ifcase\floatrotation
+ \ifcase\c_strc_floats_rotation
\doifnotinset\v!margin\floatlocation % brr, really needed! see wm
{\postcenterfloatbox\d_strc_floats_content}%
\else
\global\setbox\floatbox\vbox
- {\rotate[\c!rotation=\number\floatrotation]{\box\floatbox}}%
+ {\rotate[\c!rotation=\number\c_strc_floats_rotation]{\box\floatbox}}%
\fi
\egroup}
-\def\captionminwidth {15\bodyfontsize}
-\def\captionovershoot {2em}
-
\def\strc_floats_prepare_no_caption
{\global\setbox\floatbox\vbox % pas op als wd groter dan hsize
{\ifinsidecolumns\ifdim\wd\b_strc_floats_content>\hsize
@@ -1245,87 +1210,78 @@
\fi\fi
\strc_floats_align_content{\copy\b_strc_floats_content}}}
+% \def\strc_floats_prepare_page_caption
+% {\dostarttagged\t!floatcaption\empty
+% \edef\p_strc_floats_caption_location{\floatcaptionparameter\c!location}%
+% \edef\p_strc_floats_caption_align {\floatcaptionparameter\c!align}%
+% \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
+% {\strc_floats_prepare_stack_caption_max}
+% {\ifdim\wd\b_strc_floats_caption>\wd\b_strc_floats_content % wider caption
+% \doifelse{\floatcaptionparameter\c!width}\v!fit
+% {\strc_floats_prepare_stack_caption_auto}
+% {\strc_floats_prepare_stack_caption_width}%
+% \else
+% \strc_floats_prepare_stack_caption_min
+% \fi}}
+% {\strc_floats_prepare_stack_caption_fixed}}%
+% {\strc_floats_prepare_side_width_caption}}% new, special effects (see icare)
+% {\doifinsetelse{\floatcaptionparameter\c!width}{\v!fit,\v!max}
+% {\strc_floats_prepare_side_auto_caption}
+% {\strc_floats_prepare_side_width_caption}}%
+% \dostoptagged}
+
\def\strc_floats_prepare_page_caption
- {\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
- {\dopreparestackcaptionmax}
- {\ifdim\wd\b_strc_floats_caption>\wd\b_strc_floats_content % wider caption
- \doifelse{\floatcaptionparameter\c!width}\v!fit
- {\dopreparestackcaptionaut}
- {\dopreparestackcaptionwid}%
- \else
- \dopreparestackcaptionmin
- \fi}}
- {\dopreparestackcaptionfix}}%
- {\dopreparesidewidthcaption}}% new, special effects (see icare)
- {\doifinsetelse{\floatcaptionparameter\c!width}{\v!fit,\v!max}
- {\dopreparesideautocaption}
- {\dopreparesidewidthcaption}}%
- \dostoptagged}
-
-% makes sense if we preexpand more variables
+ {\edef\p_strc_floats_caption_location{\floatcaptionparameter\c!location}%
+ \edef\p_strc_floats_caption_width {\floatcaptionparameter\c!width}%
+ \edef\p_strc_floats_caption_minwidth{\floatcaptionparameter\c!minwidth}%
+ \edef\p_strc_floats_caption_align {\floatcaptionparameter\c!align}%
+ \dostarttagged\t!floatcaption\empty
+ \ifx\p_strc_floats_caption_location\v!top
+ \strc_floats_prepare_page_caption_top_bottom
+ \else\ifx\p_strc_floats_caption_location\v!bottom
+ \strc_floats_prepare_page_caption_top_bottom
+ \else\ifx\p_strc_floats_caption_width\v!fit
+ \strc_floats_prepare_side_auto_caption
+ \else\ifx\p_strc_floats_caption_width\v!max
+ \strc_floats_prepare_side_auto_caption
+ \else
+ \strc_floats_prepare_side_width_caption
+ \fi\fi\fi\fi
+ \dostoptagged}
-% \def\strc_floats_prepare_page_caption
-% {\edef\p_caption_location{\floatcaptionparameter\c!location}%
-% \edef\p_caption_width {\floatcaptionparameter\c!width}%
-% \edef\p_caption_minwidth{\floatcaptionparameter\c!minwidth}%
-% \edef\p_caption_align {\floatcaptionparameter\c!align}%
-% \dostarttagged\t!floatcaption\empty
-% \ifx\p_caption_location\v!top
-% \strc_floats_prepare_page_caption_top_bottom
-% \else\ifx\p_caption_location\v!bottom
-% \strc_floats_prepare_page_caption_top_bottom
-% \else\ifx\p_caption_width\v!fit
-% \dopreparesideautocaption
-% \else\ifx\p_caption_width\v!max
-% \dopreparesideautocaption
-% \else
-% \dopreparesidewidthcaption
-% \fi\fi\fi\fi
-% \dostoptagged}
-
-% \def\strc_floats_prepare_page_caption_top_bottom
-% {\ifx\p_caption_width\v!fit
-% \strc_floats_prepare_page_caption_top_bottom_fit_max
-% \else\ifx\p_caption_width\v!max
-% \strc_floats_prepare_page_caption_top_bottom_fit_max
-% \else
-% \dopreparesidewidthcaption % new, special effects (see icare)
-% \fi\fi}
-
-% \def\strc_floats_prepare_page_caption_top_bottom_fit_max
-% {\ifx\p_caption_minwidth\v!fit
-% \ifx\p_caption_width\v!max
-% \dopreparestackcaptionmax
-% \else\ifdim\wd\b_strc_floats_caption>\wd\b_strc_floats_content % wider caption
-% \ifx\p_caption_width\v!fit
-% \dopreparestackcaptionaut
-% \else
-% \dopreparestackcaptionwid
-% \fi
-% \else
-% \dopreparestackcaptionmin
-% \fi\fi
-% \else
-% \dopreparestackcaptionfix
-% \fi}
-
-% \def\dopreparestackcaptionmin
-% {\setbox\b_strc_floats_caption\vbox
-% {\strc_floats_caption_set_align
-% \hsize\wd\b_strc_floats_content
-% \ifx\p_caption_align\empty
-% \raggedcenter % on purpose overloads align !
-% \fi
-% \strc_floats_make_complete_caption}}
+\def\strc_floats_prepare_page_caption_top_bottom
+ {\ifx\p_strc_floats_caption_width\v!fit
+ \strc_floats_prepare_page_caption_top_bottom_fit_max
+ \else\ifx\p_strc_floats_caption_width\v!max
+ \strc_floats_prepare_page_caption_top_bottom_fit_max
+ \else
+ \strc_floats_prepare_side_width_caption % new, special effects (see icare)
+ \fi\fi}
+
+\def\strc_floats_prepare_page_caption_top_bottom_fit_max
+ {\ifx\p_strc_floats_caption_minwidth\v!fit
+ \ifx\p_strc_floats_caption_width\v!max
+ \strc_floats_prepare_stack_caption_max
+ \else\ifdim\wd\b_strc_floats_caption>\wd\b_strc_floats_content % wider caption
+ \ifx\p_strc_floats_caption_width\v!fit
+ \strc_floats_prepare_stack_caption_auto
+ \else
+ \strc_floats_prepare_stack_caption_width
+ \fi
+ \else
+ \strc_floats_prepare_stack_caption_min
+ \fi\fi
+ \else
+ \strc_floats_prepare_stack_caption_fixed
+ \fi}
\def\strc_floats_caption_set_align
- {\normalexpanded{\setupalign[\v!reset,\floatcaptionparameter\c!align]}}
+ {\normalexpanded{\setupalign[\v!reset,\p_strc_floats_caption_align]}}
-\def\dopreparesideautocaption
+\def\strc_floats_prepare_side_auto_caption
{\scratchdimen\dimexpr\hsize-\wd\b_strc_floats_content-\floatparameter\c!margin\relax
\ifdim\wd\b_strc_floats_caption>\scratchdimen
\ifdim\wd\b_strc_floats_caption<1.3\scratchdimen
@@ -1337,41 +1293,43 @@
\hsize\scratchdimen
\strc_floats_make_complete_caption}}
-\def\dopreparesidewidthcaption
+\def\strc_floats_prepare_side_width_caption
{\setbox\b_strc_floats_caption\vbox
{\strc_floats_caption_set_align
\hsize\floatcaptionparameter\c!width
\strc_floats_make_complete_caption}}
-\def\dopreparestackcaptionfix
+\def\strc_floats_prepare_stack_caption_fixed
{\setbox\b_strc_floats_caption\vbox
{\strc_floats_caption_set_align
\hsize\floatcaptionparameter\c!minwidth % special effects
\strc_floats_make_complete_caption}}
-\def\dopreparestackcaptionmax
+\def\strc_floats_prepare_stack_caption_max
{\setbox\b_strc_floats_caption\vbox
{\strc_floats_caption_set_align
\hsize\wd\b_strc_floats_content
\strc_floats_make_complete_caption}}
-\def\dopreparestackcaptionwid
+\def\strc_floats_prepare_stack_caption_width
{\setbox\b_strc_floats_caption\vbox
{\strc_floats_caption_set_align
\hsize\floatcaptionparameter\c!width
\strc_floats_make_complete_caption}}
-\def\dopreparestackcaptionmin
+\def\strc_floats_prepare_stack_caption_min
{\setbox\b_strc_floats_caption\vbox
{\strc_floats_caption_set_align
\hsize\wd\b_strc_floats_content
- \doifnothing{\floatcaptionparameter\c!align}\raggedcenter % on purpose overloads align !
+ \ifx\p_strc_floats_caption_align\empty
+ \raggedcenter % on purpose overloads align !
+ \fi
\strc_floats_make_complete_caption}}
-\def\dopreparestackcaptionaut
- {\doifsomething{\floatcaptionparameter\c!align}
- {\doifnotinset\v!middle{\floatcaptionparameter\c!align}%
- {\let\captionovershoot\!!zeropoint}}%
+\def\strc_floats_prepare_stack_caption_auto
+ {\ifx\p_strc_floats_caption_align\empty \else
+ \doifnotinset\v!middle\p_strc_floats_caption_align{\let\captionovershoot\!!zeropoint}%
+ \fi
\edef\captionhsize{\the\wd\b_strc_floats_content}%
\ifdim\captionhsize>\hsize
% float is wider than \hsize
@@ -1384,8 +1342,7 @@
\ifdim\ht\scratchbox>\lineheight % more lines
\setbox\b_strc_floats_caption\vbox
{\strc_floats_caption_set_align
- \hsize\captionhsize
- \advance\hsize -\captionovershoot\relax
+ \hsize\dimexpr\captionhsize-\captionovershoot\relax
\ifdim\hsize<\captionminwidth\relax
\hsize\captionhsize
\fi
@@ -1404,175 +1361,176 @@
\fi
\setbox\scratchbox\vbox % test with overshoot
{\settrialtypesetting
- \scratchdimen\captionhsize
- \advance\scratchdimen \captionovershoot
- \advance\scratchdimen 3em % an average word length
- \ifdim\scratchdimen<\hsize \hsize\scratchdimen \fi
+ \scratchdimen\dimexpr\captionhsize+\captionovershoot+3\emwidth\relax % 3em is an average word length
+ \ifdim\scratchdimen<\hsize
+ \hsize\scratchdimen
+ \fi
\notesenabledfalse
\strc_floats_make_complete_caption}%
\ifdim\ht\scratchbox>\lineheight
% at least an average word longer than a line
\setbox\b_strc_floats_caption\vbox
{\strc_floats_caption_set_align
- \scratchdimen\captionhsize
- \advance\scratchdimen \captionovershoot
- \ifdim\scratchdimen<\hsize \hsize\scratchdimen \fi
+ \scratchdimen\dimexpr\captionhsize+\captionovershoot\relax
+ \ifdim\scratchdimen<\hsize
+ \hsize\scratchdimen
+ \fi
+ \strc_floats_make_complete_caption}%
+ \else\ifx\p_strc_floats_caption_align\empty
+ \setbox\b_strc_floats_caption\vbox
+ {\strc_floats_caption_set_align
+ \hsize\captionhsize
+ \raggedcenter % overloads
\strc_floats_make_complete_caption}%
\else
- % just over a line, don't use an overshoot % % % todo: outer/inner and such
- \doifcommonelse{\floatcaptionparameter\c!align}{\v!left,\v!right,\v!flushleft,\v!flushright}
- {\setbox\b_strc_floats_caption\vbox
- {\strc_floats_caption_set_align
- \hsize\captionhsize
- % strange : \raggedcenter
- \strc_floats_make_complete_caption}}
- {% nicer
- \setbox\b_strc_floats_caption\vbox
- {\strc_floats_caption_set_align
- \hsize\captionhsize
- \doifnothing{\floatcaptionparameter\c!align}\raggedcenter% overloads
- \strc_floats_make_complete_caption}}%
- \fi
+ \setbox\b_strc_floats_caption\vbox
+ {\strc_floats_caption_set_align
+ \hsize\captionhsize
+ \strc_floats_make_complete_caption}%
+ \fi\fi
\fi}
-\newdimen\tempfloatheight
-\newdimen\tempfloatwidth
+\def\strc_floats_between_stack
+ {\endgraf
+ \nointerlineskip
+ \floatcaptionparameter\c!inbetween
+ \endgraf}
-\def\dofloatboxbetweenstack
- {\endgraf\nointerlineskip\floatcaptionparameter\c!inbetween\endgraf}
-
-\def\dofloatboxdefaultbuilder % done
+\def\strc_floats_build_box_default % done
{\strc_floats_align_content{\box\b_strc_floats_content}}
-\def\dofloatboxnextrightbuilder#1%
- {\ifparfloat \hbox \else \expandafter \strc_floats_align_content \fi
- {\tempfloatheight\ht\b_strc_floats_content
+\def\strc_floats_build_box_next_right#1%
+ {\ifconditional\c_strc_floats_par_float \hbox \else \expandafter \strc_floats_align_content \fi
+ {\d_strc_float_temp_height\ht\b_strc_floats_content
\box\b_strc_floats_content
\normalexpanded{\noexpand\doifnotinset{\v!hang}{\floatcaptionparameter\c!location}}{\dotfskip{\floatcaptionparameter\c!distance}}%
- \vbox to\tempfloatheight{#1}}}
+ \vbox to\d_strc_float_temp_height{#1}}}
-\def\dofloatboxnextleftbuilder#1%
- {\ifparfloat \hbox \else \expandafter \strc_floats_align_content \fi
- {\tempfloatheight\ht\b_strc_floats_content
- \vbox to\tempfloatheight{#1}%
+\def\strc_floats_build_box_next_left#1%
+ {\ifconditional\c_strc_floats_par_float \hbox \else \expandafter \strc_floats_align_content \fi
+ {\d_strc_float_temp_height\ht\b_strc_floats_content
+ \vbox to\d_strc_float_temp_height{#1}%
\normalexpanded{\noexpand\doifnotinset{\v!hang}{\floatcaptionparameter\c!location}}{\dotfskip{\floatcaptionparameter\c!distance}}%
\box\b_strc_floats_content}}
-\def\dofloatboxnextouterbuilder
- {\doifrightpagefloatelse\dofloatboxnextrightbuilder\dofloatboxnextleftbuilder}
+\def\strc_floats_build_box_next_outer
+ {\doifrightpagefloatelse\strc_floats_build_box_next_right\strc_floats_build_box_next_left}
-\def\dofloatboxnextinnerbuilder
- {\doifrightpagefloatelse\dofloatboxnextleftbuilder\dofloatboxnextrightbuilder}
+\def\strc_floats_build_box_next_inner
+ {\doifrightpagefloatelse\strc_floats_build_box_next_left\strc_floats_build_box_next_right}
-\def\dofloatboxnextrighthangbuilder#1%
- {\ifparfloat \hbox \else \expandafter \strc_floats_align_content \fi
- {\tempfloatheight\ht\b_strc_floats_content
+\def\strc_floats_build_box_next_right_hang#1%
+ {\ifconditional\c_strc_floats_par_float \hbox \else \expandafter \strc_floats_align_content \fi
+ {\d_strc_float_temp_height\ht\b_strc_floats_content
\box\b_strc_floats_content
- \vbox to\tempfloatheight{#1}}}
+ \vbox to\d_strc_float_temp_height{#1}}}
-\def\dofloatboxnextlefthangbuilder#1%
- {\ifparfloat \hbox \else \expandafter \strc_floats_align_content \fi
- {\tempfloatheight\ht\b_strc_floats_content
- \vbox to\tempfloatheight{#1}%
+\def\strc_floats_build_box_next_left_hang#1%
+ {\ifconditional\c_strc_floats_par_float \hbox \else \expandafter \strc_floats_align_content \fi
+ {\d_strc_float_temp_height\ht\b_strc_floats_content
+ \vbox to\d_strc_float_temp_height{#1}%
\box\b_strc_floats_content}}
-\def\dodofloatboxnextrightmarginbuilder#1#2%
- {\ifparfloat
+\def\strc_floats_build_box_next_right_margin_indeed#1#2%
+ {\ifconditional\c_strc_floats_par_float
\hbox\bgroup
- \tempfloatheight\ht\b_strc_floats_content
+ \d_strc_float_temp_height\ht\b_strc_floats_content
\box\b_strc_floats_content
- \hsmash{\hskip#1\vbox to\tempfloatheight{#2}}%
+ \hsmash{\hskip#1\vbox to\d_strc_float_temp_height{#2}}%
\egroup
\else
\begingroup
- \tempfloatheight\ht\b_strc_floats_content
- \everyrightofalignedline{\hsmash{\hskip#1\vbox to\tempfloatheight{#2}}}%
+ \d_strc_float_temp_height\ht\b_strc_floats_content
+ \everyrightofalignedline{\hsmash{\hskip#1\vbox to\d_strc_float_temp_height{#2}}}%
\strc_floats_align_content{\box\b_strc_floats_content}%
\endgroup
\fi}
-\def\dodofloatboxnextleftmarginbuilder#1#2%
- {\ifparfloat
+\def\strc_floats_build_box_next_left_margin_indeed#1#2%
+ {\ifconditional\c_strc_floats_par_float
\hbox\bgroup
- \tempfloatheight\ht\b_strc_floats_content
- \hsmash{\hskip-\dimexpr#1+\wd\b_strc_floats_caption\relax\vbox to\tempfloatheight{#2}}%
+ \d_strc_float_temp_height\ht\b_strc_floats_content
+ \hsmash{\hskip-\dimexpr#1+\wd\b_strc_floats_caption\relax\vbox to\d_strc_float_temp_height{#2}}%
\box\b_strc_floats_content
\egroup
\else
\begingroup
- \tempfloatheight\ht\b_strc_floats_content
- \everyleftofalignedline{\hsmash{\hskip-\dimexpr#1+\wd\b_strc_floats_caption\relax\vbox to\tempfloatheight{#2}}}%
+ \d_strc_float_temp_height\ht\b_strc_floats_content
+ \everyleftofalignedline{\hsmash{\hskip-\dimexpr#1+\wd\b_strc_floats_caption\relax\vbox to\d_strc_float_temp_height{#2}}}%
\strc_floats_align_content{\box\b_strc_floats_content}%
\endgroup
\fi}
-\def\dofloatboxnextrightmarginbuilder{\dodofloatboxnextrightmarginbuilder\rightmargindistance}
-\def\dofloatboxnextleftmarginbuilder {\dodofloatboxnextleftmarginbuilder \leftmargindistance }
+\def\strc_floats_build_box_next_right_margin
+ {\strc_floats_build_box_next_right_margin_indeed\rightmargindistance}
+
+\def\strc_floats_build_box_next_left_margin
+ {\strc_floats_build_box_next_left_margin_indeed \leftmargindistance }
-\def\dofloatboxnextoutermarginbuilder
+\def\strc_floats_build_box_next_outer_margin
{\doifrightpagefloatelse
- {\dodofloatboxnextrightmarginbuilder\rightmargindistance}
- {\dodofloatboxnextleftmarginbuilder \rightmargindistance}}
+ {\strc_floats_build_box_next_right_margin_indeed\rightmargindistance}
+ {\strc_floats_build_box_next_left_margin_indeed \rightmargindistance}}
-\def\dofloatboxnextinnermarginbuilder
+\def\strc_floats_build_box_next_inner_margin
{\doifrightpagefloatelse
- {\dodofloatboxnextleftmarginbuilder \leftmargindistance}
- {\dodofloatboxnextrightmarginbuilder\leftmargindistance}}
-
-\def\dofloatboxnextbuilder % beware, we first check on left/rightmargin because there can be left/right also
- {\let\next\dofloatboxnextleftbuilder
- \normalexpanded{\noexpand\processallactionsinset[\floatcaptionparameter\c!location]}
- [ \v!outermargin=>\let\next\dofloatboxnextoutermarginbuilder,
- \v!innermargin=>\let\next\dofloatboxnextinnermarginbuilder,
- \v!leftmargin=>\let\next\dofloatboxnextleftmarginbuilder,
- \v!rightmargin=>\let\next\dofloatboxnextrightmarginbuilder,
- \v!lefthanging=>\let\next\dofloatboxnextlefthangbuilder,
- \v!righthanging=>\let\next\dofloatboxnextrighthangbuilder,
- \v!outer=>\let\next\dofloatboxnextouterbuilder,
- \v!inner=>\let\next\dofloatboxnextinnerbuilder,
- \v!left=>\let\next\dofloatboxnextleftbuilder,
- \v!right=>\let\next\dofloatboxnextrightbuilder]%
+ {\strc_floats_build_box_next_left_margin_indeed \leftmargindistance}
+ {\strc_floats_build_box_next_right_margin_indeed\leftmargindistance}}
+
+\def\strc_floats_build_box_next % beware, we first check on left/rightmargin because there can be left/right also
+ {\let\next\strc_floats_build_box_next_left
+ \normalexpanded{\processallactionsinset[\floatcaptionparameter\c!location]}
+ [ \v!outermargin=>\let\next\strc_floats_build_box_next_outer_margin,
+ \v!innermargin=>\let\next\strc_floats_build_box_next_inner_margin,
+ \v!leftmargin=>\let\next\strc_floats_build_box_next_left_margin,
+ \v!rightmargin=>\let\next\strc_floats_build_box_next_right_margin,
+ \v!lefthanging=>\let\next\strc_floats_build_box_next_left_hang,
+ \v!righthanging=>\let\next\strc_floats_build_box_next_right_hang,
+ \v!outer=>\let\next\strc_floats_build_box_next_outer,
+ \v!inner=>\let\next\strc_floats_build_box_next_inner,
+ \v!left=>\let\next\strc_floats_build_box_next_left,
+ \v!right=>\let\next\strc_floats_build_box_next_right]%
\next}
-\def\dofloatboxsidebuilder
- {\ifparfloat
- \let\next\dofloatboxhighbuilder
+\def\strc_floats_build_box_side
+ {\ifconditional\c_strc_floats_par_float
+ \let\next\strc_floats_build_box_high
\else
- \let\next\dofloatboxmiddlebuilder
- \expanded{\processallactionsinset[\floatcaptionparameter\c!location]}
- [ \v!low=>\let\next\dofloatboxlowbuilder,
- \v!middle=>\let\next\dofloatboxmiddlebuilder,
- \v!high=>\let\next\dofloatboxhighbuilder]%
+ \let\next\strc_floats_build_box_middle
+ \normalexpanded{\processallactionsinset[\floatcaptionparameter\c!location]}
+ [ \v!low=>\let\next\strc_floats_build_box_low,
+ \v!middle=>\let\next\strc_floats_build_box_middle,
+ \v!high=>\let\next\strc_floats_build_box_high]%
\fi
\next}
-\def\doflushfloatleftcaptionhang
- {\hsmash{\llap{\box\b_strc_floats_caption\dotfskip{\floatcaptionparameter\c!distance}}}}
-
-\def\doflushfloatrightcaptionhang
+\def\strc_floats_flush_right_caption_hang
{\hsmash{\rlap{\dotfskip{\floatcaptionparameter\c!distance}\box\b_strc_floats_caption}}}
+\def\strc_floats_flush_left_caption_hang
+ {\hsmash{\llap{\box\b_strc_floats_caption\dotfskip{\floatcaptionparameter\c!distance}}}}
+
\def\doflushfloatcaptionhang % expanded can go
{\expanded{\doifinsetelse{\v!righthanging}{\floatcaptionparameter\c!location}}
- {\doflushfloatrightcaptionhang}
+ {\strc_floats_flush_right_caption_hang}
{\expanded{\doifinsetelse{\v!lefthanging}{\floatcaptionparameter\c!location}}
- {\doflushfloatleftcaptionhang}
+ {\strc_floats_flush_left_caption_hang}
{\expanded{\doifinsetelse{\v!hang}{\floatcaptionparameter\c!location}}
{\expanded{\doifinsetelse{\v!outer}{\floatcaptionparameter\c!location}}
- {\doifrightpagefloatelse{\doflushfloatrightcaptionhang}{\doflushfloatleftcaptionhang}}
+ {\doifrightpagefloatelse{\strc_floats_flush_right_caption_hang}{\strc_floats_flush_left_caption_hang}}
{\expanded{\doifinsetelse{\v!right}{\floatcaptiondirectives}}
- {\doflushfloatrightcaptionhang}
- {\doflushfloatleftcaptionhang}}}
+ {\strc_floats_flush_right_caption_hang}
+ {\strc_floats_flush_left_caption_hang}}}
{\box\b_strc_floats_caption}}}}
-\def\dofloatboxhighbuilder
- {\dofloatboxnextbuilder{\dofloatboxbetweenstack\doflushfloatcaptionhang\vfill}}
+\def\strc_floats_build_box_high
+ {\strc_floats_build_box_next{\strc_floats_between_stack\doflushfloatcaptionhang\vfill}}
-\def\dofloatboxlowbuilder
- {\dofloatboxnextbuilder{\vfill\doflushfloatcaptionhang\dofloatboxbetweenstack}}
+\def\strc_floats_build_box_low
+ {\strc_floats_build_box_next{\vfill\doflushfloatcaptionhang\strc_floats_between_stack}}
-\def\dofloatboxmiddlebuilder
- {\dofloatboxnextbuilder{\vfill\box\b_strc_floats_caption\vfill}}
+\def\strc_floats_build_box_middle
+ {\strc_floats_build_box_next{\vfill\box\b_strc_floats_caption\vfill}}
% \definefloat
% [lefty][lefties][figure]
@@ -1590,125 +1548,132 @@
% \placelefty{}{} \input tufte \input tufte
% \stoptext
-\def\bothangfloat#1{\ruledvbox to \ht\b_strc_floats_content{#1\vss}}
-\def\tophangfloat#1{\ruledvbox to \ht\b_strc_floats_content{\vss#1}}
+\def\strc_floats_build_box_top_stack_normal_indeed
+ {\vbox to \ht\b_strc_floats_content\bgroup
+ \vss
+ \d_strc_float_temp_width\wd\b_strc_floats_content
+ \ifconditional\c_strc_floats_par_float
+ \hbox{\strc_floats_locate_side_float{\box\b_strc_floats_caption}}%
+ \strc_floats_between_stack
+ \hbox{\hbox{\box\b_strc_floats_content}}%
+ \else
+ \page_otr_command_set_float_hsize
+ \hbox{\strc_floats_locate_text_float{\box\b_strc_floats_caption}}
+ \strc_floats_between_stack
+ \hbox{\strc_floats_align_content{\box\b_strc_floats_content}}%
+ \fi
+ \egroup}
-\def\dofloatboxnormaltopstackbuilder
- {\expanded{\doifinset{\v!overlay}{\floatcaptionparameter\c!location}}\tophangfloat
- {\tempfloatwidth\wd\b_strc_floats_content
- \ifparfloat
- \hbox{\strc_floats_locate_side_float{\box\b_strc_floats_caption}}%
- \dofloatboxbetweenstack
- \hbox{\hbox{\box\b_strc_floats_content}}%
- \else
- \page_otr_command_set_float_hsize
- \hbox{\strc_floats_locate_text_float{\box\b_strc_floats_caption}}
- \dofloatboxbetweenstack
- \hbox{\strc_floats_align_content{\box\b_strc_floats_content}}%
- \fi}}
+\def\strc_floats_build_box_bottom_stack_normal_indeed
+ {\vbox to \ht\b_strc_floats_content\bgroup
+ \d_strc_float_temp_width\wd\b_strc_floats_content
+ \ifconditional\c_strc_floats_par_float
+ \hbox{\hbox{\box\b_strc_floats_content}}%
+ \strc_floats_between_stack
+ \hbox{\strc_floats_locate_side_float{\box\b_strc_floats_caption}}%
+ \else
+ \page_otr_command_set_float_hsize
+ \hbox{\strc_floats_align_content{\box\b_strc_floats_content}}%
+ \strc_floats_between_stack
+ \hbox{\strc_floats_locate_text_float{\box\b_strc_floats_caption}}%
+ \fi
+ \vss
+ \egroup}
-\def\dofloatboxnormalbotstackbuilder
- {\expanded{\doifinset{\v!overlay}{\floatcaptionparameter\c!location}}\bothangfloat
- {\tempfloatwidth\wd\b_strc_floats_content
- \ifparfloat
- \hbox{\hbox{\box\b_strc_floats_content}}%
- \dofloatboxbetweenstack
- \hbox{\strc_floats_locate_side_float{\box\b_strc_floats_caption}}%
- \else
- \page_otr_command_set_float_hsize
- \hbox{\strc_floats_align_content{\box\b_strc_floats_content}}%
- \dofloatboxbetweenstack
- \hbox{\strc_floats_locate_text_float{\box\b_strc_floats_caption}}%
- \fi}}
+\def\strc_floats_build_box_top_stack_normal
+ {\expanded{\doifinset{\v!overlay}{\floatcaptionparameter\c!location}}\strc_floats_build_box_top_stack_normal_indeed}
+
+\def\strc_floats_build_box_bottom_stack_normal
+ {\expanded{\doifinset{\v!overlay}{\floatcaptionparameter\c!location}}\strc_floats_build_box_bottom_stack_normal_indeed}
-\def\dofloatboxgridtopstackbuilder
+\def\strc_floats_build_box_top_stack_grid
{\dp\b_strc_floats_caption\strutdepth
\setbox\scratchbox\vbox
- {\tempfloatwidth\wd\b_strc_floats_content
- \ifparfloat
+ {\d_strc_float_temp_width\wd\b_strc_floats_content
+ \ifconditional\c_strc_floats_par_float
\strc_floats_locate_side_float{\box\b_strc_floats_caption}%
- \vss\dofloatboxbetweenstack
+ \vss\strc_floats_between_stack
\hbox{\box\b_strc_floats_content}%
\else
\page_otr_command_set_float_hsize
\strc_floats_locate_text_float{\box\b_strc_floats_caption}%
- \vss\dofloatboxbetweenstack
+ \vss\strc_floats_between_stack
\strc_floats_align_content{\box\b_strc_floats_content}%
\fi}%
\getnoflines{\dimexpr\htdp\scratchbox-10\scaledpoint\relax}% get rid of inaccuracy
\vbox to \noflines\lineheight{\unvbox\scratchbox}}
-\def\dofloatboxgridbotstackbuilder
+\def\strc_floats_build_box_bottom_stack_grid
{\dp\b_strc_floats_caption\strutdepth
\setbox\scratchbox\vbox
- {\tempfloatwidth\wd\b_strc_floats_content
- \ifparfloat
+ {\d_strc_float_temp_width\wd\b_strc_floats_content
+ \ifconditional\c_strc_floats_par_float
\hbox{\box\b_strc_floats_content}%
- \vss\dofloatboxbetweenstack
+ \vss\strc_floats_between_stack
\strc_floats_locate_side_float{\box\b_strc_floats_caption}%
\else
\page_otr_command_set_float_hsize
\strc_floats_align_content{\box\b_strc_floats_content}%
- \vss\dofloatboxbetweenstack
+ \vss\strc_floats_between_stack
\strc_floats_locate_text_float{\box\b_strc_floats_caption}%
\fi}%
\getnoflines{\dimexpr\htdp\scratchbox-10\scaledpoint\relax}% get rid of inaccuracy
\vbox to \noflines\lineheight{\unvbox\scratchbox}}
-\def\dofloatboxstretchtopstackbuilder
+\def\strc_floats_build_box_top_stack_stretch
{\dp\b_strc_floats_caption\strutdepth
\setbox\scratchbox\vbox
{\strc_floats_align_caption{\copy\b_strc_floats_caption}%
\strc_floats_align_content {\copy\b_strc_floats_content }}%
\getnoflines{\dimexpr\htdp\scratchbox-10\scaledpoint\relax}% get rid of inaccuracy
\vbox to \noflines\lineheight
- {\tempfloatwidth\wd\b_strc_floats_content
- \ifparfloat
+ {\d_strc_float_temp_width\wd\b_strc_floats_content
+ \ifconditional\c_strc_floats_par_float
\strc_floats_locate_side_float{\box\b_strc_floats_caption}%
- \vss\dofloatboxbetweenstack\vss
+ \vss\strc_floats_between_stack\vss
\hbox{\box\b_strc_floats_content}%
\else
\page_otr_command_set_float_hsize
\strc_floats_locate_text_float{\box\b_strc_floats_caption}%
- \vss\dofloatboxbetweenstack\vss
+ \vss\strc_floats_between_stack\vss
\strc_floats_align_content{\box\b_strc_floats_content}%
\fi}}
-\def\dofloatboxstretchbotstackbuilder
+\def\strc_floats_build_box_bottom_stack_stretch
{\dp\b_strc_floats_caption\strutdepth
\setbox\scratchbox\vbox
{\strc_floats_align_content{\copy\b_strc_floats_content }%
\strc_floats_align_caption{\copy\b_strc_floats_caption}}%
\getnoflines{\dimexpr\htdp\scratchbox-10\scaledpoint\relax}% get rid of inaccuracy
\vbox to \noflines\lineheight
- {\tempfloatwidth\wd\b_strc_floats_content
- \ifparfloat
+ {\d_strc_float_temp_width\wd\b_strc_floats_content
+ \ifconditional\c_strc_floats_par_float
\hbox{\box\b_strc_floats_content}%
- \vss\dofloatboxbetweenstack\vss
+ \vss\strc_floats_between_stack\vss
\strc_floats_locate_side_float{\box\b_strc_floats_caption}
\else
\page_otr_command_set_float_hsize
\strc_floats_align_content{\box\b_strc_floats_content}%
- \vss\dofloatboxbetweenstack\vss
+ \vss\strc_floats_between_stack\vss
\strc_floats_locate_text_float{\box\b_strc_floats_caption}%
\fi}}
-\def\dofloatboxtopbuilder
- {\let\next\dofloatboxnormaltopstackbuilder
+\def\strc_floats_build_box_top
+ {\let\next\strc_floats_build_box_top_stack_normal
\expanded{\processfirstactioninset[\floatcaptionparameter\c!location]}
- [ \v!grid=>\let\next\dofloatboxgridstackbuilder,
- \v!stretch=>\let\next\dofloatboxstretchstackbuilder]%
+ [ \v!grid=>\let\next\strc_floats_build_box_top_stack_grid,
+ \v!stretch=>\let\next\strc_floats_build_box_top_stack_stretch]%
\next}
-\def\dofloatboxbottombuilder
- {\let\next\dofloatboxnormalbotstackbuilder
+\def\strc_floats_build_box_bottom
+ {\let\next\strc_floats_build_box_bottom_stack_normal
\expanded{\processfirstactioninset[\floatcaptionparameter\c!location]}
- [ \v!grid=>\let\next\dofloatboxgridstackbuilder,
- \v!stretch=>\let\next\dofloatboxstretchstackbuilder]%
+ [ \v!grid=>\let\next\strc_floats_build_box_bottom_stack_grid,
+ \v!stretch=>\let\next\strc_floats_build_box_bottom_stack_stretch]%
\next}
-\def\relocatecaptionright#1{\strc_floats_align_caption{\hbox to \tempfloatwidth{\hss#1}}}
-\def\relocatecaptionleft #1{\strc_floats_align_caption{\hbox to \tempfloatwidth{#1\hss}}}
+\def\strc_floats_relocate_caption_right#1{\strc_floats_align_caption{\hbox to \d_strc_float_temp_width{\hss#1}}}
+\def\strc_floats_relocate_caption_left #1{\strc_floats_align_caption{\hbox to \d_strc_float_temp_width{#1\hss}}}
\unexpanded\def\installfloatboxbuilder#1#2{\setvalue{\??floatbuilder#1}{#2}}
@@ -1725,23 +1690,23 @@
\def\strc_floats_locate_text_float
{\let\next\strc_floats_align_caption
\expanded{\processallactionsinset[\floatcaptionparameter\c!location]}
- [ \v!left=>\let\next\relocatecaptionleft,
- \v!right=>\let\next\relocatecaptionright,
- \v!inner=>\doifrightpagefloatelse{\let\next\relocatecaptionleft }{\let\next\relocatecaptionright},
- \v!outer=>\doifrightpagefloatelse{\let\next\relocatecaptionright}{\let\next\relocatecaptionleft }]%
+ [ \v!left=>\let\next\strc_floats_relocate_caption_left,
+ \v!right=>\let\next\strc_floats_relocate_caption_right,
+ \v!inner=>\doifrightpagefloatelse{\let\next\strc_floats_relocate_caption_left }{\let\next\strc_floats_relocate_caption_right},
+ \v!outer=>\doifrightpagefloatelse{\let\next\strc_floats_relocate_caption_right}{\let\next\strc_floats_relocate_caption_left }]%
\next}
-\installfloatboxbuilder \v!none \dofloatboxdefaultbuilder
-\installfloatboxbuilder \s!default \dofloatboxdefaultbuilder
-\installfloatboxbuilder \v!high \dofloatboxhighbuilder
-\installfloatboxbuilder \v!low \dofloatboxlowbuilder
-\installfloatboxbuilder \v!middle \dofloatboxmiddlebuilder
+\installfloatboxbuilder \v!none \strc_floats_build_box_default
+\installfloatboxbuilder \s!default \strc_floats_build_box_default
+\installfloatboxbuilder \v!high \strc_floats_build_box_high
+\installfloatboxbuilder \v!low \strc_floats_build_box_low
+\installfloatboxbuilder \v!middle \strc_floats_build_box_middle
-\installfloatboxbuilder \v!left \dofloatboxsidebuilder
-\installfloatboxbuilder \v!right \dofloatboxsidebuilder
+\installfloatboxbuilder \v!left \strc_floats_build_box_side
+\installfloatboxbuilder \v!right \strc_floats_build_box_side
-\installfloatboxbuilder \v!top \dofloatboxtopbuilder
-\installfloatboxbuilder \v!bottom \dofloatboxbottombuilder
+\installfloatboxbuilder \v!top \strc_floats_build_box_top
+\installfloatboxbuilder \v!bottom \strc_floats_build_box_bottom
% \setuplayout[grid=yes] \showgrid \setupcaptions[style=smallbodyfont,location=grid,inbetween=]
%
@@ -1831,7 +1796,7 @@
\def\strc_floats_locate_side_float#1%
{\begingroup
\alignstrutmode\zerocount
- \hsize\tempfloatwidth \forgetall
+ \hsize\d_strc_float_temp_width \forgetall
\alignedline{\floatparameter\c!location}\v!middle{#1}%
\endgroup}
@@ -1840,13 +1805,11 @@
\let\strc_floats_align_caption\relax
\strc_floats_build_box}
-\newif\ifparfloat
-
\def\strc_floats_set_box % todo : \global\setbox, currently messy
{\ifvisible
\par
\edef\floatcaptiondirectives{\floatparameter\c!location,\floatcaptionparameter\c!location}%
- \ifparfloat
+ \ifconditional\c_strc_floats_par_float
\strc_floats_set_paragraph_variant
\else
\strc_floats_set_page_variant
@@ -1869,9 +1832,7 @@
\fi
\fi}
-\newcounter\noxfloatlocations
-
-% \def\dooutput{\sidefloatoutput} % redefinition of \dooutput
+% \def\dooutput{\sidefloatoutput} % redefinition of \dooutput
\definefloat
[\v!figure]
@@ -2104,7 +2065,7 @@
\directlocalfloatsparameter\c!after
\fi}}
-\def\flushlocalfloats
+\unexpanded\def\flushlocalfloats
{\getlocalfloats
\resetlocalfloats}
diff --git a/tex/context/base/strc-mat.mkiv b/tex/context/base/strc-mat.mkiv
index 7cdc68a73..d9942bfc8 100644
--- a/tex/context/base/strc-mat.mkiv
+++ b/tex/context/base/strc-mat.mkiv
@@ -451,8 +451,8 @@
\fi}
\unexpanded\def\afterdisplayspace
- {\edef\p_spacebefore{\formulaparameter\c!spaceafter}%
- \ifx\p_spaceaftere\v!none \else
+ {\edef\p_spaceafter{\formulaparameter\c!spaceafter}%
+ \ifx\p_spaceafter\v!none \else
\blank[\p_spaceafter]%
\fi}
diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua
index 5d05b55fe..3bdd6a383 100644
--- a/tex/generic/context/luatex/luatex-fonts-merged.lua
+++ b/tex/generic/context/luatex/luatex-fonts-merged.lua
@@ -1,6 +1,6 @@
-- merged file : luatex-fonts-merged.lua
-- parent file : luatex-fonts.lua
--- merge date : 07/04/12 10:42:10
+-- merge date : 07/04/12 14:44:07
do -- begin closure to overcome local limits and interference