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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
|
% This is a sample LaTeX input file. (Version of 28 May 1985)
%
% A '%' character causes TeX to ignore all remaining text on the line,
% and is used for comments like this one.
!documentstyle<article> % Specifies the document style.
% The preamble begins here.
!title<A Sample Document> % Declares the document's title.
!author<Leslie Lamport> % Declares the author's name.
!date<December 12, 1984> % Deleting this command produces today's date.
!begin<document> % End of preamble and beginning of text.
!maketitle % Produces the title.
This is a sample input file. Comparing it with the output it
generates can show you how to produce a simple document of
your own.
!section<Ordinary Text> % Produces section heading. Lower-level
% sections are begun with similar
% \subsection and \subsubsection commands.
The ends of words and sentences are marked
by spaces. It doesn't matter how many
spaces you type; one is as good as 100. The
end of a line counts as a space.
One or more blank lines denote the end
of a paragraph.
Since any number of consecutive spaces are treated like a single
one, the formatting of the input file makes no difference to
!TeX, % The \TeX command generates the TeX logo.
but it makes a difference to you.
When you use
!LaTeX, % The \LaTeX command generates the LaTeX logo.
making your input file as easy to read as possible
will be a great help as you write your document and when you
change it. This sample file shows how you can add comments to
your own input file.
Because printing is different from typewriting, there are a
number of things that you have to do differently when preparing
an input file than if you were just typing the document directly.
Quotation marks like
``this''
have to be handled specially, as do quotes within quotes:
``!,`this' % \, separates the double and single quote.
is what I just
wrote, not `that'!,''.
Dashes come in three sizes: an
intra-word
dash, a medium dash for number ranges like
1--2,
and a punctuation
dash---like
this.
A sentence-ending space should be larger than the space between words
within a sentence. You sometimes have to type special commands in
conjunction with punctuation characters to get this right, as in the
following sentence.
Gnats, gnus, etc.! % `\ ' makes an inter-word space.
all begin with G!@. % \@ marks end-of-sentence punctuation.
You should check the spaces after periods when reading your output to
make sure you haven't forgotten any special cases.
Generating an ellipsis
!ldots! % `\ ' needed because TeX ignores spaces after
% command names like \ldots made from \ + letters.
%
% Note how a `%' character causes TeX to ignore the
% end of the input line, so these blank lines do not
% start a new paragraph.
with the right spacing around the periods
requires a special command.
!TeX! interprets some common characters as commands, so you must type
special commands to generate them. These characters include the
following:
!$ !& !% !# !{ and !}.
In printing, text is emphasized by using an
<!em italic!/> % The \/ command produces the tiny extra space that
% should be added between a slanted and a following
% unslanted letter.
type style.
!begin<em>
A long segment of text can also be emphasized in this way. Text within
such a segment given additional emphasis
with!/ <!em Roman>
type. Italic type loses its ability to emphasize and become simply
distracting when used excessively.
!end<em>
It is sometimes necessary to prevent !TeX! from breaking a line where
it might otherwise do so. This may be at a space, as between the
``Mr.'' and ``Jones'' in
``Mr.~Jones'', % ~ produces an unbreakable interword space.
or within a word---especially when the word is a symbol like
!mbox<!em itemnum!/>
that makes little sense when hyphenated across
lines.
Footnotes!footnote<This is an example of a footnote.>
pose no problem.
!TeX! is good at typesetting mathematical formulas like
!( x-3y = 7 !)
or
!( a_<1> !> x^<2n> / y^<2n> !> x' !).
Remember that a letter like
$x$ % $ ... $ and \( ... \) are equivalent
is a formula when it denotes a mathematical symbol, and should
be treated as one.
!section<Displayed Text>
Text is displayed by indenting it from the left margin.
Quotations are commonly displayed. There are short quotations
!begin<quote>
This is a short a quotation. It consists of a
single paragraph of text. There is no paragraph
indentation.
!end<quote>
and longer ones.
!begin<quotation>
This is a longer quotation. It consists of two paragraphs
of text. The beginning of each paragraph is indicated
by an extra indentation.
This is the second paragarph of the quotation. It is just
as dull as the first paragraph.
!end<quotation>
Another frequently-displayed structure is a list.
The following is an example of an <!em itemized> list.
!begin<itemize>
!item This is the first item of an itemized list. Each item
in the list is marked with a ``tick''. The document
style determines what kind of tick mark is used.
!item This is the second item of the list. It contains another
list nested inside it. The inner list is an <!em enumerated>
list.
!begin<enumerate>
!item This is the first item of an enumerated list that
is nested within the itemized list.
!item This is the second item of the inner list. !LaTeX!
allows you to nest lists deeper than you really should.
!end<enumerate>
This is the rest of the second item of the outer list. It
is no more interesting than any other part of the item.
!item This is the third item of the list.
!end<itemize>
You can even display poetry.
!begin<verse>
There is an environment for verse !! % The \\ command separates lines
Whose features some poets will curse. % within a stanza.
% One or more blank lines separate stanzas.
For instead of making!!
Them do <!em all!/> line breaking, !!
It allows them to put too many words on a line when they'd
rather be forced to be terse.
!end<verse>
Mathematical formulas may also be displayed. A displayed formula is
one-line long; multiline formulas require special formatting
instructions.
![ x' + y^<2> = z_<i>^<2>!]
Don't start a paragraph with a displayed equation, nor make
one a paragraph by itself.
!end<document> % End of document.
|