I recently read a blog post on literate programming and that tex was written using this paradigm. So I thought it might be a good idea to read the original tex program's source, by Knuth himself (the pascal version) in the literal programming style. However, having downloaded the distribution, I only find the raw file tex.web in the directory, and the tooling available via package managers (ctangle, cweb) only works with C files.

So I was wondering whether a PDF file with the literate programming output was available on line, yet an hour of searching online did not yield a result. So: Is there the literate programming output for humans available for the tex processor?

  • 2
    The “weaved” version of tex.web is available on TeX Live with texdoc tex – egreg Jul 10 '16 at 21:08
  • 4
    @GustavoMezzetti the printed book provides additional value through mini-indexes crossreferencing functions/variables etc. That version is only available in book form but the raw formatted version from the .web source is generally availables and can be printed. This is different from the TeX book which is also available as source .tex file but you are legally not allowed to generate a printed version from it! – Frank Mittelbach Jul 11 '16 at 7:48
  • @FrankMittelbach: Thans for your enlightenment. It looks like I was sitting on a treasure without even knowing it! Now that I’m no longer afraid of being (pur)sued by Addison-Wesley’s lawyers, I can reveal that I had followed the .web >>Weave> .tex >>pdfTeX> .pdf path, but I thought that disclosing this trick on a web site would constitute copyright infringement, thus clearly violating TeX.SX policy; I was not aware of the fact that the PDF is directly available through texdoc! I’ll immediately remove my misleading comment, as well as this one in 48 hours. – GuM Jul 11 '16 at 18:09
  • A compiled source: tex.pdf – Werner Jul 12 '16 at 19:42
up vote 11 down vote accepted

If you have tex.web, you can do

weave tex.web

and then

tex tex.tex

(or pdftex). This is the first page:

enter image description here

The PDF is anyway already available on TeX Live by texdoc tex.

The (commented) source code is sold as a book: Volume B: TeX: The program. A documented listing of the source code of the TeX interpreter of Computers and Typesetting.

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.