Skip to content

Instantly share code, notes, and snippets.

@bigbeno37
Created August 16, 2015 03:48
Show Gist options
  • Save bigbeno37/4252d205e6247813f3c6 to your computer and use it in GitHub Desktop.
Save bigbeno37/4252d205e6247813f3c6 to your computer and use it in GitHub Desktop.
% Example LaTeX document for GP111 - note % sign indicates a comment
\documentstyle[11pt]{article}
% Default margins are too wide all the way around. I reset them here
\setlength{\topmargin}{-.5in}
\setlength{\textheight}{9in}
\setlength{\oddsidemargin}{.125in}
\setlength{\textwidth}{6.25in}
\begin{document}
\title{LaTeX Typesetting By Example}
\author{Phil Farrell\\
Stanford University School of Earth Sciences}
\renewcommand{\today}{November 2, 1994}
\maketitle
This article demonstrates a basic set of LaTeX formatting commands.
Compare the typeset output side-by-side with the input document.
\section {Plain Text}
Type your text in free-format; lines can be as long
or as short
as you wish.
You can indent or space out
your input
text in
any way you like to highlight the structure
of your manuscript and make it easier to edit.
LaTeX fills lines and adjusts spacing between words to produce an
aesthetically pleasing result.
Completely blank lines in the input file break your text into
paragraphs.
To change the font for a single character, word, or set of words,
enclose the word and the font changing command within braces,
{\em like this}.
A font changing command not enclosed in braces, like the change to \bf
bold here, keeps that change in effect until the end of the document or
until countermanded by another font switch, like this change back to
\rm roman.
\section {Displayed Text}
Use the ``quote'' and ``quotation'' environments for typesetting quoted
material or any other text that should be slightly indented and set off
from the normal text.
\begin{quotation}
The quote and quotation environments are similar, but use different
settings for paragraph indentation and spacing.
\em When in doubt, consult the manual.
\end{quotation}
So far, I have demonstrated titles, paragraphs, font changes, and
section headings.
Now, I am going to show lists and tables.
\begin{enumerate}
\item
The ``enumerate'' environment numbers the list elements, like this.
Items in a list can contain multiple paragraphs.
These paragraphs are appropriately spaced and indented according to their
position in the list.
\begin{itemize}
\item The ``itemize'' environment sets off list items with ``bullets'',
like this. Finally, the ``description'' environment lets you put your own
\begin{description}
\item[A] label on each item, like this ``A''.
\item[If the label is long,] the first line of the item text will
be spaced over to the right as needed.
\end{description}
\item Of course, lists can be nested, each type up to at least four levels.
One type of list can be nested within another type.
\begin{itemize}
\item Nested lists of the same type will change style of numbering
or ``bullets'' as needed.
\end{itemize}
\end{itemize}
\item Don't forget to close off all list environments with the
appropriate \verb+\end{...}+ command.
Indenting \verb+\begin{...}+, \verb+\item+, and \verb+\end{...}+
commands in the input document according to their nesting level can help
clarify the structure.
\end{enumerate}
Here is a very simple table showing data lined up in columns.
Notice that I include the table in a ``center'' environment to display
it properly.
The title is created simply as another paragraph in the center environment,
rather than as part of the table itself.
\begin{center}
Numbers of Computers on Earth Sciences Network, By Type.
\begin{tabular}{lr}
Macintosh&175\\
DOS/Windows PC&60\\
UNIX Workstation or server&110\\
\end{tabular}
\end{center}
Here is a more complicated table that has been boxed up, with a multi-column
header and paragraph entries set in one of the columns.
\begin{center}
\begin{tabular}{|l|c|p{3.5in}|}
\hline
\multicolumn{3}{|c|}{Places to Go Backpacking}\\ \hline
Name&Driving Time&Notes\\
&(hours)&\\ \hline
Big Basin&1.5&Very nice overnight to Berry Creek Falls from
either Headquarters or ocean side.\\ \hline
Sunol&1&Technicolor green in the spring. Watch out for the cows.\\ \hline
Henry Coe&1.5&Large wilderness nearby suitable for multi-day treks.\\ \hline
\end{tabular}
\end{center}
\section {Mathematical Equations}
Simple equations, like $x^y$ or $x_n = \sqrt{a + b}$ can be typeset right
in the text line by enclosing them in a pair of single dollar sign symbols.
Don't forget that if you want a real dollar sign in your text, like \$2000,
you have to use the \verb+\$+ command.
A more complicated equation should be typeset in {\em displayed math\/} mode,
like this:
\[
z \left( 1 \ +\ \sqrt{\omega_{i+1} + \zeta -\frac{x+1}{\Theta +1} y + 1}
\ \right)
\ \ \ =\ \ \ 1
\]
The ``equation'' environment displays your equations, and automatically
numbers them consecutively within your document, like this:
\begin{equation}
\left[
{\bf X} + {\rm a} \ \geq\
\underline{\hat a} \sum_i^N \lim_{x \rightarrow k} \delta C
\right]
\end{equation}
\pagebreak
\noindent{\Large\bf Here is the input file that produced this document:}
\begin{verbatim}
% Example LaTeX document for GP111 - note % sign indicates a comment
\documentstyle[11pt]{article}
% Default margins are too wide all the way around. I reset them here
\setlength{\topmargin}{-.5in}
\setlength{\textheight}{9in}
\setlength{\oddsidemargin}{.125in}
\setlength{\textwidth}{6.25in}
\begin{document}
\title{LaTeX Typesetting By Example}
\author{Phil Farrell\\
Stanford University School of Earth Sciences}
\renewcommand{\today}{November 2, 1994}
\maketitle
This article demonstrates a basic set of LaTeX formatting commands.
Compare the typeset output side-by-side with the input document.
\section {Plain Text}
Type your text in free-format; lines can be as long
or as short
as you wish.
You can indent or space out
your input
text in
any way you like to highlight the structure
of your manuscript and make it easier to edit.
LaTeX fills lines and adjusts spacing between words to produce an
aesthetically pleasing result.
Completely blank lines in the input file break your text into
paragraphs.
To change the font for a single character, word, or set of words,
enclose the word and the font changing command within braces,
{\em like this}.
A font changing command not enclosed in braces, like the change to \bf
bold here, keeps that change in effect until the end of the document or
until countermanded by another font switch, like this change back to
\rm roman.
\section {Displayed Text}
Use the ``quote'' and ``quotation'' environments for typesetting quoted
material or any other text that should be slightly indented and set off
from the normal text.
\begin{quotation}
The quote and quotation environments are similar, but use different
settings for paragraph indentation and spacing.
\em When in doubt, consult the manual.
\end{quotation}
So far, I have demonstrated titles, paragraphs, font changes, and
section headings.
Now, I am going to show lists and tables.
\begin{enumerate}
\item
The ``enumerate'' environment numbers the list elements, like this.
Items in a list can contain multiple paragraphs.
These paragraphs are appropriately spaced and indented according to their
position in the list.
\begin{itemize}
\item The ``itemize'' environment sets off list items with ``bullets'',
like this. Finally, the ``description'' environment lets you put your own
\begin{description}
\item[A] label on each item, like this ``A''.
\item[If the label is long,] the first line of the item text will
be spaced over to the right as needed.
\end{description}
\item Of course, lists can be nested, each type up to at least four levels.
One type of list can be nested within another type.
\begin{itemize}
\item Nested lists of the same type will change style of numbering
or ``bullets'' as needed.
\end{itemize}
\end{itemize}
\item Don't forget to close off all list environments with the
appropriate \verb+\end{...}+ command.
Indenting \verb+\begin{...}+, \verb+\item+, and \verb+\end{...}+
commands in the input document according to their nesting level can help
clarify the structure.
\end{enumerate}
Here is a very simple table showing data lined up in columns.
Notice that I include the table in a ``center'' environment to display
it properly.
The title is created simply as another paragraph in the center environment,
rather than as part of the table itself.
\begin{center}
Numbers of Computers on Earth Sciences Network, By Type.
\begin{tabular}{lr}
Macintosh&175\\
DOS/Windows PC&60\\
UNIX Workstation or server&110\\
\end{tabular}
\end{center}
Here is a more complicated table that has been boxed up, with a multi-column
header and paragraph entries set in one of the columns.
\begin{center}
\begin{tabular}{|l|c|p{3.5in}|}
\hline
\multicolumn{3}{|c|}{Places to Go Backpacking}\\ \hline
Name&Driving Time&Notes\\
&(hours)&\\ \hline
Big Basin&1.5&Very nice overnight to Berry Creek Falls from
either Headquarters or ocean side.\\ \hline
Sunol&1&Technicolor green in the spring. Watch out for the cows.\\ \hline
Henry Coe&1.5&Large wilderness nearby suitable for multi-day treks.\\ \hline
\end{tabular}
\section {Mathematical Equations}
Simple equations, like $x^y$ or $x_n = \sqrt{a + b}$ can be typeset right
in the text line by enclosing them in a pair of single dollar sign symbols.
Don't forget that if you want a real dollar sign in your text, like \$2000,
you have to use the \verb+\$+ command.
A more complicated equation should be typeset in {\em displayed math\/} mode,
like this:
\[
z \left( 1 \ +\ \sqrt{\omega_{i+1} + \zeta -\frac{x+1}{\Theta +1} y + 1}
\ \right)
\ \ \ =\ \ \ 1
\]
The ``equation'' environment displays your equations, and automatically
numbers them consecutively within your document, like this:
\begin{equation}
\left[
{\bf X} + {\rm a} \ \geq\
\underline{\hat a} \sum_i^N \lim_{x \rightarrow k} \delta C
\right]
\end{equation}
\end{document}
\end{verbatim}
\end{document}
// Example LaTeX document for GP111 - note % sign indicates a comment
-- document style (11pt) article
// Default margins are too wide all the way around. I reset them here
-- set length of topmargin to -.5in
-- set length of textheight to 9in
-- set length of oddside margin to .125in
-- set length of textwidth to 6.25in
-- begin document
-- title is LaTeX Typesetting By Example
-- author is Phil Farrel \\ Stanford University School of Earth Sciences
-- renew command today to November 2, 1994
-- make title
This article demonstrates a basic set of LaTeX formatting commands.
Compare the typeset output side-by-side with the input document.
-- section Plain Text
Type your text in free-format; lines can be as long
or as short
as you wish.
You can indent or space out
your input
text in
any way you like to highlight the structure
of your manuscript and make it easier to edit.
LaTeX fills lines and adjusts spacing between words to produce an
aesthetically pleasing result.
Completely blank lines in the input file break your text into
paragraphs.
To change the font for a single character, word, or set of words,
enclose the word and the font changing command within braces,
|=em like this|.
A font changing command not enclosed in braces, like the change to |=bf
bold here, keeps that change in effect until the end of the document or
until countermanded by another font switch, like this change back to
|=rm roman.
-- section Displayed Text
Use the ``quote'' and ``quotation'' environments for typesetting quoted
material or any other text that should be slightly indented and set off
from the normal text.
-- begin quotation
The quote and quotation environments are similar, but use different
settings for paragraph indentation and spacing.
|=em When in doubt, consult the manual.
-- end quotation
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment