summaryrefslogtreecommitdiff
path: root/macros/luatex/generic/lua-widow-control/lua-widow-control.tex
diff options
context:
space:
mode:
Diffstat (limited to 'macros/luatex/generic/lua-widow-control/lua-widow-control.tex')
-rw-r--r--macros/luatex/generic/lua-widow-control/lua-widow-control.tex33
1 files changed, 33 insertions, 0 deletions
diff --git a/macros/luatex/generic/lua-widow-control/lua-widow-control.tex b/macros/luatex/generic/lua-widow-control/lua-widow-control.tex
new file mode 100644
index 0000000000..fc10ff0ebb
--- /dev/null
+++ b/macros/luatex/generic/lua-widow-control/lua-widow-control.tex
@@ -0,0 +1,33 @@
+% lua-widow-control
+% https://github.com/gucci-on-fleek/lua-widow-control
+% SPDX-License-Identifier: MPL-2.0+
+% SPDX-FileCopyrightText: 2021 gucci-on-fleek
+
+\wlog{lua-widow-control v1.0.0} %%version
+
+\input ltluatex % \LuaTeX{}Base
+
+\clubpenalty=1
+\widowpenalty=1
+\displaywidowpenalty=0
+\interlinepenalty=0
+\brokenpenalty=0
+
+\newdimen\lwcemergencystretch
+\lwcemergencystretch=3em
+
+\directlua{require "lua-widow-control"}
+
+% Here, we enable font expansion/contraction. It isn't strictly necessary for
+% \lwc/'s functionality; however, it is required for the
+% lengthened paragraphs to not have terrible spacing.
+\expandglyphsinfont\the\font 20 20 5
+\adjustspacing=2
+
+\def\lwcenable{\directlua{lwc.enable_callbacks()}}
+\def\lwcdisable{\directlua{lwc.disable_callbacks()}}
+
+% Enable \lwc/ by default when the package is loaded.
+\lwcenable
+
+\endinput