Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Source code of books made with TeX/LaTeX to learn [closed]

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.)?
like image 506
Diego Sevilla Avatar asked Mar 05 '09 10:03

Diego Sevilla


3 Answers

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

  • TeX by Topic by Victor Eijkhout
  • TeX for the Impatient by Paul Abrahams, Kathryn Hargreaves, and Karl Berry

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):

  • The TeXBook by Donald Knuth

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

  • Formatting Information by Peter Flynn

Of course there's also

  • The Not So Short Guide to LaTeX by Tobias Oetiker

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:

  • The memoir class by Peter Wilson (memman.tex is the documentation)

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.

like image 96
Will Robertson Avatar answered Nov 18 '22 01:11

Will Robertson


Believe it or not, but the source code to the TeXbook is actually freely downloadable:

TeXbook source code package

like image 6
lindelof Avatar answered Nov 18 '22 01:11

lindelof


Not that I'd recommend it (unless you've got a lot of time and caffeine to spare), but I learned a lot from just reading the latex.ltx file. I learned a lot not only about LaTeX but also of course about TeX. It's a heavy read though and I'd suggest reading a book about TeX first before diving into the latex.ltx file.

I wanted to know about how "optional" parameters actually worked and reading the latex.ltx file really helped me understand.

like image 1
dreamlax Avatar answered Nov 18 '22 01:11

dreamlax