12

I got the files tex.web and pdftex.web from the texlive svn repo. I ran

weave tex.web
pdftex tex.tex

which produced a file tex.pdf with a nicely typeset, cross-referenced listing of the WEB source of TeX.

However, if I do the same process pdftex.web, the resulting file pdftex.pdf only contains the pages corresponding to the index.

Is there some other combination of commands I need to run, or do I need to edit part of pdftex.web? I tried weaving in the supplied .ch files, but it didn't seem to make a difference.

10

Simply change the line

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

to

\let\maybe=\iftrue

in pdftex.web.

  • 4
    I forgot to add that you may also want to change \input webmac to \input pdfwebmac at the top of the weaved pdftex.tex to enable hyperlinks, which makes for more pleasant reading. – Ulrik Buchholtz Mar 5 '11 at 22:01
3

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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