texlive[64191] Master/texmf-dist: lua-widow-control (24aug22)

commits+karl at tug.org commits+karl at tug.org
Wed Aug 24 21:40:31 CEST 2022


Revision: 64191
          http://tug.org/svn/texlive?view=revision&revision=64191
Author:   karl
Date:     2022-08-24 21:40:31 +0200 (Wed, 24 Aug 2022)
Log Message:
-----------
lua-widow-control (24aug22)

Modified Paths:
--------------
    trunk/Master/texmf-dist/doc/luatex/lua-widow-control/README.md
    trunk/Master/texmf-dist/doc/luatex/lua-widow-control/lua-widow-control.pdf
    trunk/Master/texmf-dist/doc/luatex/lua-widow-control/tb133chernoff-widows.pdf
    trunk/Master/texmf-dist/source/luatex/lua-widow-control/CHANGELOG.md
    trunk/Master/texmf-dist/source/luatex/lua-widow-control/lwc-manual.tex
    trunk/Master/texmf-dist/tex/context/third/lua-widow-control/t-lua-widow-control.mkxl
    trunk/Master/texmf-dist/tex/lualatex/lua-widow-control/lua-widow-control-2022-02-22.sty
    trunk/Master/texmf-dist/tex/lualatex/lua-widow-control/lua-widow-control.sty
    trunk/Master/texmf-dist/tex/luatex/lua-widow-control/lua-widow-control.lua
    trunk/Master/texmf-dist/tex/luatex/lua-widow-control/lua-widow-control.tex
    trunk/Master/texmf-dist/tex/optex/lua-widow-control/lua-widow-control.opm

Modified: trunk/Master/texmf-dist/doc/luatex/lua-widow-control/README.md
===================================================================
--- trunk/Master/texmf-dist/doc/luatex/lua-widow-control/README.md	2022-08-24 19:40:12 UTC (rev 64190)
+++ trunk/Master/texmf-dist/doc/luatex/lua-widow-control/README.md	2022-08-24 19:40:31 UTC (rev 64191)
@@ -48,4 +48,4 @@
 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-->

Modified: trunk/Master/texmf-dist/doc/luatex/lua-widow-control/lua-widow-control.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/luatex/lua-widow-control/tb133chernoff-widows.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/source/luatex/lua-widow-control/CHANGELOG.md
===================================================================
--- trunk/Master/texmf-dist/source/luatex/lua-widow-control/CHANGELOG.md	2022-08-24 19:40:12 UTC (rev 64190)
+++ trunk/Master/texmf-dist/source/luatex/lua-widow-control/CHANGELOG.md	2022-08-24 19:40:31 UTC (rev 64191)
@@ -9,11 +9,21 @@
 
 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)
 
 - Fix paragraphs not being properly saved for potential expansion. **May affect page breaks.**

Modified: trunk/Master/texmf-dist/source/luatex/lua-widow-control/lwc-manual.tex
===================================================================
--- trunk/Master/texmf-dist/source/luatex/lua-widow-control/lwc-manual.tex	2022-08-24 19:40:12 UTC (rev 64190)
+++ trunk/Master/texmf-dist/source/luatex/lua-widow-control/lwc-manual.tex	2022-08-24 19:40:31 UTC (rev 64191)
@@ -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,10 +741,6 @@
     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
@@ -751,9 +747,9 @@
     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}

Modified: trunk/Master/texmf-dist/tex/context/third/lua-widow-control/t-lua-widow-control.mkxl
===================================================================
--- trunk/Master/texmf-dist/tex/context/third/lua-widow-control/t-lua-widow-control.mkxl	2022-08-24 19:40:12 UTC (rev 64190)
+++ trunk/Master/texmf-dist/tex/context/third/lua-widow-control/t-lua-widow-control.mkxl	2022-08-24 19:40:31 UTC (rev 64191)
@@ -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]

Modified: trunk/Master/texmf-dist/tex/lualatex/lua-widow-control/lua-widow-control-2022-02-22.sty
===================================================================
--- trunk/Master/texmf-dist/tex/lualatex/lua-widow-control/lua-widow-control-2022-02-22.sty	2022-08-24 19:40:12 UTC (rev 64190)
+++ trunk/Master/texmf-dist/tex/lualatex/lua-widow-control/lua-widow-control-2022-02-22.sty	2022-08-24 19:40:31 UTC (rev 64191)
@@ -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}{%

Modified: trunk/Master/texmf-dist/tex/lualatex/lua-widow-control/lua-widow-control.sty
===================================================================
--- trunk/Master/texmf-dist/tex/lualatex/lua-widow-control/lua-widow-control.sty	2022-08-24 19:40:12 UTC (rev 64190)
+++ trunk/Master/texmf-dist/tex/lualatex/lua-widow-control/lua-widow-control.sty	2022-08-24 19:40:31 UTC (rev 64191)
@@ -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} {

Modified: trunk/Master/texmf-dist/tex/luatex/lua-widow-control/lua-widow-control.lua
===================================================================
--- trunk/Master/texmf-dist/tex/luatex/lua-widow-control/lua-widow-control.lua	2022-08-24 19:40:12 UTC (rev 64190)
+++ trunk/Master/texmf-dist/tex/luatex/lua-widow-control/lua-widow-control.lua	2022-08-24 19:40:31 UTC (rev 64191)
@@ -102,6 +102,7 @@
 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 @@
   ]]
 local contrib_head,
       emergencystretch,
+      hold_head,
       info,
       insert_attribute,
       max_cost,
@@ -152,10 +154,12 @@
     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 @@
         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 @@
 --- @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 @@
             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 @@
         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 @@
             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,15 +856,6 @@
             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
@@ -852,30 +862,46 @@
         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
 
-                if box_value > 0 then
-                    selected_inserts[#selected_inserts + 1] = copy(inserts[box_value])
+            while m do -- Iterate through the insert box
+                local box_value
+                box_value, m = find_attribute(m, insert_attribute)
+
+                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 @@
             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
 

Modified: trunk/Master/texmf-dist/tex/luatex/lua-widow-control/lua-widow-control.tex
===================================================================
--- trunk/Master/texmf-dist/tex/luatex/lua-widow-control/lua-widow-control.tex	2022-08-24 19:40:12 UTC (rev 64190)
+++ trunk/Master/texmf-dist/tex/luatex/lua-widow-control/lua-widow-control.tex	2022-08-24 19:40:31 UTC (rev 64191)
@@ -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{%

Modified: trunk/Master/texmf-dist/tex/optex/lua-widow-control/lua-widow-control.opm
===================================================================
--- trunk/Master/texmf-dist/tex/optex/lua-widow-control/lua-widow-control.opm	2022-08-24 19:40:12 UTC (rev 64190)
+++ trunk/Master/texmf-dist/tex/optex/lua-widow-control/lua-widow-control.opm	2022-08-24 19:40:31 UTC (rev 64191)
@@ -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



More information about the tex-live-commits mailing list.