TeX: The Program (ISBN 0-201-13437-3 ) is the name of a book written by DonKnuth which contains the LiterateProgramming documentation output of the source code to the typesetting language TeX.
It is not only a good example of how to mix documentation and programming, but is a very good catalog of then-cutting-edge algorithms.
Here is an interesting question: What Patterns could be derived from studying the TeX system of documentation? Perhaps one day someone could produce a TexThePatterns book.
-- ToddCoram
TeX is the last hurrah of procedural/functional structured (read: non-OO) programming. Do not take as a criticism; in fact, I stand in awe at what was achieved without some of the modern code-structuring tools we have today. I don't think the modern programmer raised in an OO culture could do the same. I anticipate obtaining this book and learning from it. -- DavidBrantley
TeX being FreeSoftware, you can get the source of the program/the book on the web:
% wget http://tug.org/texlive/devsrc/Build/source/texk/web2c/tex.web % weave tex.web # You need the WEB system for this command. It is included in some TeX distributions % tex tex.tex % xdvi tex.dviSee: FunctionalVsProceduralVsObjectOrientedProgramming
Perhaps this statement should wait until there is a comparable (size, complexity) success in OO programming ;)
You don't need the smiley there. TeX has been frozen and bug-free since 1982. It is truly a SoftwareMasterpiece.
Not quite frozen: http://www-cs-faculty.stanford.edu/~knuth/news03.html
Perhaps it is time to try to go beyond: TeXmacs is a free scientific text editor, which was inspired by both TeX and GNU Emacs. See http://www.texmacs.org/ and http://www.alqua.com/tmresources/.
What are the top competitors to TeX? I imagine there are some XML-based protocols floating around.
I'm not sure there are any actual competitors, but there are a couple alternatives: Lout (http://snark.ptc.spbu.ru/~uwe/lout/lout.html), which is similar to TeX but somewhat cleaned up, and Skribe (http://www-sop.inria.fr/mimosa/fp/Skribe/) which is Scheme-based and can do some pretty neat things.
I guess XSL FO based solutions are serious competitors, or at least they will be when FO-to-PostScript processors that output with the same professional quality as TeX does will be available. And they certainly will be, as XSL FO is a "standard" of W3C, and basically whatever they do (good or bad), the IT industry will force it on people. Of course, when I put TeX and FO based solutions into the same category, then I'm speaking about TeX as a typesetting/making-up system, and I don't talk about higher level applications as LaTeX. In my point of view, the source document is in a content centric (as oposed to presentation centric) format like DocBook, which a program converts to a presentation centrict format as TeX file or XSL FO XML file, which then goes through a making-up system (as the TeX program or an FO-to-PostScript processor) to produce the final high quality paged output (which is stored as DVI or PostScript or PDF). And, I have to emphasize that unlike TeX, the XSL FO "standard" itself doesn't implement or define any concrete making-up system, but the point is that XSL FO based solutions may will take over the lead, so FO is a competitor.
See TexLanguage