How can I make a PDF of the source of pdftex?

Simply change the line

\let\maybe=\iffalse % print only changed modules

to

\let\maybe=\iftrue

in pdftex.web.


Unlike tex.web which was from the beginning intended by Knuth for producing both a documented book of the source code listing (Computers & Typesetting Volume B, TeX: The Program) and the actual program of TeX, the file pdftex.web is simply a changed tex.web that was done with the primary goal of producing a working and usable pdfTeX program, with no intention (AFAIK) of it being readable as a standalone book (beyond whatever is needed for the program to be maintainable). So producing a typeset listing of the pdftex source is somewhat less meaningful: the result won't be as coherent as that for tex (which you can read with texdoc tex, though that misses the useful mini-indexes and “How to read a WEB” that the printed book has).

Nevertheless, if you want to typeset the source code of pdftex, just to see it once for yourself, this is what I had to do just now (as of 2017 October):

  1. Get the latest pdftex.web (say from here).

  2. Run weave as weave pdftex.web. It produces a pdftex.tex file.

  3. Change \ifffalse to \iftrue in pdftex.tex where it says:

    \let\maybe=\iffalse % print only changed modules
    
  4. Optional: Change \input webmac at the top of the file to \input pdfwebmac, to get hyperlinks for section (module) references.

  5. Run pdftex on the file: pdftex pdftex.tex. It will produce a typeset pdftex.pdf.

Note that until October 2017, two additional changes (in the first revision of this answer) were needed. This suggests that no one else uses it this way (at least among the pdfTeX developers), or they would have fixed it.

Somewhat related: Taco Hoekwater's article LuaTeX says goodbye to Pascal from EuroTeX 2009, describing some awkwardness they encountered as a team working together on a WEB document, and their conversion to C files. Some of the issues may apply to pdfTeX too (though they still use web): What worked for Knuth as a single programmer, keeping the whole program in his head, writing the entirety of it on paper, and typing it in when finished, with always the intention of making it a book and stopping development once he was done, may not make as much sense for a team of present-day programmers who are trying to develop to changing requirements and incorporate new ideas as they go along—and definitely aren't in the habit of writing programs with pencil and paper.

Tags:

Web

Tex Core