TL;DR: I want to read the source code of LuaTeX. How and where?

I want to know exactly how the Knuth-Plass algorithm for line breaking is implemented in LuaTeX. Not an explanation, I want the source. The Lua callback for the algorithm is tex.linebreak. I downloaded the "source" from https://serveur-svn.lri.fr/svn/modhel/luatex and searched for linebreak throughout all files; it only occurs in a data structure declaration. Even more annoying, I couldn't even find where is the source for the LuaTeX engine. I am of course assumming LuaTeX is open source, but after two days looking for it, go figure :)


1 Answer 1


The master luatex svn sources are currently not at a publicly accessible location, I understand that this is an essentially temporary situation due to a change of hosting arrangements however the luatex developers push regularly to the texlive svn so that is usually only days or at most weeks behind. Texlive svn is browsable at https://www.tug.org/svn/texlive/trunk/Build/source/texk/web2c/luatexdir/



starts with the comment

@ We come now to what is probably the most interesting algorithm of \TeX: the mechanism for choosing the ``best possible'' breakpoints that yield the individual lines of a paragraph. \TeX's line-breaking algorithm takes a given horizontal list and converts it to a sequence of boxes that are appended to the current vertical list. In the course of doing this, it creates a special data structure containing three kinds of records that are not used elsewhere in \TeX. Such nodes are created while a paragraph is being processed, and they are destroyed afterwards; thus, the other parts of \TeX\ do not need to know anything about how line-breaking is done.

D Knuth's text, from the original tex.web sources.

  • Actually the address you give in the question is the upstream master source but it's currently password protected and I didn't feel at liberty to announce the address or certainly not the password. Oct 20, 2017 at 19:52
  • I do know the password. I don't know why it is protected, but I hope not to have made anything inappropriate. Anyway, thank you so much, this will really help.
    – Jaeya
    Oct 20, 2017 at 20:14
  • The password is practically public—I remember encountering it when I was looking for the LuaTeX sources a while ago, and one of the “official” pages (IIRC) mentioned the password. It was so easy to find that I didn't even bother remembering the password, sure that I would find it again if needed. :-) Oct 21, 2017 at 0:35
  • 3
    There is also a non official mirror of LuaTeX @ github: github.com/speedata/LuaTeX
    – topskip
    Oct 21, 2017 at 7:30
  • 3
    There is now an official LuaTeX mirror: github.com/tex-live/luatex Jun 3, 2018 at 1:09

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .