summaryrefslogtreecommitdiff
path: root/macros/luatex/generic/lua-widow-control/lua-widow-control.tex
blob: fc10ff0ebb6fb977a92b8995a276286329c3d0fa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
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