Programming with Lua
While LuaTeX comes with numerous more advancements regarding, for example, font support and MetaPost graphics support, we will focus on pure Lua programming in this section to carve out benefits to program and use algorithms.
TeX, primarily a text-processing language, has limited programming capabilities and needs advanced data-handling functionalities. That makes general-purpose programming a challenge. To address this, TeX developers sought a scripting language to add modern programming capabilities. Their strategic choice was Lua, a versatile, lightweight, and highly portable scripting language designed to be embedded in other applications. This decision led to the development of LuaTeX, a new TeX engine that, combined with the LaTeX format, is called LuaLaTeX.
While LuaTeX offers various advancements, including enhanced font and MetaPost support, this recipe uses pure Lua programming to run algorithms directly within our LaTeX document.
Note
Use...