CTAN Comprehensive TeX Archive Network

Directory macros/luatex/generic/lua-widow-control



Lua-widow-control is a Plain //Cont/Op package that removes widows and orphans without any user intervention. Using the power of Lua, it does so without stretching any glue or shortening any pages or columns. Instead, lua-widow-control automatically lengthens a paragraph on a page or column where a widow or orphan would otherwise occur.

Please see the package manual for usage details or the TUGboat article for background information and discussion.



Lua-widow-control is included in  Live and Mik. Provided that you have an up-to-date installation, you should not need to explicitly install the package.

If you are using Cont or want to manually install the package, you may download it from one of the below links:

Latest Release Other Releases
GitHub GitHub
Cont Garden


To load the package, add the relevant line to your preamble:

Macro Package Code
Cont \usemodule[lua-widow-control]
Plain \input lua-widow-control
Op \load[lua-widow-control]


Please see CONTRIBUTING.md.


Lua-widow-control is licensed under the Mozilla Public License, version 2.0 or greater. The documentation is additionally licensed under CC-BY-SA, version 4.0 or greater.

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.2.0 (2022-06-17)

Download the contents of this package in one zip archive (824.5k).

lua-widow-control – Automatically remove widows and orphans from any document

Unmodified has very few ways of preventing widows and orphans. In documents with figures, section headings, and equations, can stretch the vertical glue between items in order to prevent widows and orphans, but many documents have no figures or headings. can also shorten the page by 1 line, but this will give each page a different length which can make a document look uneven. The typical solution is to strategically insert \looseness=1, but this requires manual editing every time that the document is edited. Lua-widow-control is essentially an automation of the \looseness method: it uses Lua callbacks to find “stretchy” paragraphs, then it lengthens them to remove widows and orphans.

Lua-widow-control is compatible with all Lua-based formats. All that is required is to load the package at the start of your document. To load:

  • Plain Lua: \input lua-widow-control
  • Lua: \usepackage{lua-widow-control}
  • Cont: \usemodule[lua-widow-control]
  • Op: \load[lua-widow-control]

Bug trackerhttps://github.com/gucci-on-fleek/lua-widow-control/issues
Version2.2.0 2022-06-17
LicensesCC BY-SA 4.0
Free license not otherwise listed
Copyright2021–2022 gucci-on-fleek
MaintainerMax Chernoff
TDS archivelua-widow-control.tds.zip
Contained inTeX Live as lua-widow-control
MiKTeX as lua-widow-control
Experimental 3
Guest Book Sitemap Contact Contact Author