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