diff options
11 files changed, 93 insertions, 55 deletions
diff --git a/Master/texmf-dist/doc/luatex/lua-widow-control/README.md b/Master/texmf-dist/doc/luatex/lua-widow-control/README.md index ff167352c6b..4360229236a 100644 --- a/Master/texmf-dist/doc/luatex/lua-widow-control/README.md +++ b/Master/texmf-dist/doc/luatex/lua-widow-control/README.md @@ -48,4 +48,4 @@ Lua-widow-control is licensed under the [_Mozilla Public License_, version 2.0]( Please note that a compiled document is absolutely **not** considered to be an "Executable Form" as defined by the MPL. The use of lua-widow-control in a document does not place **any** obligations on the document's author or distributors. The MPL and CC-BY-SA licenses **only** apply to you if you distribute the lua-widow-control source code or documentation. --- -_v2.2.1 (2022-07-28)_ <!--%%version %%dashdate--> +_v2.2.2 (2022-08-23)_ <!--%%version %%dashdate--> diff --git a/Master/texmf-dist/doc/luatex/lua-widow-control/lua-widow-control.pdf b/Master/texmf-dist/doc/luatex/lua-widow-control/lua-widow-control.pdf Binary files differindex 0914f4a2235..b984764d8f6 100644 --- a/Master/texmf-dist/doc/luatex/lua-widow-control/lua-widow-control.pdf +++ b/Master/texmf-dist/doc/luatex/lua-widow-control/lua-widow-control.pdf diff --git a/Master/texmf-dist/doc/luatex/lua-widow-control/tb133chernoff-widows.pdf b/Master/texmf-dist/doc/luatex/lua-widow-control/tb133chernoff-widows.pdf Binary files differindex 344604fb466..2595747b8a6 100644 --- a/Master/texmf-dist/doc/luatex/lua-widow-control/tb133chernoff-widows.pdf +++ b/Master/texmf-dist/doc/luatex/lua-widow-control/tb133chernoff-widows.pdf diff --git a/Master/texmf-dist/source/luatex/lua-widow-control/CHANGELOG.md b/Master/texmf-dist/source/luatex/lua-widow-control/CHANGELOG.md index b6822129f57..0ac3878e04b 100644 --- a/Master/texmf-dist/source/luatex/lua-widow-control/CHANGELOG.md +++ b/Master/texmf-dist/source/luatex/lua-widow-control/CHANGELOG.md @@ -9,10 +9,20 @@ Changelog All notable changes to lua-widow-control will be listed here, in reverse chronological order. **Changes listed in bold** are important changes: they either remove options or commands, or may change the location of page breaks. -## v2.2.1 (2022-07-28) +## v2.2.2 (2022-08-23) -- Fix crashes with recent LuaMetaTeX (ConTeXt MkXL) -- No longer show "left parfill skip" warnings with ConTeXt LMTX/MkXL ([#7](https://github.com/gucci-on-fleek/lua-widow-control/issues/7)) +- Add preliminary support for inserts/footnotes in LuaMetaTeX ([#38](https://github.com/gucci-on-fleek/lua-widow-control/issues/38)). + +- Use the built-in LaTeX key–value interface where available. + + This means that lua-widow-control now also reads the global class options. + +- Add support for split footnotes ([#37](https://github.com/gucci-on-fleek/lua-widow-control/issues/37)). + +## [v2.2.1 (2022-07-28)](https://github.com/gucci-on-fleek/lua-widow-control/releases/tag/release-45c3146d5fc5a86606a931212395a28ffb48f925) + +- Fix crashes with recent LuaMetaTeX (ConTeXt MkXL). See also [this thread](https://mailman.ntg.nl/pipermail/ntg-context/2022/106331.html). +- No longer show "left parfill skip" warnings with ConTeXt LMTX/MkXL ([#7](https://github.com/gucci-on-fleek/lua-widow-control/issues/7)). ## [v2.2.0 (2022-06-17)](https://github.com/gucci-on-fleek/lua-widow-control/releases/tag/release-9a5deba53545adc5ab25a5caa0b8ebf4104843f9) diff --git a/Master/texmf-dist/source/luatex/lua-widow-control/lwc-manual.tex b/Master/texmf-dist/source/luatex/lua-widow-control/lwc-manual.tex index c22375e34ce..2b5be55196d 100644 --- a/Master/texmf-dist/source/luatex/lua-widow-control/lwc-manual.tex +++ b/Master/texmf-dist/source/luatex/lua-widow-control/lwc-manual.tex @@ -64,7 +64,7 @@ \startdocument[ title=lua-widow-control, author=Max Chernoff, - version=2.2.1, %%version + version=2.2.2, %%version github=https://github.com/gucci-on-fleek/lua-widow-control, ctan=https://www.ctan.org/pkg/lua-widow-control, ] @@ -741,19 +741,15 @@ ultra-short~lines. interword glue. Narrow columns also stretch more easily than wide columns since you need to expand a paragraph by less to make a new line. - \item When running under \LuaMetaTeX{} (\ConTeXt{}), the log may - contain many lines like \q{\type{luatex warning > tex: left parfill skip is gone}}. These messages - are completely harmless (although admittedly quite annoying). \githubissue{7} - \item \Lwc/ only attempts to expand paragraphs on a page with a \woo/. A global system like in \titlecite[global] would solve this; however, this is both \acronym{NP}-complete\cite[plass] and impossible to solve in a single pass. Very rarely would such a system remove widows or orphans that \lwc/ cannot. - \item \Lwc/ does not move footnotes in \mkxl/ due to limitations with the \LuaMetaTeX{} engine. + \item \Lwc/ does not move footnotes in \mkxl/ due to limitations with the \LuaMetaTeX{} engine. \githubissue{38} - \item Draft mode does not colour any text in \mkxl/. Draft mode will not colour the first line of a page in \mkiv/ and \OpTeX{}. + \item Draft mode does not colour any text in \mkxl/. Draft mode will not colour the first line of a page in \mkiv/ and \OpTeX{}. \githubissue{39} \stopitemize \section{Contributions} diff --git a/Master/texmf-dist/tex/context/third/lua-widow-control/t-lua-widow-control.mkxl b/Master/texmf-dist/tex/context/third/lua-widow-control/t-lua-widow-control.mkxl index cc1932d8e1d..1293e08090e 100644 --- a/Master/texmf-dist/tex/context/third/lua-widow-control/t-lua-widow-control.mkxl +++ b/Master/texmf-dist/tex/context/third/lua-widow-control/t-lua-widow-control.mkxl @@ -1,10 +1,10 @@ %D \module %D [ file=t-lua-widow-control, -%D version=2.2.1, %%version +%D version=2.2.2, %%version %D title=lua-widow-control, %D subtitle=\ConTeXt module for lua-widow-control, %D author=Max Chernoff, -%D date=2022-07-28, %%dashdate +%D date=2022-08-23, %%dashdate %D copyright=Max Chernoff, %D license=MPL-2.0+, %D url=https://github.com/gucci-on-fleek/lua-widow-control] diff --git a/Master/texmf-dist/tex/lualatex/lua-widow-control/lua-widow-control-2022-02-22.sty b/Master/texmf-dist/tex/lualatex/lua-widow-control/lua-widow-control-2022-02-22.sty index fc410085e34..bdfa099947c 100644 --- a/Master/texmf-dist/tex/lualatex/lua-widow-control/lua-widow-control-2022-02-22.sty +++ b/Master/texmf-dist/tex/lualatex/lua-widow-control/lua-widow-control-2022-02-22.sty @@ -12,8 +12,8 @@ % report a real version number here for debugging. \PackageInfo{lua-widow-control}{% Real version: - 2022/07/28 %%slashdate - v2.2.1 %%version + 2022/08/23 %%slashdate + v2.2.2 %%version } \PackageWarning{lua-widow-control}{% diff --git a/Master/texmf-dist/tex/lualatex/lua-widow-control/lua-widow-control.sty b/Master/texmf-dist/tex/lualatex/lua-widow-control/lua-widow-control.sty index 8b768637670..f5db525ab40 100644 --- a/Master/texmf-dist/tex/lualatex/lua-widow-control/lua-widow-control.sty +++ b/Master/texmf-dist/tex/lualatex/lua-widow-control/lua-widow-control.sty @@ -13,7 +13,7 @@ \DeclareRelease{}{0000-00-00}{lua-widow-control-2022-02-22.sty} \DeclareRelease{v1.1.6}{2022-02-22}{lua-widow-control-2022-02-22.sty} -\DeclareCurrentRelease{v2.2.1}{2022-07-28} %%version %%dashdate +\DeclareCurrentRelease{v2.2.2}{2022-08-23} %%version %%dashdate % If this version of LaTeX doesn't support command hooks, then we load % the last v1.1.X version of the package. @@ -23,13 +23,10 @@ \ProvidesExplPackage {lua-widow-control} - {2022/07/28} %%slashdate - {v2.2.1} %%version + {2022/08/23} %%slashdate + {v2.2.2} %%version {Use Lua to remove widows and orphans} -% Unconditional Package Loads -\RequirePackage { l3keys2e } - % Message and String Constants \str_const:Nn \c__lwc_name_str { lua-widow-control } @@ -268,7 +265,12 @@ } % Add the user interface for the keys -\exp_args:NV \ProcessKeysPackageOptions { \c__lwc_name_str } +\IfFormatAtLeastTF { 2022-06-01 } { + \ProcessKeyOptions [ \c__lwc_name_str ] +}{ + \RequirePackage { l3keys2e } + \exp_args:NV \ProcessKeysOptions { \c__lwc_name_str } +} \cs_generate_variant:Nn \keys_set:nn { Vn } \NewDocumentCommand \lwcsetup {m} { diff --git a/Master/texmf-dist/tex/luatex/lua-widow-control/lua-widow-control.lua b/Master/texmf-dist/tex/luatex/lua-widow-control/lua-widow-control.lua index 0f23f42592a..1ef86174c4f 100644 --- a/Master/texmf-dist/tex/luatex/lua-widow-control/lua-widow-control.lua +++ b/Master/texmf-dist/tex/luatex/lua-widow-control/lua-widow-control.lua @@ -102,6 +102,7 @@ local insert_token = token.put_next or token.putnext local last = node.slide local linebreak = tex.linebreak local new_node = node.new +local remove = node.remove local set_attribute = node.set_attribute or node.setattribute local string_char = string.char local tex_box = tex.box @@ -137,6 +138,7 @@ lwc.colours = { ]] local contrib_head, emergencystretch, + hold_head, info, insert_attribute, max_cost, @@ -152,10 +154,12 @@ if lmtx then contrib_head = "contributehead" shrink_order = "shrinkorder" stretch_order = "stretchorder" + hold_head = "holdhead" else contrib_head = "contrib_head" shrink_order = "shrink_order" stretch_order = "stretch_order" + hold_head = "hold_head" end if context then @@ -194,8 +198,8 @@ elseif plain or latex or optex then debug("Plain/LaTeX") luatexbase.provides_module { name = lwc.name, - date = "2022/07/28", --%%slashdate - version = "2.2.1", --%%version + date = "2022/08/23", --%%slashdate + version = "2.2.2", --%%version description = [[ This module provides a LuaTeX-based solution to prevent @@ -309,7 +313,7 @@ end --- @param args table? --- subtype: number = The node subtype --- reverse: bool = Whether we should iterate backwards ---- @return node +--- @return node? local function next_of_type(head, id, args) args = args or {} @@ -332,6 +336,13 @@ local function next_of_type(head, id, args) head = head.prev end end + + -- Needed for the special `tex.lists` nodes + if head and head.id == id and + (head.subtype == args.subtype or args.subtype == nil) + then + return head + end end @@ -629,6 +640,14 @@ local function mark_inserts(head) then local hlist_before = next_of_type(insert, hlist_id, { reverse = true} ) + local insert_class + if lmtx then + -- FIXME: temporarily hardcode the main "footnote" class + insert_class = 4 -- insert.index + else + insert_class = insert.subtype + end + --[[ We tag the first element of the hlist/line with an integer that holds the insert class and the first and last indices of the inserts contained in the line. This won't work if @@ -638,7 +657,7 @@ local function mark_inserts(head) set_attribute( hlist_before.list, insert_attribute, - insert.subtype * INSERT_CLASS_MULTIPLE + + insert_class * INSERT_CLASS_MULTIPLE + insert_indices[1] * INSERT_FIRST_MULTIPLE + insert_indices[#insert_indices] ) @@ -837,45 +856,52 @@ local function get_inserts(last_line) break end - --[[ With LuaMetaTeX, the subtype of `insert` nodes is always zero, - so we cannot detect their class therefore we can't fix any moved - footnotes. - ]] - if lmtx then - warning("!!!Incorrect footnotes on page " .. pagenum() .. "!!!") - return {} - end - -- Demux the insert values local class = line_value // INSERT_CLASS_MULTIPLE local first_index = (line_value % INSERT_CLASS_MULTIPLE) // INSERT_FIRST_MULTIPLE local last_index = line_value % INSERT_FIRST_MULTIPLE -- Get the output box containing the insert boxes - local insert_box = tex_box[class] + local insert_box - local m = insert_box.list - while m do -- Iterate through the insert box - local box_value - box_value, m = find_attribute(m, insert_attribute) + if lmtx then + insert_box = tex.getinsertcontent(class) + else + insert_box = tex_box[class] + end - if not m then - break - end + -- Get any portions of the insert held over until the next page + local split_insert = next_of_type( + tex_lists[hold_head], + insert_id, + { subtype = class } + ) - if abs(box_value) >= first_index and - abs(box_value) <= last_index - then - -- Remove the respective contents from the insert box - insert_box.list = node.remove(insert_box.list, m) + for i, insert in ipairs { insert_box, split_insert } do + local m = insert and insert.list + + while m do -- Iterate through the insert box + local box_value + box_value, m = find_attribute(m, insert_attribute) - if box_value > 0 then - selected_inserts[#selected_inserts + 1] = copy(inserts[box_value]) + if not m then + break end - m = free(m) - else - m = m.next + if abs(box_value) >= first_index and + abs(box_value) <= last_index + then + -- Remove the respective contents from the insert box + insert.list = remove(insert.list, m) + + if box_value > 0 and i == 1 then + table.insert(selected_inserts, copy(inserts[box_value])) + end + + m = free(m) + else + m = m.next + end end end @@ -883,6 +909,10 @@ local function get_inserts(last_line) tex_box[class] = nil end + if split_insert and not split_insert.list then + remove(tex_lists[hold_head], split_insert) + end + n = n.next end diff --git a/Master/texmf-dist/tex/luatex/lua-widow-control/lua-widow-control.tex b/Master/texmf-dist/tex/luatex/lua-widow-control/lua-widow-control.tex index 45c9e288e45..9c26719eb6f 100644 --- a/Master/texmf-dist/tex/luatex/lua-widow-control/lua-widow-control.tex +++ b/Master/texmf-dist/tex/luatex/lua-widow-control/lua-widow-control.tex @@ -3,7 +3,7 @@ % SPDX-License-Identifier: MPL-2.0+ % SPDX-FileCopyrightText: 2022 Max Chernoff -\wlog{lua-widow-control v2.2.1} %%version +\wlog{lua-widow-control v2.2.2} %%version \ifx\directlua\undefined \errmessage{% diff --git a/Master/texmf-dist/tex/optex/lua-widow-control/lua-widow-control.opm b/Master/texmf-dist/tex/optex/lua-widow-control/lua-widow-control.opm index d628a401e46..6d3ce3ea54e 100644 --- a/Master/texmf-dist/tex/optex/lua-widow-control/lua-widow-control.opm +++ b/Master/texmf-dist/tex/optex/lua-widow-control/lua-widow-control.opm @@ -3,7 +3,7 @@ % SPDX-License-Identifier: MPL-2.0+ % SPDX-FileCopyrightText: 2022 Max Chernoff -\_codedecl\lwcenable{lua-widow-control <v2.2.1>} %%version +\_codedecl\lwcenable{lua-widow-control <v2.2.2>} %%version \_namespace{lwc} \_clubpenalty=1 |