source: liacs/ai/docs/sample2e.tex@ 332

Last change on this file since 332 was 2, checked in by Rick van der Zwet, 15 years ago

Initial import of data of old repository ('data') worth keeping (e.g. tracking
means of URL access statistics)

File size: 7.1 KB
Line 
1% This is a sample LaTeX input file. (Version of 11 April 1994.)
2%
3% A '%' character causes TeX to ignore all remaining text on the line,
4% and is used for comments like this one.
5
6\documentclass{article} % Specifies the document class
7
8 % The preamble begins here.
9\title{An Example Document} % Declares the document's title.
10\author{Leslie Lamport} % Declares the author's name.
11\date{January 21, 1994} % Deleting this command produces today's date.
12
13\newcommand{\ip}[2]{(#1, #2)}
14 % Defines \ip{arg1}{arg2} to mean
15 % (arg1, arg2).
16
17%\newcommand{\ip}[2]{\langle #1 | #2\rangle}
18 % This is an alternative definition of
19 % \ip that is commented out.
20
21\begin{document} % End of preamble and beginning of text.
22
23\maketitle % Produces the title.
24
25This is an example input file. Comparing it with
26the output it generates can show you how to
27produce a simple document of your own.
28
29\section{Ordinary Text} % Produces section heading. Lower-level
30 % sections are begun with similar
31 % \subsection and \subsubsection commands.
32
33The ends of words and sentences are marked
34 by spaces. It doesn't matter how many
35spaces you type; one is as good as 100. The
36end of a line counts as a space.
37
38One or more blank lines denote the end
39of a paragraph.
40
41Since any number of consecutive spaces are treated
42like a single one, the formatting of the input
43file makes no difference to
44 \LaTeX, % The \LaTeX command generates the LaTeX logo.
45but it makes a difference to you. When you use
46\LaTeX, making your input file as easy to read
47as possible will be a great help as you write
48your document and when you change it. This sample
49file shows how you can add comments to your own input
50file.
51
52Because printing is different from typewriting,
53there are a number of things that you have to do
54differently when preparing an input file than if
55you were just typing the document directly.
56Quotation marks like
57 ``this''
58have to be handled specially, as do quotes within
59quotes:
60 ``\,`this' % \, separates the double and single quote.
61 is what I just
62 wrote, not `that'\,''.
63
64Dashes come in three sizes: an
65 intra-word
66dash, a medium dash for number ranges like
67 1--2,
68and a punctuation
69 dash---like
70this.
71
72A sentence-ending space should be larger than the
73space between words within a sentence. You
74sometimes have to type special commands in
75conjunction with punctuation characters to get
76this right, as in the following sentence.
77 Gnats, gnus, etc.\ all % `\ ' makes an inter-word space.
78 begin with G\@. % \@ marks end-of-sentence punctuation.
79You should check the spaces after periods when
80reading your output to make sure you haven't
81forgotten any special cases. Generating an
82ellipsis
83 \ldots\ % `\ ' is needed after `\ldots' because TeX
84 % ignores spaces after command names like \ldots
85 % made from \ + letters.
86 %
87 % Note how a `%' character causes TeX to ignore
88 % the end of the input line, so these blank lines
89 % do not start a new paragraph.
90 %
91with the right spacing around the periods requires
92a special command.
93
94\LaTeX\ interprets some common characters as
95commands, so you must type special commands to
96generate them. These characters include the
97following:
98 \$ \& \% \# \{ and \}.
99
100In printing, text is usually emphasized with an
101 \emph{italic}
102type style.
103
104\begin{em}
105 A long segment of text can also be emphasized
106 in this way. Text within such a segment can be
107 given \emph{additional} emphasis.
108\end{em}
109
110It is sometimes necessary to prevent \LaTeX\ from
111breaking a line where it might otherwise do so.
112This may be at a space, as between the ``Mr.'' and
113``Jones'' in
114 ``Mr.~Jones'', % ~ produces an unbreakable interword space.
115or within a word---especially when the word is a
116symbol like
117 \mbox{\emph{itemnum}}
118that makes little sense when hyphenated across
119lines.
120
121Footnotes\footnote{This is an example of a footnote.}
122pose no problem.
123
124\LaTeX\ is good at typesetting mathematical formulas
125like
126 \( x-3y + z = 7 \)
127or
128 \( a_{1} > x^{2n} + y^{2n} > x' \)
129or
130 \( \ip{A}{B} = \sum_{i} a_{i} b_{i} \).
131The spaces you type in a formula are
132ignored. Remember that a letter like
133 $x$ % $ ... $ and \( ... \) are equivalent
134is a formula when it denotes a mathematical
135symbol, and it should be typed as one.
136
137\section{Displayed Text}
138
139Text is displayed by indenting it from the left
140margin. Quotations are commonly displayed. There
141are short quotations
142\begin{quote}
143 This is a short a quotation. It consists of a
144 single paragraph of text. See how it is formatted.
145\end{quote}
146and longer ones.
147\begin{quotation}
148 This is a longer quotation. It consists of two
149 paragraphs of text, neither of which are
150 particularly interesting.
151
152 This is the second paragraph of the quotation. It
153 is just as dull as the first paragraph.
154\end{quotation}
155Another frequently-displayed structure is a list.
156The following is an example of an \emph{itemized}
157list.
158\begin{itemize}
159 \item This is the first item of an itemized list.
160 Each item in the list is marked with a ``tick''.
161 You don't have to worry about what kind of tick
162 mark is used.
163
164 \item This is the second item of the list. It
165 contains another list nested inside it. The inner
166 list is an \emph{enumerated} list.
167 \begin{enumerate}
168 \item This is the first item of an enumerated
169 list that is nested within the itemized list.
170
171 \item This is the second item of the inner list.
172 \LaTeX\ allows you to nest lists deeper than
173 you really should.
174 \end{enumerate}
175 This is the rest of the second item of the outer
176 list. It is no more interesting than any other
177 part of the item.
178 \item This is the third item of the list.
179\end{itemize}
180You can even display poetry.
181\begin{verse}
182 There is an environment
183 for verse \\ % The \\ command separates lines
184 Whose features some poets % within a stanza.
185 will curse.
186
187 % One or more blank lines separate stanzas.
188
189 For instead of making\\
190 Them do \emph{all} line breaking, \\
191 It allows them to put too many words on a line when they'd rather be
192 forced to be terse.
193\end{verse}
194
195Mathematical formulas may also be displayed. A
196displayed formula
197is
198one-line long; multiline
199formulas require special formatting instructions.
200 \[ \ip{\Gamma}{\psi'} = x'' + y^{2} + z_{i}^{n}\]
201Don't start a paragraph with a displayed equation,
202nor make one a paragraph by itself.
203
204\end{document} % End of document.
Note: See TracBrowser for help on using the repository browser.