CoCalc Public Filestmp / latexexample.texOpen in with one click!
Authors: Harald Schilly, ℏal Snyder, William A. Stein
1
% Example LaTeX document for GP111 - note % sign indicates a comment
2
\documentstyle[11pt]{article}
3
% Default margins are too wide all the way around. I reset them here
4
\setlength{\topmargin}{-.5in}
5
\setlength{\textheight}{9in}
6
\setlength{\oddsidemargin}{.125in}
7
\setlength{\textwidth}{6.25in}
8
\begin{document}
9
\title{LaTeX Typesetting By Example}
10
\author{Phil Farrell\\
11
Stanford University School of Earth Sciences}
12
\renewcommand{\today}{November 2, 1994}
13
\maketitle
14
This article demonstrates a basic set of LaTeX formatting commands.
15
Compare the typeset output side-by-side with the input document.
16
\sectiox{lksdjf}
17
\section {Plain Text}
18
Type your text in free-format; lines can be as long
19
or as short
20
as you wish.
21
You can indent or space out
22
your input
23
text in
24
any way you like to highlight the structure
25
of your manuscript and make it easier to edit.
26
LaTeX fills lines and adjusts spacing between words to produce an
27
aesthetically pleasing result.
28
29
Completely blank lines in the input file break your text into
30
paragraphs.
31
To change the font for a single character, word, or set of words,
32
enclose the word and the font changing command within braces,
33
{\em like this}.
34
A font changing command not enclosed in braces, like the change to \bf
35
bold here, keeps that change in effect until the end of the document or
36
until countermanded by another font switch, like this change back to
37
\rm roman.
38
39
\section {Displayed Text}
40
Use the ``quote'' and ``quotation'' environments for typesetting quoted
41
material or any other text that should be slightly indented and set off
42
from the normal text.
43
\begin{quotation}
44
The quote and quotation environments are similar, but use different
45
settings for paragraph indentation and spacing.
46
47
\em When in doubt, consult the manual.
48
\end{quotation}
49
50
So far, I have demonstrated titles, paragraphs, font changes, and
51
section headings.
52
Now, I am going to show lists and tables.
53
\begin{enumerate}
54
\item
55
The ``enumerate'' environment numbers the list elements, like this.
56
57
Items in a list can contain multiple paragraphs.
58
These paragraphs are appropriately spaced and indented according to their
59
position in the list.
60
\begin{itemize}
61
\item The ``itemize'' environment sets off list items with ``bullets'',
62
like this. Finally, the ``description'' environment lets you put your own
63
\begin{description}
64
\item[A] label on each item, like this ``A''.
65
\item[If the label is long,] the first line of the item text will
66
be spaced over to the right as needed.
67
\end{description}
68
\item Of course, lists can be nested, each type up to at least four levels.
69
One type of list can be nested within another type.
70
\begin{itemize}
71
\item Nested lists of the same type will change style of numbering
72
or ``bullets'' as needed.
73
\end{itemize}
74
\end{itemize}
75
\item Don't forget to close off all list environments with the
76
appropriate \verb+\end{...}+ command.
77
Indenting \verb+\begin{...}+, \verb+\item+, and \verb+\end{...}+
78
commands in the input document according to their nesting level can help
79
clarify the structure.
80
\end{enumerate}
81
82
Here is a very simple table showing data lined up in columns.
83
Notice that I include the table in a ``center'' environment to display
84
it properly.
85
The title is created simply as another paragraph in the center environment,
86
rather than as part of the table itself.
87
\begin{center}
88
Numbers of Computers on Earth Sciences Network, By Type.
89
90
\begin{tabular}{lr}
91
Macintosh&175\\
92
DOS/Windows PC&60\\
93
UNIX Workstation or server&110\\
94
\end{tabular}
95
\end{center}
96
97
Here is a more complicated table that has been boxed up, with a multi-column
98
header and paragraph entries set in one of the columns.
99
\begin{center}
100
\begin{tabular}{|l|c|p{3.5in}|}
101
\hline
102
\multicolumn{3}{|c|}{Places to Go Backpacking}\\ \hline
103
Name&Driving Time&Notes\\
104
&(hours)&\\ \hline
105
Big Basin&1.5&Very nice overnight to Berry Creek Falls from
106
either Headquarters or ocean side.\\ \hline
107
Sunol&1&Technicolor green in the spring. Watch out for the cows.\\ \hline
108
Henry Coe&1.5&Large wilderness nearby suitable for multi-day treks.\\ \hline
109
\end{tabular}
110
\end{center}
111
112
\section {Mathematical Equations}
113
Simple equations, like $x^y$ or $x_n = \sqrt{a + b}$ can be typeset right
114
in the text line by enclosing them in a pair of single dollar sign symbols.
115
Don't forget that if you want a real dollar sign in your text, like \$2000,
116
you have to use the \verb+\$+ command.
117
118
A more complicated equation should be typeset in {\em displayed math\/} mode,
119
like this:
120
\[
121
z \left( 1 \ +\ \sqrt{\omega_{i+1} + \zeta -\frac{x+1}{\Theta +1} y + 1}
122
\ \right)
123
\ \ \ =\ \ \ 1
124
\]
125
The ``equation'' environment displays your equations, and automatically
126
numbers them consecutively within your document, like this:
127
\begin{equation}
128
\left[
129
{\bf X} + {\rm a} \ \geq\
130
\underline{\hat a} \sum_i^N \lim_{x \rightarrow k} \delta C
131
\right]
132
\end{equation}
133
\sectadsflkjy{zzz}
134
135
\pagebreak
136
\noindent{\Large\bf Here is the input file that produced this document:}
137
\begin{verbatim}
138
% Example LaTeX document for GP111 - note % sign indicates a comment
139
\documentstyle[11pt]{article}
140
% Default margins are too wide all the way around. I reset them here
141
\setlength{\topmargin}{-.5in}
142
\setlength{\textheight}{9in}
143
\setlength{\oddsidemargin}{.125in}
144
\setlength{\textwidth}{6.25in}
145
\begin{document}
146
\title{LaTeX Typesetting By Example}
147
\author{Phil Farrell\\
148
Stanford University School of Earth Sciences}
149
\renewcommand{\today}{November 2, 1994}
150
\maketitle
151
This article demonstrates a basic set of LaTeX formatting commands.
152
Compare the typeset output side-by-side with the input document.
153
154
\section {Plain Text}
155
Type your text in free-format; lines can be as long
156
or as short
157
as you wish.
158
You can indent or space out
159
your input
160
text in
161
any way you like to highlight the structure
162
of your manuscript and make it easier to edit.
163
LaTeX fills lines and adjusts spacing between words to produce an
164
aesthetically pleasing result.
165
166
Completely blank lines in the input file break your text into
167
paragraphs.
168
To change the font for a single character, word, or set of words,
169
enclose the word and the font changing command within braces,
170
{\em like this}.
171
A font changing command not enclosed in braces, like the change to \bf
172
bold here, keeps that change in effect until the end of the document or
173
until countermanded by another font switch, like this change back to
174
\rm roman.
175
176
\section {Displayed Text}
177
Use the ``quote'' and ``quotation'' environments for typesetting quoted
178
material or any other text that should be slightly indented and set off
179
from the normal text.
180
\begin{quotation}
181
The quote and quotation environments are similar, but use different
182
settings for paragraph indentation and spacing.
183
184
\em When in doubt, consult the manual.
185
\end{quotation}
186
187
So far, I have demonstrated titles, paragraphs, font changes, and
188
section headings.
189
Now, I am going to show lists and tables.
190
\begin{enumerate}
191
\item
192
The ``enumerate'' environment numbers the list elements, like this.
193
194
Items in a list can contain multiple paragraphs.
195
These paragraphs are appropriately spaced and indented according to their
196
position in the list.
197
\begin{itemize}
198
\item The ``itemize'' environment sets off list items with ``bullets'',
199
like this. Finally, the ``description'' environment lets you put your own
200
\begin{description}
201
\item[A] label on each item, like this ``A''.
202
\item[If the label is long,] the first line of the item text will
203
be spaced over to the right as needed.
204
\end{description}
205
\item Of course, lists can be nested, each type up to at least four levels.
206
One type of list can be nested within another type.
207
\begin{itemize}
208
\item Nested lists of the same type will change style of numbering
209
or ``bullets'' as needed.
210
\end{itemize}
211
\end{itemize}
212
\item Don't forget to close off all list environments with the
213
appropriate \verb+\end{...}+ command.
214
Indenting \verb+\begin{...}+, \verb+\item+, and \verb+\end{...}+
215
commands in the input document according to their nesting level can help
216
clarify the structure.
217
\end{enumerate}
218
219
Here is a very simple table showing data lined up in columns.
220
Notice that I include the table in a ``center'' environment to display
221
it properly.
222
The title is created simply as another paragraph in the center environment,
223
rather than as part of the table itself.
224
\begin{center}
225
Numbers of Computers on Earth Sciences Network, By Type.
226
227
\begin{tabular}{lr}
228
Macintosh&175\\
229
DOS/Windows PC&60\\
230
UNIX Workstation or server&110\\
231
\end{tabular}
232
\end{center}
233
234
Here is a more complicated table that has been boxed up, with a multi-column
235
header and paragraph entries set in one of the columns.
236
\begin{center}
237
\begin{tabular}{|l|c|p{3.5in}|}
238
\hline
239
\multicolumn{3}{|c|}{Places to Go Backpacking}\\ \hline
240
Name&Driving Time&Notes\\
241
&(hours)&\\ \hline
242
Big Basin&1.5&Very nice overnight to Berry Creek Falls from
243
either Headquarters or ocean side.\\ \hline
244
Sunol&1&Technicolor green in the spring. Watch out for the cows.\\ \hline
245
Henry Coe&1.5&Large wilderness nearby suitable for multi-day treks.\\ \hline
246
\end{tabular}
247
248
\section {Mathematical Equations}
249
Simple equations, like $x^y$ or $x_n = \sqrt{a + b}$ can be typeset right
250
in the text line by enclosing them in a pair of single dollar sign symbols.
251
Don't forget that if you want a real dollar sign in your text, like \$2000,
252
you have to use the \verb+\$+ command.
253
254
255
A more complicated equation should be typeset in {\em displayed math\/} mode,
256
like this:
257
\[
258
z \left( 1 \ +\ \sqrt{\omega_{i+1} + \zeta -\frac{x+1}{\Theta +1} y + 1}
259
\ \right)
260
\ \ \ =\ \ \ 1
261
\]
262
The ``equation'' environment displays your equations, and automatically
263
numbers them consecutively within your document, like this:
264
\begin{equation}
265
\left[
266
{\bf X} + {\rm a} \ \geq\
267
\underline{\hat a} \sum_i^N \lim_{x \rightarrow k} \delta C
268
\right]
269
\end{equation}
270
271
\end{document}
272
\end{verbatim}
273
\end{document}
274