summaryrefslogtreecommitdiff
path: root/tex/context/base
diff options
context:
space:
mode:
authorHans Hagen <pragma@wxs.nl>2017-11-22 15:35:23 +0100
committerContext Git Mirror Bot <phg42.2a@gmail.com>2017-11-22 15:35:23 +0100
commit409a95f63883bd3b91699d39645e39a8a761457c (patch)
treee15b7563c06ea0a5a8c2a148f3ef04db5c841f69 /tex/context/base
parent5b9683a8f29dd473e17502aa1746a6bcc3036fe3 (diff)
downloadcontext-409a95f63883bd3b91699d39645e39a8a761457c.tar.gz
2017-11-22 13:41:00
Diffstat (limited to 'tex/context/base')
-rw-r--r--tex/context/base/mkii/cont-new.mkii2
-rw-r--r--tex/context/base/mkii/context.mkii2
-rw-r--r--tex/context/base/mkiv/cont-new.mkiv2
-rw-r--r--tex/context/base/mkiv/context.mkiv2
-rw-r--r--tex/context/base/mkiv/core-uti.lua2
-rw-r--r--tex/context/base/mkiv/data-sch.lua4
-rw-r--r--tex/context/base/mkiv/math-ali.mkiv14
-rw-r--r--tex/context/base/mkiv/mtx-context-compare.tex113
-rw-r--r--tex/context/base/mkiv/mult-prm.lua1
-rw-r--r--tex/context/base/mkiv/node-syn.lua6
-rw-r--r--tex/context/base/mkiv/page-brk.mkiv14
-rw-r--r--tex/context/base/mkiv/page-cst.mkiv20
-rw-r--r--tex/context/base/mkiv/page-flt.mkiv19
-rw-r--r--tex/context/base/mkiv/page-ini.mkiv12
-rw-r--r--tex/context/base/mkiv/page-lay.mkiv10
-rw-r--r--tex/context/base/mkiv/page-mix.mkiv9
-rw-r--r--tex/context/base/mkiv/page-mul.mkiv8
-rw-r--r--tex/context/base/mkiv/page-one.mkiv22
-rw-r--r--tex/context/base/mkiv/page-otr.mkvi7
-rw-r--r--tex/context/base/mkiv/page-pcl.mkiv334
-rw-r--r--tex/context/base/mkiv/page-set.mkiv14
-rw-r--r--tex/context/base/mkiv/publ-aut.lua168
-rw-r--r--tex/context/base/mkiv/publ-ini.mkiv3
-rw-r--r--tex/context/base/mkiv/status-files.pdfbin25795 -> 25825 bytes
-rw-r--r--tex/context/base/mkiv/status-lua.pdfbin250550 -> 250644 bytes
-rw-r--r--tex/context/base/mkiv/strc-flt.mkvi6
-rw-r--r--tex/context/base/mkiv/util-lib.lua38
-rw-r--r--tex/context/base/mkiv/util-sql-imp-ffi.lua3
-rw-r--r--tex/context/base/mkiv/util-sql-imp-sqlite.lua3
29 files changed, 567 insertions, 271 deletions
diff --git a/tex/context/base/mkii/cont-new.mkii b/tex/context/base/mkii/cont-new.mkii
index 0b056f401..6a789e77d 100644
--- a/tex/context/base/mkii/cont-new.mkii
+++ b/tex/context/base/mkii/cont-new.mkii
@@ -11,7 +11,7 @@
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.
-\newcontextversion{2017.11.19 20:15}
+\newcontextversion{2017.11.22 13:35}
%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/mkii/context.mkii b/tex/context/base/mkii/context.mkii
index a659bad96..6c74abf3a 100644
--- a/tex/context/base/mkii/context.mkii
+++ b/tex/context/base/mkii/context.mkii
@@ -20,7 +20,7 @@
%D your styles an modules.
\edef\contextformat {\jobname}
-\edef\contextversion{2017.11.19 20:15}
+\edef\contextversion{2017.11.22 13:35}
%D For those who want to use this:
diff --git a/tex/context/base/mkiv/cont-new.mkiv b/tex/context/base/mkiv/cont-new.mkiv
index 5d7d41a9d..37ce0c00b 100644
--- a/tex/context/base/mkiv/cont-new.mkiv
+++ b/tex/context/base/mkiv/cont-new.mkiv
@@ -11,7 +11,7 @@
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.
-\newcontextversion{2017.11.19 20:15}
+\newcontextversion{2017.11.22 13:35}
%D This file is loaded at runtime, thereby providing an excellent place for
%D hacks, patches, extensions and new features.
diff --git a/tex/context/base/mkiv/context.mkiv b/tex/context/base/mkiv/context.mkiv
index 580304e12..0b1f3b097 100644
--- a/tex/context/base/mkiv/context.mkiv
+++ b/tex/context/base/mkiv/context.mkiv
@@ -41,7 +41,7 @@
%D up and the dependencies are more consistent.
\edef\contextformat {\jobname}
-\edef\contextversion{2017.11.19 20:15}
+\edef\contextversion{2017.11.22 13:35}
\edef\contextkind {beta}
%D For those who want to use this:
diff --git a/tex/context/base/mkiv/core-uti.lua b/tex/context/base/mkiv/core-uti.lua
index c9f003061..fda66ed73 100644
--- a/tex/context/base/mkiv/core-uti.lua
+++ b/tex/context/base/mkiv/core-uti.lua
@@ -298,7 +298,7 @@ function job.load(filename)
local initializer = list[3]
local result = accesstable(target,utilitydata)
if result then
- local done = packers.unpack(result,jobpacker,true)
+ local done = packers.unpack(result,jobpacker,true)
if done then
migratetable(target,mark(result))
if type(initializer) == "function" then
diff --git a/tex/context/base/mkiv/data-sch.lua b/tex/context/base/mkiv/data-sch.lua
index f6801cb4d..2e880e997 100644
--- a/tex/context/base/mkiv/data-sch.lua
+++ b/tex/context/base/mkiv/data-sch.lua
@@ -72,7 +72,7 @@ local runner = sandbox.registerrunner {
name = "curl resolver",
method = "execute",
program = "curl",
- template = "--silent -- insecure --create-dirs --output %cachename% %original%",
+ template = "--silent --insecure --create-dirs --output %cachename% %original%",
checkers = {
cachename = "cache",
original = "url",
@@ -151,7 +151,7 @@ local function http_handler(specification,cachename)
local tempname = cachename .. ".tmp"
local f = io.open(tempname,"wb")
local status, message = http.request {
- url = specification.original,
+ url = specification.original,
sink = ltn12.sink.file(f)
}
if not status then
diff --git a/tex/context/base/mkiv/math-ali.mkiv b/tex/context/base/mkiv/math-ali.mkiv
index 2b0cc0bc1..6e2972615 100644
--- a/tex/context/base/mkiv/math-ali.mkiv
+++ b/tex/context/base/mkiv/math-ali.mkiv
@@ -128,7 +128,7 @@
\aligntab
\math_first_in_eqalign
\hfil
- \math_left_of_equalign
+ \math_left_of_eqalign
\span
\math_math_in_eqalign{\alignmark\alignmark}%
\math_right_of_eqalign
@@ -136,7 +136,7 @@
\t_math_align_b
{\aligntab
\math_next_in_eqalign
- \math_left_of_equalign
+ \math_left_of_eqalign
\span
\math_math_in_eqalign{\alignmark\alignmark}%
\math_right_of_eqalign
@@ -177,7 +177,7 @@
\aligntab
\math_first_in_eqalign
\hfil
- \math_left_of_equalign
+ \math_left_of_eqalign
\span
\math_math_in_eqalign{\alignmark\alignmark}%
\math_right_of_eqalign
@@ -185,7 +185,7 @@
\t_math_align_b
{\aligntab
\math_next_in_eqalign
- \math_left_of_equalign
+ \math_left_of_eqalign
\span
\math_math_in_eqalign{\alignmark\alignmark}%
\math_right_of_eqalign
@@ -467,7 +467,7 @@
\dostoptagged % finish cell
\dostarttagged\t!mathtablecell\empty}
-\def\math_left_of_equalign
+\def\math_left_of_eqalign
{\ifcsname\??mathalignmentvariant\number\c_math_eqalign_column\endcsname
\ifcase\lastnamedcs \or \relax \or \hfill \or \hfill \fi
\fi}
@@ -832,7 +832,7 @@
\unexpanded\def\math_matrix_start_cell
{\dostarttagged\t!mathtablecell\empty
\hss
- %\math_left_of_equalign
+ \math_left_of_eqalign
\startimath
\math_matrix_set_style
\tabskip\zeropoint
@@ -840,7 +840,7 @@
\unexpanded\def\math_matrix_stop_cell
{\stopimath
- %\math_right_of_eqalign
+ \math_right_of_eqalign
\hss
\dostoptagged}
diff --git a/tex/context/base/mkiv/mtx-context-compare.tex b/tex/context/base/mkiv/mtx-context-compare.tex
new file mode 100644
index 000000000..ffa744013
--- /dev/null
+++ b/tex/context/base/mkiv/mtx-context-compare.tex
@@ -0,0 +1,113 @@
+%D \module
+%D [ file=mtx-context-compare,
+%D version=2015.07.14,
+%D title=\CONTEXT\ Extra Trickry,
+%D subtitle=Compare Files,
+%D author=Hans Hagen,
+%D date=\currentdate,
+%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
+%C
+%C This module is part of the \CONTEXT\ macro||package and is
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
+
+% begin help
+%
+% usage: context --extra=compare [options] file-1 file-2
+%
+% example: context --extra=compare file1.pdf file-2.pdf
+%
+% end help
+
+\input mtx-context-common.tex
+
+\starttext
+
+\starttexdefinition unexpanded ShowBoth #1#2#3
+ \startTEXpage
+ \startoverlay
+ {\externalfigure[#1][page=#3]}
+ {\externalfigure[#2][page=#3]}
+ \stopoverlay
+ \stopTEXpage
+\stoptexdefinition
+
+\starttexdefinition unexpanded ShowPage #1#2
+ \startTEXpage
+ \externalfigure[#1][page=#2]
+ \stopTEXpage
+\stoptexdefinition
+
+
+\startluacode
+
+local report = logs.reporter("compare")
+
+local fileone = document.files[1] or ""
+local filetwo = document.files[2] or ""
+
+if fileone == "" or filetwo == "" then
+ report("provide two filenames")
+ os.exit()
+end
+
+if not lfs.isfile(fileone) then
+ report("unknown file %a",fileone)
+ os.exit()
+end
+
+if not lfs.isfile(filetwo) then
+ report("unknown file %a",filetwo)
+ os.exit()
+end
+
+local function check(name)
+ local fig = figures.push { name = name }
+ figures.identify()
+ figures.check()
+ local used = fig.used
+ figures.pop()
+ return used
+end
+
+local one = check(fileone)
+local two = check(filetwo)
+
+if not one then
+ report("invalid file %a",fileone)
+ os.exit()
+end
+
+if not two then
+ report("invalid file %a",filetwo)
+ os.exit()
+end
+
+local n_one = tonumber(one.pages)
+local n_two = tonumber(two.pages)
+
+if not n_one or n_one ~= n_two then
+ report("files have different nofpages (%s vs %s)",n_one or "?",n_two or "?")
+end
+
+if n_one > n_two then
+ for i=1,n_two do
+ context.ShowBoth(fileone,filetwo,i)
+ end
+ for i=n_two+1,n_one do
+ context.ShowPage(fileone,i)
+ end
+else
+ for i=1,n_one do
+ context.ShowBoth(fileone,filetwo,i)
+ end
+ for i=n_one+1,n_two do
+ context.ShowPage(filetwo,i)
+ end
+end
+
+\stopluacode
+
+\stoptext
+
+\endinput
diff --git a/tex/context/base/mkiv/mult-prm.lua b/tex/context/base/mkiv/mult-prm.lua
index 4542c1e85..3557bc0ff 100644
--- a/tex/context/base/mkiv/mult-prm.lua
+++ b/tex/context/base/mkiv/mult-prm.lua
@@ -343,6 +343,7 @@ return {
"suppresslongerror",
"suppressmathparerror",
"suppressoutererror",
+ "suppressprimitiveerror",
"synctex",
"tagcode",
"textdir",
diff --git a/tex/context/base/mkiv/node-syn.lua b/tex/context/base/mkiv/node-syn.lua
index d6730bb4d..d8320e3b3 100644
--- a/tex/context/base/mkiv/node-syn.lua
+++ b/tex/context/base/mkiv/node-syn.lua
@@ -205,6 +205,12 @@ local enabled = false
local paused = 0
local used = false
+-- get rid of overhead
+
+if tex.set_synctex_no_files then
+ tex.set_synctex_no_files(1)
+end
+
-- the file name stuff
local noftags = 0
diff --git a/tex/context/base/mkiv/page-brk.mkiv b/tex/context/base/mkiv/page-brk.mkiv
index b651cc8b4..7ab74c0e4 100644
--- a/tex/context/base/mkiv/page-brk.mkiv
+++ b/tex/context/base/mkiv/page-brk.mkiv
@@ -137,7 +137,7 @@
{\def\page_breaks_process[##1]{}}
\installpagebreakmethod \s!dummy
- {\page_otr_flush_all_floats
+ {\page_otr_command_flush_all_floats
\page_otr_command_next_page
\page_otr_insert_dummy_page}
@@ -150,11 +150,11 @@
\unexpanded\def\page_breaks_unknown % how often called ?
{\doifelseinstring{+}\page_breaks_current_option
- {\page_otr_flush_all_floats
+ {\page_otr_command_flush_all_floats
\page_otr_command_next_page
\dorecurse\page_breaks_current_option\page_otr_insert_dummy_page}
{\doifelsenumber\page_breaks_current_option
- {\page_otr_flush_all_floats
+ {\page_otr_command_flush_all_floats
\page_otr_command_next_page
\doloop
{\ifnum\userpageno<\page_breaks_current_option\relax
@@ -179,7 +179,7 @@
\installpagebreakmethod \v!yes
{\ifconditional\c_page_breaks_enabled
- \page_otr_flush_all_floats
+ \page_otr_command_flush_all_floats
\page_otr_command_next_page
\ifinsidecolumns % this will move to MUL
\page_otr_eject_page % otherwise sometimes no change
@@ -229,12 +229,12 @@
{\resetcurrentstructuremarkswithpage\page_otr_insert_dummy_page}
\installpagebreakmethod \v!left
- {\page_otr_flush_all_floats
+ {\page_otr_command_flush_all_floats
\page_otr_command_next_page_and_inserts
\doifbothsidesoverruled\donothing\page_reset_marks_and_insert_dummy\donothing}
\installpagebreakmethod \v!right
- {\page_otr_flush_all_floats
+ {\page_otr_command_flush_all_floats
\page_otr_command_next_page_and_inserts
\doifbothsidesoverruled\donothing\donothing\page_reset_marks_and_insert_dummy}
@@ -269,7 +269,7 @@
\fi}
\installpagebreakmethod \v!last
- {\page_otr_flush_all_floats
+ {\page_otr_command_flush_all_floats
\page_otr_command_next_page_and_inserts
\relax
\doifbothsidesoverruled
diff --git a/tex/context/base/mkiv/page-cst.mkiv b/tex/context/base/mkiv/page-cst.mkiv
index 26cb4ea98..f6eede68a 100644
--- a/tex/context/base/mkiv/page-cst.mkiv
+++ b/tex/context/base/mkiv/page-cst.mkiv
@@ -189,11 +189,11 @@
\def\page_grd_stop
{\endgraf % needed, else wrong vsize in one par case
\vfill % otherwise weird \placenotes[endnotes]
- \page_otr_command_set_vsize % needed
+ \page_grd_command_set_vsize % needed
\penalty\c_page_otr_eject_penalty
\page_grd_command_flush_page
\page_otr_fill_and_eject_page
- \page_otr_command_set_vsize % needed
+ \page_grd_command_set_vsize % why here
\egroup
\page_otr_command_set_vsize
\page_otr_command_set_hsize}
@@ -334,7 +334,7 @@
\unexpanded\def\page_grd_command_next_progress
{\strut
- \page_otr_flush_all_floats
+ \page_grd_command_flush_all_floats
\page_otr_eject_page
\ifcase\clf_columnsetnoto\else
\expandafter\page_grd_command_next_progress
@@ -354,10 +354,10 @@
\fi}
\unexpanded\def\page_grd_command_next_page_and_inserts
-% {\page_otr_eject_page_and_flush_inserts}
- {\page_otr_flush_all_floats
+ {\page_grd_command_flush_all_floats
\page_grd_command_next_page}
+\let\page_grd_command_flush_all_floats\page_one_command_flush_all_floats
\let\page_grd_command_package_contents\page_one_command_package_contents
\unexpanded\def\page_grd_command_flush_saved_floats
@@ -576,27 +576,31 @@
\unexpanded\def\page_grd_command_synchronize_hsize
{\page_grd_command_set_hsize}
+\unexpanded\def\page_grd_command_flush_all_floats
+ {\page_one_command_flush_all_floats}
+
\defineoutputroutine
[\s!pagegrid]
[\s!page_otr_command_routine =\page_grd_command_routine,
\s!page_otr_command_package_contents =\page_grd_command_package_contents,
\s!page_otr_command_set_vsize =\page_grd_command_set_vsize,
\s!page_otr_command_set_hsize =\page_grd_command_set_hsize, % tricky, goes wrong
+ \s!page_otr_command_synchronize_hsize =\page_grd_command_synchronize_hsize,
\s!page_otr_command_next_page =\page_grd_command_next_page,
\s!page_otr_command_next_page_and_inserts =\page_grd_command_next_page_and_inserts,
- \s!page_otr_command_synchronize_hsize =\page_grd_command_synchronize_hsize,
% \s!page_otr_command_set_top_insertions =\page_grd_command_set_top_insertions,
% \s!page_otr_command_set_bottom_insertions =\page_grd_command_set_bottom_insertions,
% \s!page_otr_command_flush_top_insertions =\page_grd_command_flush_top_insertions,
% \s!page_otr_command_flush_bottom_insertions =\page_grd_command_flush_bottom_insertions,
- % \s!page_otr_command_set_float_hsize =\page_grd_command_set_float_hsize,
\s!page_otr_command_check_if_float_fits =\page_grd_command_check_if_float_fits,
+ % \s!page_otr_command_set_float_hsize =\page_grd_command_set_float_hsize,
% \s!page_otr_command_flush_float_box =\page_grd_command_flush_float_box,
\s!page_otr_command_synchronize_side_floats =\page_grd_command_synchronize_side_floats,
\s!page_otr_command_side_float_output =\page_grd_command_side_float_output,
\s!page_otr_command_flush_floats =\page_grd_command_flush_floats,
\s!page_otr_command_flush_side_floats =\page_grd_command_flush_side_floats,
- \s!page_otr_command_flush_saved_floats =\page_grd_command_flush_saved_floats
+ \s!page_otr_command_flush_saved_floats =\page_grd_command_flush_saved_floats,
+ \s!page_otr_command_flush_all_floats =\page_grd_command_flush_all_floats,
% \s!page_otr_command_flush_margin_blocks =\page_grd_command_flush_margin_blocks, % not used
]
diff --git a/tex/context/base/mkiv/page-flt.mkiv b/tex/context/base/mkiv/page-flt.mkiv
index 811248717..a06c90ec1 100644
--- a/tex/context/base/mkiv/page-flt.mkiv
+++ b/tex/context/base/mkiv/page-flt.mkiv
@@ -37,9 +37,22 @@
\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,\floatlocation}}
-\def\page_floats_report_flushed{\showmessage\m!floatblocks3{\the\numexpr\totalnoffloats-\savednoffloats\relax}}
+% \def\page_floats_report_saved
+% {\showmessage\m!floatblocks2
+% {\the\totalnoffloats}}
+
+\def\page_floats_report_total
+ {\showmessage\m!floatblocks4%
+ {\the\totalnoffloats
+ \ifx\floatlocationmethod\empty
+ \ifx\floatlocation\empty\else,\floatlocation\fi
+ \else
+ ,\floatlocationmethod
+ \fi}}
+
+\def\page_floats_report_flushed
+ {\showmessage\m!floatblocks3%
+ {\the\numexpr\totalnoffloats-\savednoffloats\relax}}
%D Extra float registers.
diff --git a/tex/context/base/mkiv/page-ini.mkiv b/tex/context/base/mkiv/page-ini.mkiv
index 6440bd80d..8c8e9c089 100644
--- a/tex/context/base/mkiv/page-ini.mkiv
+++ b/tex/context/base/mkiv/page-ini.mkiv
@@ -67,17 +67,7 @@
\def\page_otr_flush_all_floats
{%\flushnotes already done
\ifconditional\c_page_floats_some_waiting
- \begingroup
- \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
- % when just flushing; so now we have (maybe optional):
- \pagebaselinecorrection % hm, needs checking, not needed when no floats
- % alas, this is tricky but needed (first surfaced in prikkels)
- \page_otr_command_flush_floats
- \endgroup
+ \page_otr_command_flush_all_floats
\fi}
\def\page_otr_insert_dummy_page
diff --git a/tex/context/base/mkiv/page-lay.mkiv b/tex/context/base/mkiv/page-lay.mkiv
index b078e1042..8da2b5017 100644
--- a/tex/context/base/mkiv/page-lay.mkiv
+++ b/tex/context/base/mkiv/page-lay.mkiv
@@ -1114,7 +1114,7 @@
\setsystemmode\v!footer
\fi}
-\def\calculatevsizes % name will change
+\unexpanded\def\calculatevsizes % name will change
{\textheight\makeupheight
\doifelselayoutsomeline\v!header\compensatevsizeheader\donothing
\doifelselayoutsomeline\v!footer\compensatevsizefooter\donothing
@@ -1122,14 +1122,14 @@
\resetglobal
\page_otr_command_set_vsize}
-\def\calculateglobalvsizes % name will change
+\unexpanded\def\calculateglobalvsizes % name will change
{\global\textheight\makeupheight
\doifelselayoutsomeline\v!header\globalcompensatevsizeheader\donothing
\doifelselayoutsomeline\v!footer\globalcompensatevsizefooter\donothing
\page_layouts_set_modes
\page_otr_command_set_vsize}
-\def\calculatereducedvsizes % name will change
+\unexpanded\def\calculatereducedvsizes % name will change
{\textheight\makeupheight
\doifelselayoutsomeline\v!header\compensatevsizeheader\compensatevsizeheaderzero
\doifelselayoutsomeline\v!footer\compensatevsizefooter\compensatevsizefooterzero}
@@ -1142,7 +1142,7 @@
\def\compensatedinnermakeupmargin
{\dimexpr\ifconditional\innermakeupcompensation+\innermakeupmargin\else\zeropoint\fi\relax}
-\def\freezetextwidth % name will change % \makeupwidth may be set to \textwidth
+\unexpanded\def\freezetextwidth % name will change % \makeupwidth may be set to \textwidth
{\textwidth\makeupwidth % which is a tricky but valid value
\edef\m_currentlayout_text_width {\layoutparameter\c!textwidth }%
\edef\m_currentlayout_text_margin{\layoutparameter\c!textmargin}%
@@ -1159,7 +1159,7 @@
\global\advance\innermakeupwidth-\scratchdimen
\advance\textwidth-\scratchdimen} % local
-\def\calculatehsizes % name will change
+\unexpanded\def\calculatehsizes % name will change
{\freezetextwidth
\page_otr_command_set_hsize}
diff --git a/tex/context/base/mkiv/page-mix.mkiv b/tex/context/base/mkiv/page-mix.mkiv
index 7f512732e..326d01994 100644
--- a/tex/context/base/mkiv/page-mix.mkiv
+++ b/tex/context/base/mkiv/page-mix.mkiv
@@ -971,27 +971,30 @@
%D We need to hook some handlers into the output routine and we define
%D a dedicated one:
+\let\page_mix_command_flush_all_floats\page_one_command_flush_all_floats
+
\defineoutputroutine
[\s!mixedcolumn]
[\s!page_otr_command_routine =\page_mix_command_routine,
\s!page_otr_command_package_contents =\page_mix_command_package_contents,
\s!page_otr_command_set_vsize =\page_mix_command_set_vsize,
\s!page_otr_command_set_hsize =\page_mix_command_set_hsize,
+ % \s!page_otr_command_synchronize_hsize =\page_mix_command_synchronize_hsize,
\s!page_otr_command_next_page =\page_mix_command_next_page,
\s!page_otr_command_next_page_and_inserts =\page_mix_command_next_page_and_inserts,
- % \s!page_otr_command_synchronize_hsize =\page_mix_command_synchronize_hsize,
% \s!page_otr_command_set_top_insertions =\page_mix_command_set_top_insertions,
% \s!page_otr_command_set_bottom_insertions =\page_mix_command_set_bottom_insertions,
% \s!page_otr_command_flush_top_insertions =\page_mix_command_flush_top_insertions,
% \s!page_otr_command_flush_bottom_insertions=\page_mix_command_flush_bottom_insertions,
- % \s!page_otr_command_set_float_hsize =\page_mix_command_set_float_hsize,
\s!page_otr_command_check_if_float_fits =\page_mix_command_check_if_float_fits,
+ % \s!page_otr_command_set_float_hsize =\page_mix_command_set_float_hsize,
\s!page_otr_command_flush_float_box =\page_mix_command_flush_float_box,
- \s!page_otr_command_synchronize_side_floats=\page_mix_command_synchronize_side_floats,
\s!page_otr_command_side_float_output =\page_mix_command_side_float_output,
+ \s!page_otr_command_synchronize_side_floats=\page_mix_command_synchronize_side_floats,
\s!page_otr_command_flush_floats =\page_mix_command_flush_floats,
\s!page_otr_command_flush_side_floats =\page_mix_command_flush_side_floats,
\s!page_otr_command_flush_saved_floats =\page_mix_command_flush_saved_floats,
+ \s!page_otr_command_flush_all_floats =\page_mix_command_flush_all_floats,
% \s!page_otr_command_flush_margin_blocks =\page_mix_command_flush_margin_blocks, % not used
\s!page_otr_command_test_column =\page_mix_command_test_column
]
diff --git a/tex/context/base/mkiv/page-mul.mkiv b/tex/context/base/mkiv/page-mul.mkiv
index 5b4f064d0..51af24b6a 100644
--- a/tex/context/base/mkiv/page-mul.mkiv
+++ b/tex/context/base/mkiv/page-mul.mkiv
@@ -1820,6 +1820,7 @@
\let\page_mul_command_package_contents\page_one_command_package_contents
\let\page_mul_command_flush_float_box \page_one_command_flush_float_box
+\let\page_mul_command_flush_all_floats\page_one_command_flush_all_floats
\defineoutputroutine
[\s!multicolumn]
@@ -1827,21 +1828,22 @@
\s!page_otr_command_package_contents =\page_mul_command_package_contents,
\s!page_otr_command_set_vsize =\page_mul_command_set_vsize,
\s!page_otr_command_set_hsize =\page_mul_command_set_hsize,
+ % \s!page_otr_command_synchronize_hsize =\page_mul_command_synchronize_hsize,
\s!page_otr_command_next_page =\page_mul_command_next_page,
\s!page_otr_command_next_page_and_inserts =\page_mul_command_next_page_and_inserts,
- % \s!page_otr_command_synchronize_hsize =\page_mul_command_synchronize_hsize,
% \s!page_otr_command_set_top_insertions =\page_mul_command_set_top_insertions,
% \s!page_otr_command_set_bottom_insertions =\page_mul_command_set_bottom_insertions,
\s!page_otr_command_flush_top_insertions =\page_mul_command_flush_top_insertions,
% \s!page_otr_command_flush_bottom_insertions=\page_mul_command_flush_bottom_insertions,
- % \s!page_otr_command_set_float_hsize =\page_mul_command_set_float_hsize,
\s!page_otr_command_check_if_float_fits =\page_mul_command_check_if_float_fits,
+ % \s!page_otr_command_set_float_hsize =\page_mul_command_set_float_hsize,
\s!page_otr_command_flush_float_box =\page_mul_command_flush_float_box,
- \s!page_otr_command_synchronize_side_floats=\page_mul_command_synchronize_side_floats,
\s!page_otr_command_side_float_output =\page_mul_command_side_float_output,
+ \s!page_otr_command_synchronize_side_floats=\page_mul_command_synchronize_side_floats,
\s!page_otr_command_flush_floats =\page_mul_command_flush_floats,
\s!page_otr_command_flush_side_floats =\page_mul_command_flush_side_floats,
\s!page_otr_command_flush_saved_floats =\page_mul_command_flush_saved_floats,
+ \s!page_otr_command_flush_all_floats =\page_mul_command_flush_all_floats,
% \s!page_otr_command_flush_margin_blocks =\page_mul_command_flush_margin_blocks, % not used
\s!page_otr_command_test_column =\page_mul_command_test_column
]
diff --git a/tex/context/base/mkiv/page-one.mkiv b/tex/context/base/mkiv/page-one.mkiv
index f8980b055..35233247b 100644
--- a/tex/context/base/mkiv/page-one.mkiv
+++ b/tex/context/base/mkiv/page-one.mkiv
@@ -600,27 +600,43 @@
\unexpanded\def\page_one_command_test_page
{\testpage}
+\unexpanded\def\page_one_command_flush_all_floats
+ {\ifconditional\c_page_floats_some_waiting
+ \begingroup
+ \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
+ % when just flushing; so now we have (maybe optional):
+ \pagebaselinecorrection % hm, needs checking, not needed when no floats
+ % alas, this is tricky but needed (first surfaced in prikkels)
+ \page_otr_command_flush_floats
+ \endgroup
+ \fi}
+
\defineoutputroutine
[\s!singlecolumn]
[\s!page_otr_command_routine =\page_one_command_routine,
\s!page_otr_command_package_contents =\page_one_command_package_contents,
\s!page_otr_command_set_vsize =\page_one_command_set_vsize,
\s!page_otr_command_set_hsize =\page_one_command_set_hsize,
+ % \s!page_otr_command_synchronize_hsize =\page_one_command_synchronize_hsize,
\s!page_otr_command_next_page =\page_one_command_next_page,
\s!page_otr_command_next_page_and_inserts =\page_one_command_next_page_and_inserts,
- % \s!page_otr_command_synchronize_hsize =\page_one_command_synchronize_hsize,
\s!page_otr_command_set_top_insertions =\page_one_command_set_top_insertions,
\s!page_otr_command_set_bottom_insertions =\page_one_command_set_bottom_insertions,
\s!page_otr_command_flush_top_insertions =\page_one_command_flush_top_insertions,
\s!page_otr_command_flush_bottom_insertions=\page_one_command_flush_bottom_insertions,
- % \s!page_otr_command_set_float_hsize =\page_one_command_set_float_hsize,
\s!page_otr_command_check_if_float_fits =\page_one_command_check_if_float_fits,
+ % \s!page_otr_command_set_float_hsize =\page_one_command_set_float_hsize,
\s!page_otr_command_flush_float_box =\page_one_command_flush_float_box,
- \s!page_otr_command_synchronize_side_floats=\page_one_command_synchronize_side_floats,
\s!page_otr_command_side_float_output =\page_one_command_side_float_output,
+ \s!page_otr_command_synchronize_side_floats=\page_one_command_synchronize_side_floats,
\s!page_otr_command_flush_floats =\page_one_command_flush_floats,
\s!page_otr_command_flush_side_floats =\page_one_command_flush_side_floats,
\s!page_otr_command_flush_saved_floats =\page_one_command_flush_saved_floats,
+ \s!page_otr_command_flush_all_floats =\page_one_command_flush_all_floats,
\s!page_otr_command_flush_margin_blocks =\page_one_command_flush_margin_blocks,
\s!page_otr_command_test_column =\page_one_command_test_page
]
diff --git a/tex/context/base/mkiv/page-otr.mkvi b/tex/context/base/mkiv/page-otr.mkvi
index f4633f1fd..1fe928c36 100644
--- a/tex/context/base/mkiv/page-otr.mkvi
+++ b/tex/context/base/mkiv/page-otr.mkvi
@@ -259,7 +259,9 @@
{\writestatus\m!system{Sorry, you're not done yet, so no goodbye!}}
%D We define a few constants because that (1) provides some checking
-%D and (2) is handier when aligning definitions (checks nicer).
+%D and (2) is handier when aligning definitions (checks nicer). Most
+%D routines will use ard codes names but sometimes we want to adapt,
+%D which is why we have these:
\definesystemconstant{page_otr_command_routine}
\definesystemconstant{page_otr_command_package_contents}
@@ -280,12 +282,14 @@
\definesystemconstant{page_otr_command_flush_floats}
\definesystemconstant{page_otr_command_flush_side_floats}
\definesystemconstant{page_otr_command_flush_saved_floats}
+\definesystemconstant{page_otr_command_flush_all_floats}
\definesystemconstant{page_otr_command_flush_margin_blocks}
\definesystemconstant{page_otr_command_test_column}
\definesystemconstant{singlecolumn}
\definesystemconstant{multicolumn} % will move
\definesystemconstant{columnset} % will move
+\definesystemconstant{pagecolumn} % will move
\defineoutputroutinecommand
[\s!page_otr_command_routine,
@@ -307,6 +311,7 @@
\s!page_otr_command_flush_floats,
\s!page_otr_command_flush_side_floats,
\s!page_otr_command_flush_saved_floats,
+ \s!page_otr_command_flush_all_floats,
\s!page_otr_command_flush_margin_blocks,
\s!page_otr_command_test_column]
diff --git a/tex/context/base/mkiv/page-pcl.mkiv b/tex/context/base/mkiv/page-pcl.mkiv
index 3b936dea5..086cf69b0 100644
--- a/tex/context/base/mkiv/page-pcl.mkiv
+++ b/tex/context/base/mkiv/page-pcl.mkiv
@@ -30,8 +30,6 @@
\definemeasure[threecolumns][\dimexpr\plusthree\columnwidth+\plustwo \columndistance\relax]
\definemeasure[fourcolumns] [\dimexpr\plusfour \columnwidth+\plusthree\columndistance\relax]
-\def\s!pagecolumn{pagecolumn}
-
\newcount\c_page_col_n_of_columns \c_page_col_n_of_columns\plusone
\newcount\c_page_col_current \c_page_col_current \plusone
\newdimen\d_page_col_distance
@@ -49,70 +47,51 @@
%D We need to step over empty columns.
\unexpanded\def\page_col_command_next_page
- {\ifnum\c_page_col_n_of_columns=\plusone
- \page_otr_eject_page
- \else
- \page_otr_eject_page_column
- \fi}
+ {\page_col_eject_page}
\unexpanded\def\page_col_column
{\page_otr_eject_page}
-\unexpanded\def\page_otr_eject_page_column
+\unexpanded\def\page_col_eject_page
{\begingroup
- \scratchcountertwo\realpageno
+ \scratchcountertwo \realpageno
\page_otr_eject_page
- \scratchcounterone\zerocount
+ \scratchcounterone \c_page_col_current
\scratchcounterthree\zerocount
\doloop{%
\ifnum\scratchcounterthree>\plushundred
+ % too many attempts
+ \exitloop
+ \else\ifnum\realpageno>\scratchcountertwo
+ % we advanced at least one page so we're done
\exitloop
\else
- \advance\scratchcounterthree\plusone
- \ifnum\scratchcountertwo=\realpageno
- \ifnum\c_page_col_current=\plusone
- \exitloop
- \else
- \ifnum\scratchcounterone=\c_page_col_current
- \dontleavehmode\null
- \fi
- \page_otr_eject_page
- \scratchcounterone\c_page_col_current
- \fi
- \else
- \exitloop
+ \ifnum\scratchcounterone=\c_page_col_current
+ \dontleavehmode\null
\fi
- \fi
+ \page_otr_eject_page
+ \scratchcounterone\c_page_col_current
+ \advance\scratchcounterthree\plusone
+ \fi\fi
}%
\endgroup}
%D \unknown
\unexpanded\def\page_col_command_next_page_and_inserts
- {\ifnum\c_page_col_n_of_columns=\plusone
- \page_otr_eject_page_and_flush_inserts
- \else
- \page_otr_eject_page_and_flush_inserts
- \fi}
+ {\page_otr_eject_page_and_flush_inserts}
%D \unknown
\unexpanded\def\page_col_command_set_hsize
- {\ifnum\c_page_col_n_of_columns=\plusone
- \page_one_command_set_hsize
- \else
- \page_col_command_set_hsize_indeed
- \fi}
-
-\unexpanded\def\page_col_command_set_hsize_indeed
{\global\hsize\d_page_col_column_width\relax
\global\d_page_col_available\dimexpr
\numexpr\c_page_col_n_of_columns-\c_page_col_current+\plusone\relax\d_page_col_column_width
+ \numexpr\c_page_col_n_of_columns-\c_page_col_current \relax\d_page_col_distance
\relax
- \global\d_page_col_sofar
+ \global\d_page_col_sofar
\ifnum\c_page_col_n_of_columns=\plusone
- \zerocount
+ \zeropoint
\else
\numexpr\c_page_col_n_of_columns-\plusone\relax
\dimexpr\d_page_col_column_width+\d_page_col_distance\relax
@@ -120,14 +99,7 @@
%D \unknown
-\unexpanded\def\page_col_command_set_vsize
- {\ifnum\c_page_col_n_of_columns=\plusone
- \page_one_command_set_vsize
- \else
- \page_col_command_set_vsize_indeed
- \fi}
-
-\unexpanded\def\page_col_command_set_vsize_indeed % \page_one_command_set_vsize minus the pagegoal setting
+\unexpanded\def\page_col_command_set_vsize % \page_one_command_set_vsize minus the pagegoal setting
{\ifgridsnapping
\ifcase\layoutlines
\getrawnoflines\textheight
@@ -141,12 +113,15 @@
%D \unknown
-\unexpanded\def\page_col_command_package_contents % \box<n> \unvbox<n> % this one will be redone (checked)
- {\ifnum\c_page_col_n_of_columns=\plusone
- \expandafter\page_one_command_package_contents
- \else
- \expandafter\page_col_command_package_contents_all
- \fi}
+\unexpanded\def\page_col_command_package_contents#1#2% \box<n> \unvbox<n> % this one will be redone (checked)
+ {\bgroup
+ \setbox\b_page_one_contents\vbox to \textheight
+ {\page_one_registered_text_area_a#1#2}%
+ \page_one_command_package_show_state
+ \ht\b_page_one_contents\textheight
+ \page_one_registered_text_area_b
+ {\box\b_page_one_contents}%
+ \egroup}
\unexpanded\def\page_col_command_package_contents_one#1#2% \box<n> \unvbox<n> % this one will be redone (checked)
{\bgroup
@@ -155,27 +130,27 @@
\strc_notes_check_if_bottom_present
\d_page_one_natural_depth\dp#2\relax
\setbox\b_page_one_contents\vbox to \textheight
- {\page_otr_command_flush_top_insertions
+ {\page_col_command_flush_top_insertions
\page_one_registered_text_area_a#1#2%
\hsize\d_page_col_column_width
\ifgridsnapping
\vskip\dimexpr\openstrutdepth-\d_page_one_natural_depth\relax
\prevdepth\openstrutdepth
- \page_otr_command_flush_bottom_insertions
+ \page_col_command_flush_bottom_insertions
\vfil
\else\ifcase\bottomraggednessmode
% ragged (default)
\vskip\dimexpr\openstrutdepth-\d_page_one_natural_depth\relax
\prevdepth\openstrutdepth
- \page_otr_command_flush_bottom_insertions
+ \page_col_command_flush_bottom_insertions
\vfil
\or
% align (normal)
- \page_otr_command_flush_bottom_insertions
+ \page_col_command_flush_bottom_insertions
\or
% baseline
\kern\dimexpr\maxdepth-\d_page_one_natural_depth\relax
- \page_otr_command_flush_bottom_insertions
+ \page_col_command_flush_bottom_insertions
\fi\fi
\fakepagenotes}%
\page_one_command_package_show_state
@@ -211,26 +186,9 @@
\fi
\egroup}
-\unexpanded\def\page_col_command_package_contents_all#1#2% \box<n> \unvbox<n> % this one will be redone (checked)
- {\bgroup
- \setbox\b_page_one_contents\vbox to \textheight
- {\page_one_registered_text_area_a#1#2}%
- \page_one_command_package_show_state
- \ht\b_page_one_contents\textheight
- \page_one_registered_text_area_b
- {\box\b_page_one_contents}%
- \egroup}
-
%D \unknown
\unexpanded\def\page_col_command_side_float_output
- {\ifnum\c_page_col_n_of_columns=\plusone
- \page_one_command_side_float_output
- \else
- \page_col_command_side_float_output_indeed
- \fi}
-
-\unexpanded\def\page_col_command_side_float_output_indeed
{% % %
\ifvoid\namedinsertionnumber\s!topfloat\else
\scratchwidth\wd\namedinsertionnumber\s!topfloat
@@ -309,82 +267,115 @@
%D \unknown
-\unexpanded\def\page_col_command_check_if_float_fits
- {\ifnum\c_page_col_n_of_columns=\plusone
- \page_one_command_check_if_float_fits
- \else
- \page_col_command_check_if_float_fits_indeed
- \fi}
+% \unexpanded\def\page_col_command_check_if_float_fits
+% {\ifconditional\c_page_floats_not_permitted
+% \global\setfalse\c_page_floats_room
+% %\else\ifabsdim\dimexpr\d_page_col_available-\naturalfloatwd\relax<\onepoint
+% \else\ifdim\dimexpr\d_page_col_available-\naturalfloatwd\relax>-\onepoint
+% \global\settrue\c_page_floats_room
+% \else
+% \global\setfalse\c_page_floats_room
+% \fi\fi
+% \ifconditional\c_page_floats_room
+% \begingroup
+% \scratchdimen\dimexpr\pagetotal+\lineheight\relax
+% \ifdim\scratchdimen>\pagegoal
+% \goodbreak
+% \ifdim\dimexpr\d_page_col_available-\naturalfloatwd\relax>\onepoint
+% \global\setfalse\c_page_floats_room
+% \else
+% \global\settrue\c_page_floats_room
+% \fi
+% \fi
+% \endgroup
+% \fi
+% \ifconditional\c_page_floats_room
+% \ifdim\pagetotal>\zeropoint
+% \scratchdimenone\dimexpr\pagetotal+\floatheight+\d_strc_floats_top-\pageshrink\relax
+% \scratchdimentwo\pagegoal
+% \relax % needed
+% \ifcase\c_page_one_float_method
+% % method 0 : raw
+% \or
+% % method 1 : safe
+% \advance\scratchdimentwo -\strutdp
+% \or
+% % method 2 : tight
+% \advance\scratchdimenone -\onepoint
+% \fi
+% \relax % really needed ! ! ! !
+% \ifdim\scratchdimenone>\scratchdimentwo
+% \global\setfalse\c_page_floats_room
+% \fi
+% \fi
+% \ifconditional\c_page_floats_room
+% \global\setbox\floatbox\hpack to \d_page_col_available{\hss\box\floatbox\hss}%
+% \fi
+% \fi}
-\unexpanded\def\page_col_command_check_if_float_fits_indeed
+\unexpanded\def\page_col_command_check_if_float_fits
{\ifconditional\c_page_floats_not_permitted
+ % forget about it anyway
\global\setfalse\c_page_floats_room
- \else\ifabsdim\dimexpr\d_page_col_available-\naturalfloatwd\relax<\onepoint
- \global\settrue\c_page_floats_room
\else
- \global\setfalse\c_page_floats_room
- \fi\fi
- \ifconditional\c_page_floats_room
- \begingroup
- \scratchdimen\dimexpr\pagetotal+\lineheight\relax
- \ifdim\scratchdimen>\pagegoal
- \goodbreak
- \ifdim\dimexpr\d_page_col_available-\naturalfloatwd\relax>\onepoint
- \global\setfalse\c_page_floats_room
- \else
- \global\settrue\c_page_floats_room
- \fi
+ % first we check the current column
+% \ifdim\dimexpr\d_page_col_width-\naturalfloatwd\relax>-\onepoint
+ \ifdim\dimexpr\hsize-\naturalfloatwd\relax>-\onepoint
+ \global\settrue\c_page_floats_room
+ \else
+ \global\setfalse\c_page_floats_room
\fi
- \endgroup
- \fi
- \ifconditional\c_page_floats_room
- \ifdim\pagetotal>\zeropoint
- \scratchdimenone\dimexpr\pagetotal+\floatheight+\d_strc_floats_top-\pageshrink\relax
- \scratchdimentwo\pagegoal
- \relax % needed
- \ifcase\c_page_one_float_method
- % method 0 : raw
- \or
- % method 1 : safe
- \advance\scratchdimentwo -\strutdp
- \or
- % method 2 : tight
- \advance\scratchdimenone -\onepoint
+ \ifconditional\c_page_floats_room
+ % we fit in the column but do we have room
+ \ifdim\dimexpr\pagetotal+\lineheight\relax>\pagegoal
+ % try again later
+ \goodbreak
\fi
- \relax % really needed ! ! ! !
- \ifdim\scratchdimenone>\scratchdimentwo
- \global\setfalse\c_page_floats_room
+ \ifdim\pagetotal>\zeropoint
+ \scratchdimenone\dimexpr\pagetotal+\floatheight+\d_strc_floats_top-\pageshrink\relax
+ \scratchdimentwo\pagegoal
+ \relax % needed
+ \ifcase\c_page_one_float_method
+ % method 0 : raw
+ \or
+ % method 1 : safe
+ \advance\scratchdimentwo -\strutdp
+ \or
+ % method 2 : tight
+ \advance\scratchdimenone -\onepoint
+ \fi
+ \relax % really needed ! ! ! !
+ \ifdim\scratchdimenone>\scratchdimentwo
+ % there is no room, give up
+ \global\setfalse\c_page_floats_room
+ % now we can decide on a top float
+% \fi
+ \else
+% \ifconditional\c_page_floats_room
+% \global\setbox\floatbox\hpack to \d_page_col_float_available{\hss\box\floatbox\hss}%
+% \fi
+ \fi
\fi
\fi
- \ifconditional\c_page_floats_room
- \global\setbox\floatbox\hpack to \d_page_col_available{\hss\box\floatbox\hss}%
- \fi
\fi}
%D \unknown
-\unexpanded\def\page_col_command_flush_floats
- {\ifnum\c_page_col_n_of_columns=\plusone
- \page_one_command_flush_floats
- \else
- \page_col_command_flush_floats_indeed
- \fi}
-
\def\page_col_set_float_pack_hsize
{\ifnum\c_page_col_current=\c_page_col_n_of_columns
\c_page_col_current\plusone
\else
\advance\c_page_col_current\plusone
\fi
- \page_col_command_set_hsize_indeed
+ \page_col_command_set_hsize
\hsize\d_page_col_available}
-\unexpanded\def\page_col_command_flush_floats_indeed
+\unexpanded\def\page_col_command_flush_floats
{\global\settrue\c_page_floats_flushing
\ifconditional\c_page_floats_some_waiting
\par
\page_col_set_float_pack_hsize
- \page_col_command_flush_floats_indeed_indeed
+ \page_col_command_flush_floats_indeed
\fi
\global\savednoffloats\zerocount
\global\setfalse\c_page_floats_some_waiting
@@ -400,7 +391,7 @@
\let\page_floats_show_pack_state\gobbleoneargument
-\def\page_col_command_flush_floats_indeed_indeed % much in common with OTRSET
+\def\page_col_command_flush_floats_indeed % much in common with OTRSET
{\ifconditional\c_page_floats_some_waiting
\ifconditional\c_page_floats_pack_flushed
\setfalse\c_page_floats_center_box % not needed as we do call directly
@@ -439,7 +430,7 @@
\hfil}%
\doplacefloatbox
% \page_one_insert_top_float
- \doubleexpandafter\page_col_command_flush_floats_indeed_indeed
+ \doubleexpandafter\page_col_command_flush_floats_indeed
\else
% todo
\fi
@@ -447,7 +438,7 @@
\page_floats_get
% \page_one_insert_top_float
\doplacefloatbox
- \doubleexpandafter\page_col_command_flush_floats_indeed_indeed
+ \doubleexpandafter\page_col_command_flush_floats_indeed
\fi
\fi}
@@ -464,20 +455,6 @@
\fi\fi
\fi}
-\unexpanded\def\page_col_command_flush_top_insertions
- {\ifnum\c_page_col_n_of_columns=\plusone
- \page_one_command_flush_top_insertions
- \else
- \page_col_command_flush_top_insertions_indeed
- \fi}
-
-\unexpanded\def\page_col_command_flush_bottom_insertions
- {\ifnum\c_page_col_n_of_columns=\plusone
- \page_one_command_flush_bottom_insertions
- \else
- \page_col_command_flush_bottom_insertions_indeed
- \fi}
-
\unexpanded\def\page_col_command_set_top_insertions
{\bgroup
\ifconditional\c_page_floats_some_waiting
@@ -561,15 +538,8 @@
\fi
\page_col_command_set_top_insertions_indeed}
-\unexpanded\def\page_col_command_set_bottom_insertions
- {\ifnum\c_page_col_n_of_columns=\plusone
- \page_one_command_set_bottom_insertions
- \else
- \page_col_command_set_bottom_insertions_indeed
- \fi}
-
-\let\page_col_command_flush_top_insertions_indeed \page_one_command_flush_top_insertions
-\let\page_col_command_flush_bottom_insertions_indeed\page_one_command_flush_bottom_insertions
+\let\page_col_command_flush_top_insertions \page_one_command_flush_top_insertions
+\let\page_col_command_flush_bottom_insertions\page_one_command_flush_bottom_insertions
%let\page_col_command_set_top_insertions \page_one_command_set_top_insertions
\let\page_col_command_set_bottom_insertions \page_one_command_set_bottom_insertions
@@ -631,14 +601,7 @@
%D \unknown
-\unexpanded\def\page_col_command_routine % yet the same
- {\ifnum\c_page_col_n_of_columns=\plusone
- \page_sides_output_routine
- \else
- \page_sides_output_routine_column
- \fi}
-
-\def\page_sides_output_routine_column
+\unexpanded\def\page_col_command_routine
{\ifconditional\c_page_sides_short
\page_sides_output_routine_yes_column
\else
@@ -677,6 +640,8 @@
% why was this \global\holdinginserts\zerocount
\global\setfalse\c_page_sides_short}
+\let\page_col_command_flush_all_floats\relax
+
%D \unknown
\defineoutputroutine
@@ -685,21 +650,22 @@
\s!page_otr_command_package_contents =\page_col_command_package_contents,
\s!page_otr_command_set_vsize =\page_col_command_set_vsize,
\s!page_otr_command_set_hsize =\page_col_command_set_hsize,
+ % \s!page_otr_command_synchronize_hsize =\page_col_command_synchronize_hsize, % not done
\s!page_otr_command_next_page =\page_col_command_next_page,
\s!page_otr_command_next_page_and_inserts =\page_col_command_next_page_and_inserts,
- % \s!page_otr_command_synchronize_hsize =\page_col_command_synchronize_hsize, % not done
\s!page_otr_command_set_top_insertions =\page_col_command_set_top_insertions,
\s!page_otr_command_set_bottom_insertions =\page_col_command_set_bottom_insertions,
\s!page_otr_command_flush_top_insertions =\page_col_command_flush_top_insertions,
\s!page_otr_command_flush_bottom_insertions=\page_col_command_flush_bottom_insertions,
- % \s!page_otr_command_set_float_hsize =\page_col_command_set_float_hsize, % not done
\s!page_otr_command_check_if_float_fits =\page_col_command_check_if_float_fits,
+ % \s!page_otr_command_set_float_hsize =\page_col_command_set_float_hsize, % not done
\s!page_otr_command_flush_float_box =\page_col_command_flush_float_box,
- \s!page_otr_command_synchronize_side_floats=\page_col_command_synchronize_side_floats,
\s!page_otr_command_side_float_output =\page_col_command_side_float_output,
+ \s!page_otr_command_synchronize_side_floats=\page_col_command_synchronize_side_floats,
\s!page_otr_command_flush_floats =\page_col_command_flush_floats,
\s!page_otr_command_flush_side_floats =\page_col_command_flush_side_floats,
\s!page_otr_command_flush_saved_floats =\page_col_command_flush_saved_floats,
+ \s!page_otr_command_flush_all_floats =\page_col_command_flush_all_floats,
\s!page_otr_command_flush_margin_blocks =\page_col_command_flush_margin_blocks,
\s!page_otr_command_test_column =\page_col_command_test_page
]
@@ -745,9 +711,6 @@
%D The main interface:
-\setupoutputroutine
- [\s!pagecolumn]
-
\installcorenamespace{pagecolumns}
\installframedcommandhandler \??pagecolumns {pagecolumns} \??pagecolumns
@@ -793,11 +756,15 @@
{\let\currentpagecolumns\empty
\setuppagecolumns[#1]}%
{\edef\currentpagecolumns{#1}}%
- %
- % \page_col_enable_grid_snapping
- %
- \d_page_col_distance \pagecolumnsparameter\c!distance\relax
- \c_page_col_n_of_columns \pagecolumnsparameter\c!n\relax
+ \c_page_col_n_of_columns\pagecolumnsparameter\c!n\relax
+ \ifnum\c_page_col_n_of_columns>\plusone
+ \expandafter\page_col_start_yes
+ \else
+ \expandafter\page_col_start_nop
+ \fi} % public
+
+\unexpanded\def\page_col_start_yes
+ {\d_page_col_distance \pagecolumnsparameter\c!distance\relax
% \d_page_col_max_height \pagecolumnsparameter\c!maxheight
\d_page_col_max_width \pagecolumnsparameter\c!maxwidth
% \d_page_col_balance_step \pagecolumnsparameter\c!step
@@ -829,20 +796,35 @@
\setupoutputroutine[\s!pagecolumn]%
%
\setupfloats[\c!ntop=\plusthousand]%
+ % \setupfloats[\c!nbottom=\plusthousand]%
%
\page_col_command_set_vsize
\page_col_command_set_hsize
%
- \nofcolumns\c_page_mix_n_of_columns} % public
+ \nofcolumns\c_page_mix_n_of_columns
+ %
+ \unexpanded\def\page_col_start[##1]%
+ {\page_col_start_nop}%
+ %
+ \let\stoppagecolumns\page_col_stop_yes}
+
+\unexpanded\def\page_col_start_nop
+ {\nofcolumns\c_page_mix_n_of_columns
+ \let\stoppagecolumns\page_col_stop_nop}
-\unexpanded\def\stoppagecolumns
+\unexpanded\def\page_col_stop_yes
{\column % \page_otr_eject_page
\page
\endgroup
- \setupoutputroutine[\s!singlecolumn]%
- \page_col_command_set_vsize
- \page_col_command_set_hsize
+ % \setupoutputroutine[\s!singlecolumn]%
+ \page_otr_command_set_vsize
+ \page_otr_command_set_hsize
\page
\endgroup}
+\unexpanded\def\page_col_stop_nop
+ {\page
+ \endgroup
+ \endgroup}
+
\protect \endinput
diff --git a/tex/context/base/mkiv/page-set.mkiv b/tex/context/base/mkiv/page-set.mkiv
index 261aabf7a..fb6f607a1 100644
--- a/tex/context/base/mkiv/page-set.mkiv
+++ b/tex/context/base/mkiv/page-set.mkiv
@@ -661,7 +661,7 @@
\installcolumnbreakmethod \s!columnset \v!local
{\OTRSETcolumnhbreak
- \page_otr_flush_all_floats
+ \page_set_command_flush_all_floats
\page_otr_eject_page
% no \page_set_command_set_hsize, can be mid smaller (like tabulate)
% also, this one should be executed at the outer level
@@ -2598,27 +2598,31 @@
\fi
\fi}
+\unexpanded\def\page_set_command_flush_all_floats
+ {\page_one_command_flush_all_floats}
+
\defineoutputroutine
[\s!columnset]
[\s!page_otr_command_routine =\page_set_command_routine,
\s!page_otr_command_package_contents =\page_set_command_package_contents,
\s!page_otr_command_set_vsize =\page_set_command_set_vsize,
% \s!page_otr_command_set_hsize =\page_one_command_set_hsize, % tricky, goes wrong
+ \s!page_otr_command_synchronize_hsize =\page_set_command_synchronize_hsize,
\s!page_otr_command_next_page =\page_set_command_next_page,
\s!page_otr_command_next_page_and_inserts =\page_set_command_next_page_and_inserts,
- \s!page_otr_command_synchronize_hsize =\page_set_command_synchronize_hsize,
\s!page_otr_command_set_top_insertions =\page_set_command_set_top_insertions,
\s!page_otr_command_set_bottom_insertions =\page_set_command_set_bottom_insertions,
\s!page_otr_command_flush_top_insertions =\page_set_command_flush_top_insertions,
\s!page_otr_command_flush_bottom_insertions =\page_set_command_flush_bottom_insertions,
- \s!page_otr_command_set_float_hsize =\page_set_command_set_float_hsize,
\s!page_otr_command_check_if_float_fits =\page_set_command_check_if_float_fits,
+ \s!page_otr_command_set_float_hsize =\page_set_command_set_float_hsize,
\s!page_otr_command_flush_float_box =\page_set_command_flush_float_box,
- \s!page_otr_command_synchronize_side_floats =\page_set_command_synchronize_side_floats,
\s!page_otr_command_side_float_output =\page_set_command_side_float_output,
+ \s!page_otr_command_synchronize_side_floats =\page_set_command_synchronize_side_floats,
\s!page_otr_command_flush_floats =\page_set_command_flush_floats,
\s!page_otr_command_flush_side_floats =\page_set_command_flush_side_floats,
- \s!page_otr_command_flush_saved_floats =\page_set_command_flush_saved_floats
+ \s!page_otr_command_flush_saved_floats =\page_set_command_flush_saved_floats,
+ \s!page_otr_command_flush_all_floats =\page_set_command_flush_all_floats,
% \s!page_otr_command_flush_margin_blocks =\page_set_command_flush_margin_blocks, % not used
]
diff --git a/tex/context/base/mkiv/publ-aut.lua b/tex/context/base/mkiv/publ-aut.lua
index becb7b125..76308825e 100644
--- a/tex/context/base/mkiv/publ-aut.lua
+++ b/tex/context/base/mkiv/publ-aut.lua
@@ -14,7 +14,7 @@ end
local lpeg = lpeg
local type, next, tostring, tonumber = type, next, tostring, tonumber
-local concat = table.concat
+local concat, sortedhash = table.concat, table.sortedhash
local utfsub = utf.sub
local formatters = string.formatters
@@ -123,19 +123,22 @@ end
local authormap = allocate()
publications.authormap = authormap
-local function splitauthor(author)
- local detail = cache[author]
- if detail then
- return detail
- end
- local remapped = authormap[author]
- if remapped then
- report("remapping %a to %a",author,remapped)
- local detail = cache[remapped]
+local function splitauthor(author,justsplit)
+ local detail, remapped
+ if not justsplit then
+ detail = cache[author]
if detail then
- cache[author] = detail
return detail
end
+ remapped = authormap[author]
+ if remapped then
+ report("remapping %a to %a",author,remapped)
+ local detail = cache[remapped]
+ if detail then
+ cache[author] = detail
+ return detail
+ end
+ end
end
local author = remapped or author
local firstnames, vons, surnames, initials, juniors, options
@@ -253,8 +256,10 @@ local function splitauthor(author)
if initials and #initials > 0 then detail.initials = initials end
if juniors and #juniors > 0 then detail.juniors = juniors end
if options and next(options) then detail.options = options end
- cache[author] = detail
- nofhits = nofhits + 1
+ if not justsplit then
+ cache[author] = detail
+ nofhits = nofhits + 1
+ end
return detail
end
@@ -293,8 +298,8 @@ local function splitauthorstring(str)
return authors
end
-publications.splitoneauthor = splitauthor
-publications.splitauthor = splitauthorstring
+publications.splitoneauthor = splitauthor
+publications.splitauthor = splitauthorstring
local function the_initials(initials,symbol,connector)
if not symbol then
@@ -307,18 +312,20 @@ local function the_initials(initials,symbol,connector)
for i=1,#initials do
local initial = initials[i]
if type(initial) == "table" then
+ -- J.-J.
local set, s = { }, 0
for i=1,#initial do
if i > 1 then
s = s + 1 ; set[s] = connector
end
s = s + 1 ; set[s] = initial[i]
+ s = s + 1 ; set[s] = symbol
end
- r = r + 1 ; result[r] = concat(set) .. symbol
+ r = r + 1 ; result[r] = concat(set)
else
+ -- J.
r = r + 1 ; result[r] = initial .. symbol
end
- -- r = r + 1 ; result[r] = symbol
end
return result
end
@@ -536,6 +543,9 @@ local collapsers = allocate { }
publications.authorcollapsers = collapsers
+-- making a constructor doesn't make the code nicer as the_initials is an
+-- exception
+
local function default(author) -- one author
local hash = author.hash
if hash then
@@ -713,8 +723,101 @@ authorhashers.normalshort = function(authors)
end
end
-authorhashers.normalinverted = authorhashers.normal
-authorhashers.invertedshort = authorhashers.normalshort
+local sequentialhash = function(authors)
+ if type(authors) == "table" then
+ local n = #authors
+ if n == 0 then
+ return ""
+ end
+ local result = { }
+ local nofresult = 0
+ for i=1,n do
+ local author = authors[i]
+ local vons = author.vons
+ local surnames = author.surnames
+ local firstnames = author.firstnames
+ local juniors = author.juniors
+ if firstnames and #firstnames > 0 then
+ for j=1,#firstnames do
+ nofresult = nofresult + 1
+ result[nofresult] = firstnames[j]
+ end
+ end
+ if vons and #vons > 0 then
+ for j=1,#vons do
+ nofresult = nofresult + 1
+ result[nofresult] = vons[j]
+ end
+ end
+ if surnames and #surnames > 0 then
+ for j=1,#surnames do
+ nofresult = nofresult + 1
+ result[nofresult] = surnames[j]
+ end
+ end
+ if juniors and #juniors > 0 then
+ for j=1,#juniors do
+ nofresult = nofresult + 1
+ result[nofresult] = juniors[j]
+ end
+ end
+ end
+ return concat(result," ")
+ else
+ return authors
+ end
+end
+
+local sequentialshorthash = function(authors)
+ if type(authors) == "table" then
+ local n = #authors
+ if n == 0 then
+ return ""
+ end
+ local result = { }
+ local nofresult = 0
+ for i=1,n do
+ local author = authors[i]
+ local vons = author.vons
+ local surnames = author.surnames
+ local initials = author.initials
+ local juniors = author.juniors
+ if initials and #initials > 0 then
+ initials = the_initials(initials)
+ for j=1,#initials do
+ nofresult = nofresult + 1
+ result[nofresult] = initials[j]
+ end
+ end
+ if vons and #vons > 0 then
+ for j=1,#vons do
+ nofresult = nofresult + 1
+ result[nofresult] = vons[j]
+ end
+ end
+ if surnames and #surnames > 0 then
+ for j=1,#surnames do
+ nofresult = nofresult + 1
+ result[nofresult] = surnames[j]
+ end
+ end
+ if juniors and #juniors > 0 then
+ for j=1,#juniors do
+ nofresult = nofresult + 1
+ result[nofresult] = juniors[j]
+ end
+ end
+ end
+ return concat(result," ")
+ else
+ return authors
+ end
+end
+
+authorhashers.sequential = sequentialhash
+authorhashers.sequentialshort = sequentialshorthash
+authorhashers.normalinverted = authorhashers.normal
+authorhashers.invertedshort = authorhashers.normalshort
local p_clean = Cs ( (
P("\\btxcmd") / "" -- better keep the argument
@@ -874,6 +977,31 @@ implement {
name = "btxremapauthor",
arguments = { "string", "string" },
actions = function(k,v)
- publications.authormap[k] = v
+ local a = { splitauthor(k,true) }
+ local s1 = sequentialhash(a)
+ local s2 = sequentialshorthash(a)
+ if not authormap[k] then
+ authormap[k] = v
+ report("%a mapped onto %a",k,v)
+ end
+ if not authormap[s1] then
+ authormap[s1] = v
+ report("%a mapped onto %a, derived from %a",s1,v,k)
+ end
+ if not authormap[s2] then
+ authormap[s2] = v
+ report("%a mapped onto %a, derived from %a",s2,v,k)
+ end
+ end
+}
+
+implement {
+ name = "btxshowauthorremapping",
+ actions = function(k,v)
+ report("start author remapping")
+ for k, v in sortedhash(authormap) do
+ report(" %s => %s",k,v)
+ end
+ report("stop author remapping")
end
}
diff --git a/tex/context/base/mkiv/publ-ini.mkiv b/tex/context/base/mkiv/publ-ini.mkiv
index 6c28bcf90..9f970547d 100644
--- a/tex/context/base/mkiv/publ-ini.mkiv
+++ b/tex/context/base/mkiv/publ-ini.mkiv
@@ -1140,6 +1140,9 @@
\def\btx_remap_author[#1][#2]%
{\clf_btxremapauthor{#1}{#2}}
+\unexpanded\def\btxshowauthorremapping
+ {\clf_btxshowauthorremapping}
+
\unexpanded\def\btxflushauthor
{\doifelsenextoptionalcs\btx_flush_author_yes\btx_flush_author_nop}
diff --git a/tex/context/base/mkiv/status-files.pdf b/tex/context/base/mkiv/status-files.pdf
index 53fefa668..de25dd503 100644
--- a/tex/context/base/mkiv/status-files.pdf
+++ b/tex/context/base/mkiv/status-files.pdf
Binary files differ
diff --git a/tex/context/base/mkiv/status-lua.pdf b/tex/context/base/mkiv/status-lua.pdf
index e2fd24d5b..8b8060c3f 100644
--- a/tex/context/base/mkiv/status-lua.pdf
+++ b/tex/context/base/mkiv/status-lua.pdf
Binary files differ
diff --git a/tex/context/base/mkiv/strc-flt.mkvi b/tex/context/base/mkiv/strc-flt.mkvi
index 0a1f59335..45d395f21 100644
--- a/tex/context/base/mkiv/strc-flt.mkvi
+++ b/tex/context/base/mkiv/strc-flt.mkvi
@@ -494,6 +494,12 @@
% place
+\let\floatlabel \empty
+\let\floatcolumn \empty
+\let\floatrow \empty
+\let\floatlocation \empty
+\let\floatlocationmethod\empty
+
\def\strc_floats_analyze_location
{% moved here, will do more
\let\floatlabel \empty
diff --git a/tex/context/base/mkiv/util-lib.lua b/tex/context/base/mkiv/util-lib.lua
index 490cb3291..714cfd4c7 100644
--- a/tex/context/base/mkiv/util-lib.lua
+++ b/tex/context/base/mkiv/util-lib.lua
@@ -355,22 +355,39 @@ We use the same lookup logic for ffi loading.
-- local message, library = pcall(savedffiload,nameonly(name))
-- poplibpath()
+ local loaded = { }
+
local function locateindeed(name)
- local message, library = pcall(savedffiload,removesuffix(name))
- if type(message) == "userdata" then
- return message
- elseif type(library) == "userdata" then
- return library
- else
- return false
+ name = removesuffix(name)
+ local l = loaded[name]
+ if l == nil then
+ local message, library = pcall(savedffiload,name)
+ if type(message) == "userdata" then
+ l = message
+ elseif type(library) == "userdata" then
+ l = library
+ else
+ l = false
+ end
+ loaded[name] = l
+ elseif trace_ffilib then
+ report_ffilib("reusing already loaded %a",name)
end
+ return l
end
- function ffilib(required,version)
- if version == "system" then
+ function ffilib(name,version)
+ name = removesuffix(name)
+ local l = loaded[name]
+ if l ~= nil then
+ if trace_ffilib then
+ report_ffilib("reusing already loaded %a",name)
+ end
+ return l
+ elseif version == "system" then
return locateindeed(name)
else
- return locate(required,version,trace_ffilib,report_ffilib,locateindeed)
+ return locate(name,version,trace_ffilib,report_ffilib,locateindeed)
end
end
@@ -382,6 +399,7 @@ We use the same lookup logic for ffi loading.
if trace_ffilib then
report_ffilib("trying to load %a using normal loader",name)
end
+ -- so here we don't store
return savedffiload(name)
end
diff --git a/tex/context/base/mkiv/util-sql-imp-ffi.lua b/tex/context/base/mkiv/util-sql-imp-ffi.lua
index 4c0a17d27..213fce18e 100644
--- a/tex/context/base/mkiv/util-sql-imp-ffi.lua
+++ b/tex/context/base/mkiv/util-sql-imp-ffi.lua
@@ -143,7 +143,8 @@ ffi.cdef [[
]]
local sql = utilities.sql
-local mysql = ffi.load(os.name == "windows" and "libmysql" or "libmysqlclient")
+----- mysql = ffi.load(os.name == "windows" and "libmysql" or "libmysqlclient")
+local mysql = ffilib(os.name == "windows" and "libmysql" or "libmysqlclient")
local nofretries = 5
local retrydelay = 1
diff --git a/tex/context/base/mkiv/util-sql-imp-sqlite.lua b/tex/context/base/mkiv/util-sql-imp-sqlite.lua
index 85ef83d45..04d5ced3a 100644
--- a/tex/context/base/mkiv/util-sql-imp-sqlite.lua
+++ b/tex/context/base/mkiv/util-sql-imp-sqlite.lua
@@ -70,7 +70,8 @@ ffi.cdef [[
local ffi_tostring = ffi.string
-local sqlite = ffi.load("sqlite3")
+----- sqlite = ffi.load("sqlite3")
+local sqlite = ffilib("sqlite3")
sqlite.sqlite3_initialize();