1 % This is a sample LaTeX input file. (Version of 12 August 2004.)
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 class
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.
13 \newcommand{\ip}[2]{(
#1,
#2)
}
14 % Defines \ip{arg1}{arg2} to mean
17 %\newcommand{\ip}[2]{\langle #1 | #2\rangle}
18 % This is an alternative definition of
19 % \ip that is commented out.
21 \begin{document} % End of preamble and beginning of text.
23 \maketitle % Produces the title.
25 This is an example input file. Comparing it with
26 the output it generates can show you how to
27 produce a simple
document of your own.
29 \section{Ordinary Text
} % Produces section heading. Lower-level
30 % sections are begun with similar
31 % \subsection and \subsubsection commands.
33 The ends of words and sentences are marked
34 by spaces. It doesn't matter how many
35 spaces you type; one is as good as
100. The
36 end of a line counts as a space.
38 One or more blank lines denote the end
41 Since any number of consecutive spaces are treated
42 like a single one, the formatting of the input
43 file makes no difference to
44 \LaTeX,
% The \LaTeX command generates the LaTeX logo.
45 but it makes a difference to you. When you use
46 \LaTeX, making your input file as easy to read
47 as possible will be a great help as you write
48 your
document and when you change it. This sample
49 file shows how you can add comments to your own input
52 Because printing is different from typewriting,
53 there are a number of things that you have to do
54 differently when preparing an input file than if
55 you were just typing the
document directly.
58 have to be handled specially, as do quotes within
60 ``\,`this'
% \, separates the double and single quote.
62 wrote, not `that'\,''.
64 Dashes come in three sizes: an
66 dash, a medium dash for number ranges like
72 A sentence-ending space should be larger than the
73 space between words within a sentence. You
74 sometimes have to type special commands in
75 conjunction with punctuation characters to get
76 this 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.
79 You should check the spaces after periods when
80 reading your output to make sure you haven't
81 forgotten any special cases. Generating an
83 \ldots\
% `\ ' is needed after `\ldots' because TeX
84 % ignores spaces after command names like \ldots
85 % made from \ + letters.
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.
91 with the right spacing around the periods requires
94 \LaTeX\ interprets some common characters as
95 commands, so you must type special commands to
96 generate them. These characters include the
98 \$ \& \% \# \
{ and \
}.
100 In printing, text is usually emphasized with an
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.
110 It is sometimes necessary to prevent
\LaTeX\ from
111 breaking a line where it might otherwise do so.
112 This may be at a space, as between the ``Mr.''\ and
114 ``Mr.~Jones'',
% ~ produces an unbreakable interword space.
115 or within a word---especially when the word is a
117 \mbox{\emph{itemnum
}}
118 that makes little sense when hyphenated across
121 Footnotes
\footnote{This is an example of a footnote.
}
124 \LaTeX\ is good at typesetting mathematical formulas
128 \( a_
{1} > x^
{2n
} + y^
{2n
} > x' \)
130 \(
\ip{A
}{B
} =
\sum_{i
} a_
{i
} b_
{i
} \).
131 The spaces you type in a formula are
132 ignored. Remember that a letter like
133 $x$
% $ ... $ and \( ... \) are equivalent
134 is a formula when it denotes a mathematical
135 symbol, and it should be typed as one.
137 \section{Displayed Text
}
139 Text is displayed by indenting it from the left
140 margin. Quotations are commonly displayed. There
143 This is a short quotation. It consists of a
144 single paragraph of text. See how it is formatted.
148 This is a longer quotation. It consists of two
149 paragraphs of text, neither of which are
150 particularly interesting.
152 This is the second paragraph of the quotation. It
153 is just as dull as the first paragraph.
155 Another frequently-displayed structure is a list.
156 The following is an example of an
\emph{itemized
}
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
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.
168 \item This is the first item of an enumerated
169 list that is nested within the itemized list.
171 \item This is the second item of the inner list.
172 \LaTeX\ allows you to nest lists deeper than
175 This is the rest of the second item of the outer
176 list. It is no more interesting than any other
178 \item This is the third item of the list.
180 You can even display poetry.
182 There is an environment
183 for verse \\
% The \\ command separates lines
184 Whose features some poets
% within a stanza.
187 % One or more blank lines separate stanzas.
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
195 Mathematical formulas may also be displayed. A
198 one-line long; multiline
199 formulas require special formatting instructions.
200 \
[ \ip{\Gamma}{\psi'
} = x'' + y^
{2} + z_
{i
}^
{n
}\
]
201 Don't start a paragraph with a displayed equation,
202 nor make one a paragraph by itself.
204 \end{document} % End of document.