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

5

17

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.)?
Clerkly answered 5/3, 2009 at 10:10 Comment(1)
Stack overflow should support LaTeX as one of the syntax highlighting classes.Jackal
K
20

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.

Korte answered 5/3, 2009 at 10:36 Comment(0)
E
6

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

TeXbook source code package

Enloe answered 5/3, 2009 at 10:16 Comment(1)
Thanks, lindelof, nice link! I was aware of it, but it is somewhat tough to read, and I was thinking more in the lines of LaTeX instead of TeX.Clerkly
C
1

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.

Corporation answered 5/3, 2009 at 10:48 Comment(0)
E
1

Another book that would definitely fit part 2 of your question is LaTeX for Complete Novices by TeX.SX member Nicola Talbot.

This later question, posted on TeX.SX, is also relevant for part 2 and worth reading.

Eugenol answered 11/4, 2015 at 11:6 Comment(0)
L
0

I found this book by Allen B. Downey that looks really nice: Computational Modeling and Complexity Science.

Lutes answered 18/4, 2010 at 15:48 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.