summaryrefslogtreecommitdiff
path: root/Master/texmf-dist
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2022-04-14 19:47:46 +0000
committerKarl Berry <karl@freefriends.org>2022-04-14 19:47:46 +0000
commitd3eb5a117030fe207ad30748d79b0bb0755529fd (patch)
tree15d229422a977fc4174099c09d953f0a2d69bec9 /Master/texmf-dist
parentb292c6736820d4091fc39720e179d0a8702e1e86 (diff)
lua-widow-control (14apr22)
git-svn-id: svn://tug.org/texlive/trunk@63026 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist')
-rw-r--r--Master/texmf-dist/doc/luatex/lua-widow-control/README.md2
-rw-r--r--Master/texmf-dist/doc/luatex/lua-widow-control/lua-widow-control.pdfbin380127 -> 385607 bytes
-rw-r--r--Master/texmf-dist/source/luatex/lua-widow-control/lwc-documentation.tex6
-rw-r--r--Master/texmf-dist/tex/context/third/lua-widow-control/t-lua-widow-control.mkiv21
-rw-r--r--Master/texmf-dist/tex/context/third/lua-widow-control/t-lua-widow-control.mkxl21
-rw-r--r--Master/texmf-dist/tex/lualatex/lua-widow-control/lua-widow-control.sty24
-rw-r--r--Master/texmf-dist/tex/luatex/lua-widow-control/lua-widow-control.lua4
-rw-r--r--Master/texmf-dist/tex/luatex/lua-widow-control/lua-widow-control.tex44
-rw-r--r--Master/texmf-dist/tex/optex/lua-widow-control/lua-widow-control.opm61
9 files changed, 129 insertions, 54 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 850f034f8e1..6d61094c463 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.0.4 (2022-04-07)_ <!--%%version %%dashdate-->
+_v2.0.5 (2022-04-13)_ <!--%%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
index 007b3136f01..09fee6bcf35 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
Binary files differ
diff --git a/Master/texmf-dist/source/luatex/lua-widow-control/lwc-documentation.tex b/Master/texmf-dist/source/luatex/lua-widow-control/lwc-documentation.tex
index 8d59b2a7357..e6b7f0a0e0b 100644
--- a/Master/texmf-dist/source/luatex/lua-widow-control/lwc-documentation.tex
+++ b/Master/texmf-dist/source/luatex/lua-widow-control/lwc-documentation.tex
@@ -37,7 +37,7 @@
\startdocument[
title=lua-widow-control,
author=Max Chernoff,
- version=2.0.4, %%version
+ version=2.0.5, %%version
github=https://github.com/gucci-on-fleek/lua-widow-control,
ctan=https://www.ctan.org/pkg/lua-widow-control,
]
@@ -310,12 +310,12 @@ Sometimes, you may want to disable \lwc/ for certain commands where stretching i
You could just disable then reenable \lwc/ every time that you use the command; however, \lwc/ provides a convenience macro that will do this automatically for you.
-\Lwc/ automatically patches the default \LaTeX{}, \ConTeXt{}, and Plain~\TeX{} section commands, so you shouldn't need to patch these yourself. \Lwc/ also patches the commands provided by \sans{memoir}, \sans{\acronym{KOMA}-script}, and \sans{titlesec}. You'll need to patch any other section commands yourself.
+\Lwc/ automatically patches the default \LaTeX{}, \ConTeXt{}, Plain~\TeX{}, and Op\TeX{} section commands, so you shouldn't need to patch these yourself. \Lwc/ also patches the commands provided by \sans{memoir}, \sans{\acronym{KOMA}-script}, and \sans{titlesec}. You'll need to patch any other section commands yourself.
Note that the \LaTeX{} option does not \emph{append} commands to the disable list; rather, it \emph{sets} the list from scratch. This means that you can set an empty list to disable any command patching; however, this also means that if you want to disable one command on top of the defaults, you'll also need to manually include the default list.
\startTABLE
- \NC Plain \TeX{}
+ \NC \plainop/
\NC \inlineTEX{\lwcdisablecmd{$\meta{\backslash macro}$}}
\NC\NR
\NC \LaTeX{}
diff --git a/Master/texmf-dist/tex/context/third/lua-widow-control/t-lua-widow-control.mkiv b/Master/texmf-dist/tex/context/third/lua-widow-control/t-lua-widow-control.mkiv
index 83f72b39054..9ea5ee5ce2e 100644
--- a/Master/texmf-dist/tex/context/third/lua-widow-control/t-lua-widow-control.mkiv
+++ b/Master/texmf-dist/tex/context/third/lua-widow-control/t-lua-widow-control.mkiv
@@ -1,10 +1,10 @@
%D \module
%D [ file=t-lua-widow-control,
-%D version=2.0.4, %%version
+%D version=2.0.5, %%version
%D title=lua-widow-control,
%D subtitle=\ConTeXt module for lua-widow-control,
%D author=Max Chernoff,
-%D date=2022-04-07, %%dashdate
+%D date=2022-04-13, %%dashdate
%D copyright=Max Chernoff,
%D license=MPL-2.0+,
%D url=https://github.com/gucci-on-fleek/lua-widow-control]
@@ -83,20 +83,21 @@
% Expansion of some parts of the document, such as section headings, is quite
% undesirable, so we'll disable \lwc/ for certain commands.
% We should only reenable \lwc/ at the end if it was already enabled.
-\newif\iflwc_should_reenable
+\newcount\lwc_disable_count
\define\lwc_patch_pre{%
\iflwc%
- \lwc_should_reenabletrue%
- \setuplwc[state=stop]%
- \else%
- \lwc_should_reenablefalse
+ \advance\lwc_disable_count by 1%
+ \setuplwc[\c!state=\v!stop]%
\fi%
}
-\define\lwc_patch_post{\iflwc_should_reenable%
- \setuplwc[state=start]%
-\fi}
+\define\lwc_patch_post{
+ \ifnum\lwc_disable_count>0%
+ \setuplwc[\c!state=\v!start]%
+ \advance\lwc_disable_count by -1%
+ \fi%
+}
\prependtoks\lwc_patch_pre\to\everybeforesectionheadhandle % Sectioning
\prependtoks\lwc_patch_post\to\everyaftersectionheadhandle
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 83f72b39054..9ea5ee5ce2e 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.0.4, %%version
+%D version=2.0.5, %%version
%D title=lua-widow-control,
%D subtitle=\ConTeXt module for lua-widow-control,
%D author=Max Chernoff,
-%D date=2022-04-07, %%dashdate
+%D date=2022-04-13, %%dashdate
%D copyright=Max Chernoff,
%D license=MPL-2.0+,
%D url=https://github.com/gucci-on-fleek/lua-widow-control]
@@ -83,20 +83,21 @@
% Expansion of some parts of the document, such as section headings, is quite
% undesirable, so we'll disable \lwc/ for certain commands.
% We should only reenable \lwc/ at the end if it was already enabled.
-\newif\iflwc_should_reenable
+\newcount\lwc_disable_count
\define\lwc_patch_pre{%
\iflwc%
- \lwc_should_reenabletrue%
- \setuplwc[state=stop]%
- \else%
- \lwc_should_reenablefalse
+ \advance\lwc_disable_count by 1%
+ \setuplwc[\c!state=\v!stop]%
\fi%
}
-\define\lwc_patch_post{\iflwc_should_reenable%
- \setuplwc[state=start]%
-\fi}
+\define\lwc_patch_post{
+ \ifnum\lwc_disable_count>0%
+ \setuplwc[\c!state=\v!start]%
+ \advance\lwc_disable_count by -1%
+ \fi%
+}
\prependtoks\lwc_patch_pre\to\everybeforesectionheadhandle % Sectioning
\prependtoks\lwc_patch_post\to\everyaftersectionheadhandle
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 0690a232086..62090c061b3 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.0.4}{2022-04-07} %%version %%dashdate
+\DeclareCurrentRelease{v2.0.5}{2022-04-13} %%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,8 +23,8 @@
\ProvidesExplPackage
{lua-widow-control}
- {2022/04/07} %%slashdate
- {v2.0.4} %%version
+ {2022/04/13} %%slashdate
+ {v2.0.5} %%version
{Use Lua to remove widows and orphans}
% Unconditional Package Loads
@@ -154,26 +154,25 @@
% Expansion of some parts of the document, such as section headings, is quite
% undesirable, so we'll disable \lwc/ for certain commands.
-\bool_new:N \g__lwc_should_reenable_bool
+\int_new:N \g__lwc_disable_int
\cs_new:Npn \__lwc_patch_pre: {
% We should only reenable \lwc/ at the end if it was already enabled.
- \__lwc_if_enabled:TF {
- \bool_gset_true:N \g__lwc_should_reenable_bool
+ \__lwc_if_enabled:T {
+ \int_gincr:N \g__lwc_disable_int
\__lwc_disable:
- } {
- \bool_gset_false:N \g__lwc_should_reenable_bool
}
}
\cs_new:Npn \__lwc_patch_post: {
- \bool_if:NT { \g__lwc_should_reenable_bool } {
+ \int_compare:nT { \g__lwc_disable_int > 0 } {
\__lwc_enable:
+ \int_gdecr:N \g__lwc_disable_int
}
}
\cs_new:Npn \__lwc_patch_cmd:c #1 {
- \IfFormatAtLeastTF {2021/06/01 } {
+ \IfFormatAtLeastTF { 2021/06/01 } {
\hook_gput_code:nnn { cmd / #1 / before } { \c__lwc_name_str } {
\__lwc_patch_pre:
}
@@ -205,12 +204,17 @@
\clist_map_function:NN \g__lwc_disablecmds_cl \__lwc_patch_cmd:n
}
+%%% Class and package-specifc patches
+
% KOMA-Script
\cs_if_exist:NT \AddtoDoHook {
\AddtoDoHook { heading / begingroup } { \__lwc_patch_pre: \use_none:n }
\AddtoDoHook { heading / endgroup } { \__lwc_patch_post: \use_none:n }
}
+% Memoir
+\cs_gset_nopar:Npn \pen@ltyabovepfbreak { 23 } % GitHub #32
+
% Define some final keys
\keys_define:nn { \c__lwc_name_str } {
enable .choice:,
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 2e374ac6e15..041b32b4659 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
@@ -107,8 +107,8 @@ elseif plain or latex or optex then
debug_print("Plain/LaTeX")
luatexbase.provides_module {
name = lwc.name,
- date = "2022/04/07", --%%slashdate
- version = "2.0.4", --%%version
+ date = "2022/04/13", --%%slashdate
+ version = "2.0.5", --%%version
description = [[
This module provides a LuaTeX-based solution to prevent
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 4ff5bd993b4..f467b0b4326 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.0.4} %%version
+\wlog{lua-widow-control v2.0.5} %%version
\ifx\directlua\undefined
\errmessage{%
@@ -12,6 +12,8 @@
}
\fi
+\catcode`@=11
+
\input ltluatex % \LuaTeX{}Base
\clubpenalty=1
@@ -43,34 +45,50 @@
% Expansion of some parts of the document, such as section headings, is quite
% undesirable, so we'll disable \lwc/ for certain commands.
-\catcode`@=11
% We should only reenable \lwc/ at the end if it was already enabled.
-\newif\iflwc@should@reenable
+\newcount\lwc@disable@count
\def\lwc@patch@pre{%
\iflwc%
- \lwc@should@reenabletrue%
+ \advance\lwc@disable@count by 1%
\lwcdisable%
- \else%
- \lwc@should@reenablefalse%
\fi%
}
-\def\lwc@patch@post{\iflwc@should@reenable%
- \lwcenable%
-\fi}
+\def\lwc@patch@post{
+ \ifnum\lwc@disable@count>0%
+ \lwcenable%
+ \advance\lwc@disable@count by -1%
+ \fi
+}
+
+\def\lwc@extractcomponents #1:#2->#3\STOP{%
+ \def\lwc@params{#2}%
+ \def\lwc@body{#3}%
+}
\def\lwcdisablecmd#1{%
- \ifdefined#1
- \expandafter\def\expandafter#1\expandafter{\lwc@patch@pre #1\lwc@patch@post}
- \fi
+ \ifdefined#1%
+ \expandafter\lwc@extractcomponents\meaning#1\STOP%
+ \begingroup%
+ \catcode`@=11%
+ \expanded{%
+ \noexpand\scantokens{%
+ \gdef\noexpand#1\lwc@params{%
+ \noexpand\lwc@patch@pre\lwc@body\noexpand\lwc@patch@post%
+ }%
+ }%
+ }%
+ \endgroup%
+ \fi%
}
-\catcode`@=12
\begingroup
\suppressoutererror=1
\lwcdisablecmd{\beginsection} % Sectioning
\endgroup
+
+\catcode`@=12
\endinput
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 6ff62815835..d96bab6c026 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,8 @@
% SPDX-License-Identifier: MPL-2.0+
% SPDX-FileCopyrightText: 2022 Max Chernoff
-\_codedecl\lwcenable{lua-widow-control <v2.0.4>} %%version
+\_codedecl\lwcenable{lua-widow-control <v2.0.5>} %%version
+\_namespace{lwc}
\_clubpenalty=1
\_widowpenalty=1
@@ -19,11 +20,61 @@
\_directlua{require "lua-widow-control"}
% Define \TeX{} wrappers for Lua functions
-\_def\lwcenable{\_directlua{lwc.enable_callbacks()}}
-\_def\lwcdisable{\_directlua{lwc.disable_callbacks()}}
-\_def\iflwc{\_directlua{lwc.if_lwc_enabled()}}
+\_def\.enable{\_directlua{lwc.enable_callbacks()}}
+\_def\.disable{\_directlua{lwc.disable_callbacks()}}
+\_def\.iflwc{\_directlua{lwc.if_lwc_enabled()}}
+
+\_let\lwcenable=\.enable
+\_let\lwcdisable=\.disable
% Enable \lwc/ by default when the package is loaded.
-\lwcenable
+\.enable
+
+% Expansion of some parts of the document, such as section headings, is quite
+% undesirable, so we'll disable \lwc/ for certain commands.
+
+% We should only reenable \lwc/ at the end if it was already enabled.
+\_newcount\.disable_count
+
+\_def\.patch_pre{%
+ \.iflwc%
+ \_advance\.disable_count by 1%
+ \.disable%
+ \_fi%
+}
+
+\_def\.patch_post{
+ \_ifnum\.disable_count>0%
+ \.enable%
+ \_advance\.disable_count by -1%
+ \_fi
+}
+
+\_def\.extractcomponents #1:#2->#3\STOP{%
+ \_def\.params{#2}%
+ \_def\.body{#3}%
+}
+
+\def\.disable_cmd#1{%
+ \_ifdefined#1%
+ \_ea\.extractcomponents\_meaning#1\STOP%
+ \_begingroup%
+ \_catcode`_=11%
+ \_expanded{%
+ \_noexpand\_scantokens{%
+ \_gdef\_noexpand#1\.params{%
+ \_noexpand\.patch_pre\.body\_noexpand\.patch_post%
+ }%
+ }%
+ }%
+ \_endgroup%
+ \_fi%
+}
+\_let\lwcdisablecmd=\.disable_cmd
+
+\.disable_cmd{\_printchap}
+\.disable_cmd{\_printsec}
+\.disable_cmd{\_printsecc}
+\_endnamespace
\_endcode