summaryrefslogtreecommitdiff
path: root/info/tcdmanual/la_text.tex
blob: 2baea4f9d93e7435cda6ca32ca6cd07fc23646de (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
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
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
\sectiontitle{Producing Simple Documents using \LaTeX}
\label{la-text}
\subsectiontitle{Producing a \LaTeX\ Input File}
We describe the structure of a typical \LaTeX\ input file.

The first line of the input file should consist of a
\verb?\documentstyle? command.  The recommended such
\verb?\documentstyle? command for mathematical articles
and similar documents has the form
\begin{quote}
\begin{verbatim}
\documentstyle[tcda,12pt]{article}
\end{verbatim}
\end{quote}
(You do not have to worry about what this command means when
first learning to use \LaTeX: its effect is to ensure that the
final document is correctly positioned on A4 size paper and
that the text is of a size that is easy to read.)  There are
variants of this \verb?\documentstyle? command which are
appropriate for letters or for books.

   The \verb?documentstyle? command may be followed by certain
other optional commands, such as the \verb?\pagestyle? command.
It is not necessary to find out about these commands when first
learning to use \LaTeX.

   After the \verb?\documentstyle? command and these other
optional commands, we place the command
\begin{quote}
\begin{verbatim}
\begin{document}
\end{verbatim}
\end{quote}

  This command is then followed by the main body of the text,
in the format prescribed by the rules of \LaTeX.

Finally, we end the input file with a line containing the
command
\begin{quote}
\begin{verbatim}
\end{document}
\end{verbatim}
\end{quote}

\subsectiontitle{Producing Ordinary Text using \LaTeX}
To produce a simple document using \LaTeX\ one should create a
\LaTeX\ input file, beginning with a \verb?\documentstyle?
command and the \verb?begin{document}? command, as
described above.  The input file should end with the
\verb?\end{document}? command, and the text of the
document should be sandwiched between the
\verb?\begin{document}? and \verb?\end{document}?
commands in the manner described below.

If one merely wishes to type in ordinary text, without
complicated mathematical formulae or special effects such
as font changes, then one merely has to type it in as it
is, leaving a completely blank line between successive
paragraphs.  You do not have to worry about paragraph
indentation: \TeX\ will automatically indent all paragraphs
with the exception of the first paragraph of a new section
(unless you take special action to override the conventions
adopted by \TeX) 

   For example, suppose that we wish to create a document
containing the following paragraphs:
\begin{quotation}
\small
\noindent
If one merely wishes to type in ordinary text, without
complicated mathematical formulae or special effects such
as font changes, then one merely has to type it in as it
is, leaving a completely blank line between successive
paragraphs.

You do not have to worry about paragraph indentation:
all paragraphs will be indented with the exception of
the first paragraph of a new section.

One must take care to distinguish between the `left quote'
and the `right quote' on the computer terminal.  Also, one
should use two `single quote' characters in succession if
one requires ``double quotes''.  One should never use the
(undirected) `double quote' character on the computer
terminal, since the computer is unable to tell whether it
is a `left quote' or a `right quote'.  One also has to
take care with dashes: a single dash is used for
hyphenation, whereas three dashes in succession are required
to produce a dash of the sort used for punctuation---such as
the one used in this sentence.

\end{quotation}
To create this document using \LaTeX\ we use the following
input file:
\begin{quote}
\begin{verbatim}

\documentstyle[tcda,12pt]{article}
\begin{document}

If one merely wishes to type in ordinary text, without
complicated mathematical formulae or special effects such
as font changes, then one merely has to type it in as it
is, leaving a completely blank line between successive
paragraphs.

You do not have to worry about paragraph indentation:
all paragraphs will be indented with the exception of
the first paragraph of a new section.

One must take care to distinguish between the `left quote'
and the `right quote' on the computer terminal.  Also, one
should use two `single quote' characters in succession if
one requires ``double quotes''.  One should never use the
(undirected) `double quote' character on the computer
terminal, since the computer is unable to tell whether it
is a `left quote' or a `right quote'.  One also has to
take care with dashes: a single dash is used for
hyphenation, whereas three dashes in succession are required
to produce a dash of the sort used for punctuation---such as
the one used in this sentence.

\end{document}

\end{verbatim}
\end{quote}

   Having created the input file, one then has to run it
through the \LaTeX\ program and then print it out the
resulting output file (known as a `DVI' file).

\subsectiontitle{Blank Spaces and Carriage Returns in the Input File}
\TeX\ treats the carriage return at the end of a line
as though it were a blank space.  Similarly \TeX\ treats
tab characters as blank spaces.  Moreover, \TeX\ regards
a sequence of blank spaces as though it were a single
space, and similarly it will ignore blank spaces at the
beginning or end of a line in the input file.  Thus, for
example, if we type
\begin{quote}
\begin{verbatim}
This is
    a
        silly
  example   of   a
file with many spaces.


                   This is the beginning
of a new paragraph.
\end{verbatim}
\end{quote}
then we obtain
\begin{quotation}
\small
This is
    a
        silly
  example   of   a
file with many spaces.


                   This is the beginning
of a new paragraph.
\end{quotation}

   It follows immediately from this that one will obtain
the same results whether one types one space or two spaces
after a full stop: \TeX\ does not distinguish between the
two cases.

Any spaces which follow a control sequence will be ignored
by \TeX.

\begin{quotation}
\footnotesize
If you really need a blank space in the final document
following whatever is produced by the control sequence,
then you must precede this blank by a
{\it backslash} \verb?\?.  Thus in order to obtain the
sentence
\begin{quotation}
\TeX\ is a very powerful computer typesetting program.
\end{quotation}
we must type
\begin{quote}
\begin{verbatim}
\TeX\ is a very powerful computer typesetting program.
\end{verbatim}
\end{quote}
(Here the control sequence \verb?\TeX? is used to produce
the \TeX\ logo.)

   In general, preceding a blank space by a backslash
forces \TeX\ to include the blank space in the final
document.
\end{quotation}

   As a general rule, you should never put a blank space after
a left parenthesis or before a right parenthesis.  If you were
to put a blank space in these places, then you run the risk
that \TeX\ might start a new line immediately after the left
parenthesis or before the right parenthesis, leaving the
parenthesis marooned at the beginning or end of a line.

\subsectiontitle{Quotation Marks}
Single left and right quotation marks are produced by
\verb?`? and \verb?'? respectively. Double left and right quotation
marks are produced by \verb?``? and \verb?''? respectively. Thus
\begin{quotation}
\small
``What did you do yesterday?'' he asked.
\end{quotation}
is produced by typing
\begin{quote}
\begin{verbatim}
``What did you do yesterday?'' he asked.
\end{verbatim}
\end{quote}
You should never use the character \verb?"? to produce
quotation marks. This is because \TeX\ has no way of
knowing whether you want a left quote or a right quote if
you do this.

\begin{quotation}
\footnotesize
   You can use the control sequences \verb?\lq? and
\verb?\rq? in place of \verb?`? and \verb?'?. This
is useful if your keyboard does not have a \verb?`?
character.
\end{quotation}

\begin{quotation}
\footnotesize
Sometimes you need two quotation marks following
one another, as in
\begin{quotation}
``I regard computer typesetting as being reasonably
`straightforward'\,'' he said.
\end{quotation}
The way to do this is to use the control sequence
\verb?\,? between the quotation marks. Thus one
would type
\begin{quote}
\begin{verbatim}
``I regard computer typesetting as being reasonably
`straightforward'\,'' he said.
\end{verbatim}
\end{quote}
However this problem arises very rarely.
\end{quotation}

\subsectiontitle{Dashes}
\TeX\ allows you to produce dashes of various length. Typing
\verb?-? by itself produces a hyphen, as in `double-quote'.
Typing \verb?--? produces a dash suitable for denoting a
range of numbers, as in the phrase `on pages 155--159',
produced by typing
\begin{quote}
\begin{verbatim}
on pages 155--159.
\end{verbatim}
\end{quote}
Finally, typing \verb?---? produces a punctuation dash---this
is a dash such as the one in this sentence.

\subsectiontitle{Section Headings in \LaTeX}
Section headings of various sizes are produced (in the
{\it article\/} document style) using the commands
\verb?\section?,\verb?\subsection? and \verb?\subsubsection?
commands. \LaTeX\ will number the sections and subsections
automatically.  The title of the section should be surrounded
by curly brackets and placed immediately after the relevant
command.  Thus if we type
\begin{quote}
\begin{verbatim}
\section{Section Headings}
We explain in this section how to obtain headings
for the various sections and subsections of our
document.

\subsection{Headings in the `article' Document Style}
In the `article' style, the document may be divided up
into sections, subsections and subsubsections, and each
can be given a title, printed in a boldface font,
simply by issuing the appropriate command.
\end{verbatim}
\end{quote}
then the title of the section and that of the subsection
will be printed in a large boldface font, and will be
numbered accordingly.

Other document styles (such as the {\it book\/} and
{\it letter\/} styles) have other `sectioning'
commands available (for example, the {\it book\/}
style has a \verb?\chapter? command for beginning
a new chapter).

\begin{quotation}
\footnotesize
Sometimes one wishes to suppress the automatic numbering
provided by \LaTeX.  This can be done by placing an
asterisk before the title of the section or subsection.
Thus, for example, the section numbers in the above example
could be suppressed by typing
\begin{quote}
\begin{verbatim}
\section*{Section Headings}
We explain in this section how to obtain headings
for the various sections and subsections of our
document.

\subsection*{Headings in the `article' Document Style}
In the `article' style, the document may be divided up
into sections, subsections and subsubsections, and each
can be given a title, printed in a boldface font,
simply by issuing the appropriate command.
\end{verbatim}
\end{quote}
\end{quotation}

\subsectiontitle{Changing Fonts}
Fonts are changed using the control sequences \verb?\rm?,
\verb?\sl?, \verb?\it?, \verb?\tt? and \verb?\bf?.
\begin{quote}
\begin{tabular}{ll}
\verb?\rm? changes to the normal ``roman'' font: & \rm Roman\\
\verb?\sl? changes to a slanted roman font:      & \sl Slanted\\
\verb?\it? changes to an italic font:            & \it Italic\\
\verb?\tt? changes to an ``typewriter'' font:    & \tt Typewriter\\
\verb?\bf? changes to a boldface font:           & \bf Boldface
\end{tabular}
\end{quote}

   It is best to use the special characters \verb?{? and
\verb?}? when changing fonts. One encloses the text whose
font is to be changed within these curly brackets and places
the font-changing control sequence immediately after the
opening bracket~\verb?{?. Thus the text
\begin{quotation}
\small
In this sentence we have {\it italicized\/} a few words, set
others in {\sl slanting type\/} or {\bf boldface type}, and
typeset others using a {\tt `typewriter' font in which all
the letters have a fixed width}.
\end{quotation}
is produced by typing
\begin{quote}
\begin{verbatim}
In this sentence we have {\it italicized\/} a few words, set
others in {\sl slanting type\/} or {\bf boldface type}, and
typeset others using a {\tt `typewriter' font in which all
the letters have a fixed width}.
\end{verbatim}
\end{quote}

\begin{quotation}
\footnotesize
The control sequence \verb?\/? produces the so-called
{\it italic correction}. The use of this is recommended when
changing back from an {\it italic\/} or {\sl slanted\/}
font into a {\rm roman} or {\bf boldface} font, in order to
produce extra space to compensate for the way in which some
{\it italic\/} and {\sl slanted\/} letters lean into the
following blank space. However this italic correction should
not be used before a comma or a full stop.
\end{quotation}

   \LaTeX\ provides the control sequence \verb?\em? for
{\em emphasizing\/} text. This will set the emphasized
text in italic, unless the surrounding text is already
in italic, in which case the text will be set in
ordinary roman font. Thus
\begin{quote}
\begin{verbatim}
Here is some {\em emphasized text with {\em emphasized}
words embedded in the {\em emphasized} text} too.
\end{verbatim}
\end{quote}
produces
\begin{quotation}
\small
Here is some {\em emphasized text with {\em emphasized}
words embedded in the {\em emphasized} text} too.
\end{quotation}

\subsectiontitle{Accents and other Symbols used in Text}
There are a variety of control sequences for producing accents.
For example, the control sequence \verb?\'{o}? produces an
acute accent on the letter~\verb?o?. Thus typing
\begin{quote}
\begin{verbatim}
Se\'{a}n \'{O} Cinn\'{e}ide.
\end{verbatim}
\end{quote}
produces
\begin{quotation}
\small
Se\'{a}n \'{O} Cinn\'{e}ide.
\end{quotation}
Similarly we use the control sequence \verb?\`? to
produce the grave accent in `alg\`{e}bre' and we use
\verb?\"? to produce the umlaut in `Universit\"{a}t'.
A list of the accents provided by \TeX\ is given in
Appendix~\ref{la-txtcs}.

   The control sequences \verb?\i? and \verb?\j? produce
dotless $i$ and $j$. These are required when placing an
accent on the letter. Thus \={\i} is produced by typing
\verb?\={\i}?. There are also control sequences for
ligatures and other special symbols used within text. These are
listed in Appendix~\ref{la-txtcs}.

\subsectiontitle{Special Characters}
The characters
\begin{quote}
\begin{verbatim}
# $ % & \ ^ _ { } ~
\end{verbatim}
\end{quote}
have special purposes within \TeX.  Thus they cannot be produced
in the  final document simply by typing them directly.  On the
rare occasions when one needs to use the special characters
\begin{quote}
\#\ \$\ \%\ \&\ \_\ \{\ \}
\end{quote}
in the final document, they can be produced by typing the control
sequences
\begin{quote}
\begin{verbatim}
\# \$ \% \& \_ \{ \}
\end{verbatim}
\end{quote}
respectively.  However,  somewhat more ingenuity is required to
produce \verb?\?, \verb?^? and \verb?~?.