Search code examples
open-sourcelatextextypography

Source code of books made with TeX/LaTeX to learn


Some time ago, reading this entry I found a nice image and a pointer to a better book entitled "Thinking Forth". To my surprise, the LaTeX sources of the book were ready to download, with pearls like:

%% There's no bold typewriter in Computer Modern.
%% Emulate with printing several times, slightly moving

\newdimen\poormove
\poormove0.0666pt
\newcommand{\poorbf}[1]{%
\llap{\hbox to \poormove{#1\hss}}%
\raise\poormove\rlap{#1\hss}%
\lower\poormove\rlap{#1\hss}%
\rlap{\hbox to \poormove{\hss}\hbox{#1}}%
#1}

%\let\poorbf=\textbf
\renewcommand{\poorbf}[1]{{\fontencoding{OT1}\fontfamily{cmtt}\fontseries{b}\selectfont#1}}

in which it can simulate the bold stroking of a font that doesn't have it. Since reading that, I was unaware of \llap and such, but now I can use them to define boxes, etc.

So, my question is twofold:

  1. Do you know of sites that show that relatively advanced use of TeX/LaTeX in terms of useful recipes, and
  2. Do you know any books that offer their TeX/LaTeX source to inspect and learn (and that are worth doing so.)?

Solution

  • There are two comprehensive reference guides/recipe books for TeX:

    In both cases, the sources are also available.

    As lindelof mentions, the TeXBook is also available, albeit in a form that prevents compilation (Knuth wished people to look at the source for inspiration but not to reproduce the book freely):

    On the LaTeX side of things, resources a little more scarce from the programming point of view. The best free reference that I know of is

    Of course there's also

    but that doesn't cover so much programming "stuff". The LaTeX sources themselves contain some useful nuggets, but the quality of the documentation ranges from excellent to non-existent in parts; this should be available in your distribution with texdoc source2e.

    Other large LaTeX packages obviously have the source to their documentation available; a notable example is the memoir class:


    I'm sure there are many more books with their source available; these are just the first ones that come to mind that happen to also be able TeX and/or LaTeX.