From d3eb5a117030fe207ad30748d79b0bb0755529fd Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Thu, 14 Apr 2022 19:47:46 +0000 Subject: lua-widow-control (14apr22) git-svn-id: svn://tug.org/texlive/trunk@63026 c570f23f-e606-0410-a88d-b1316a301751 --- .../lua-widow-control/lua-widow-control.sty | 24 +++++++++++++--------- 1 file changed, 14 insertions(+), 10 deletions(-) (limited to 'Master/texmf-dist/tex/lualatex') 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:, -- cgit v1.2.3