diff options
Diffstat (limited to 'Master/texmf-dist/tex/luatex')
-rw-r--r-- | Master/texmf-dist/tex/luatex/lua-widow-control/lua-widow-control.lua | 4 | ||||
-rw-r--r-- | Master/texmf-dist/tex/luatex/lua-widow-control/lua-widow-control.tex | 44 |
2 files changed, 33 insertions, 15 deletions
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 |