summaryrefslogtreecommitdiff
path: root/info/impatient/examples.tex
blob: 1b244362d6175e6e646c3ad1b4eb4c3ad4cf7406 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
% This is part of the book TeX for the Impatient.
% Copyright (C) 2003 Paul W. Abrahams, Kathryn A. Hargreaves, Karl Berry.
% See file fdl.tex for copying conditions.

\input macros
\chapter{Examples}

\chapterdef{examples}

This section of the book contains a set of examples 
to help get you started and to show you how to do various things with \TeX.
Each example has \TeX\ output on the left-hand page and the \TeX \
input that led to that output on the right-hand page.
You can use these examples both as forms to imitate and
as a way of finding the
\TeX\ commands that you need in order to achieve a particular effect.
However, these examples can illustrate only a few of the
about $900$ \TeX\ commands.

Some of the examples are self-descriptive---that is, they discuss the very
features of \TeX\ that they are illustrating.  These discussions are
necessarily sketchy because there isn't room in the examples for all the
information you'd need.  The capsule summary of commands
(\chapterref{capsule})
and the index will help you
locate the complete explanation of every \TeX\ feature shown in the
examples.

Because we've designed the examples to illustrate 
many things at once, some examples contain a great variety of
typographical effects.  These examples generally are \emph{not} good
models of typographical practice.  For instance, Example~8 has some of its
equation numbers on the left and some on the right.  You'd never want to
do that in a real publication.

\xrdef{xmphead}
Each example except for the first one starts with a macro (see 
\xref{macro}) named |\xmpheader|.  We've used |\xmpheader| in order to
conserve space in the input, since without it each example would have
several lines of material you'd already seen.
|\xmpheader| produces the title of an example and the
extra space that goes with it.  You can see in the first example 
what |\xmpheader| does, so you can imitate it if you wish.
Except for |\xmpheader|, every command that we use in these examples is
defined in \plainTeX.

% The first example does the necessary eject here.
{%
   \let\bye = \relax % We don't want to obey \bye in the example input.
   % These switches can't be done by a macro since \bye is outer.
   \doexamples {xmptext}% Typeset the actual examples.
}%


\endchapter
\byebye