summaryrefslogtreecommitdiff
path: root/macros/luatex/generic/lua-widow-control/lua-widow-control.lua
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2022-07-29 03:01:04 +0000
committerNorbert Preining <norbert@preining.info>2022-07-29 03:01:04 +0000
commitda2dc471ec5bb2620f0ef5a4a700b236d1a8af06 (patch)
treed928b5b5abe4df9287ffda090d15e777c78bd783 /macros/luatex/generic/lua-widow-control/lua-widow-control.lua
parent5937dac9360bdf40d1b0baf9d7384b109fb5b7a7 (diff)
CTAN sync 202207290301
Diffstat (limited to 'macros/luatex/generic/lua-widow-control/lua-widow-control.lua')
-rw-r--r--macros/luatex/generic/lua-widow-control/lua-widow-control.lua29
1 files changed, 8 insertions, 21 deletions
diff --git a/macros/luatex/generic/lua-widow-control/lua-widow-control.lua b/macros/luatex/generic/lua-widow-control/lua-widow-control.lua
index 800faf5624..0f23f42592 100644
--- a/macros/luatex/generic/lua-widow-control/lua-widow-control.lua
+++ b/macros/luatex/generic/lua-widow-control/lua-widow-control.lua
@@ -194,8 +194,8 @@ elseif plain or latex or optex then
debug("Plain/LaTeX")
luatexbase.provides_module {
name = lwc.name,
- date = "2022/06/17", --%%slashdate
- version = "2.2.0", --%%version
+ date = "2022/07/28", --%%slashdate
+ version = "2.2.1", --%%version
description = [[
This module provides a LuaTeX-based solution to prevent
@@ -344,25 +344,19 @@ local function long_paragraph(head)
-- We can't modify the original paragraph
head = copy_list(head)
+ if lmtx then
+ tex.preparelinebreak(head)
+ end
+
-- Prevent ultra-short last lines (\TeX{}Book p. 104), except with narrow columns
-- Equivalent to \\parfillskip=0pt plus 0.8\\hsize
- local parfillskip
- if lmtx or last(head).id ~= glue_id then
- -- LMTX does not automatically add the \\parfillskip glue
- parfillskip = new_node("glue", "parfillskip")
- else
- parfillskip = last(head)
- end
+ local parfillskip = last(head)
if tex.hsize > min_col_width then
parfillskip[stretch_order] = 0
parfillskip.stretch = 0.8 * tex.hsize -- Last line must be at least 20% long
end
- if lmtx or last(head).id ~= glue_id then
- last(head).next = parfillskip
- end
-
-- Break the paragraph 1 line longer than natural
return linebreak(head, {
looseness = 1,
@@ -379,15 +373,8 @@ local function natural_paragraph(head)
-- We can't modify the original paragraph
head = copy_list(head)
- --[[ Contrary to the documentation, LMTX does not automatically add
- the \\parfillskip glue before `pre_linebreak_filter`, so we need
- to add it here so that our \\prevgraf comparisons are correct.
- ]]
if lmtx then
- parfillskip = new_node("glue", "parfillskip")
- parfillskip[stretch_order] = 1
- parfillskip.stretch = 1 -- 0pt plus 1fil
- last(head).next = parfillskip
+ tex.preparelinebreak(head)
end
-- Break the paragraph naturally to get \\prevgraf