%
% instructions for "compiling":
%   latex sampler (first pass, also generates .aux file for bibtex)
%   bibtex sampler (generates .bbl file with bibliography)
%   latex sampler (second pass, incorporates bibliography)
%   latex sampler (do this if you still get messages about labels
%      having changed or missing references)
% to generate/view/print postscript:
%   dvips -o sampler.ps sampler 
%   gv sampler.ps (to view)
%   lpr sampler.ps (to print, or print from "gv")
% to generate/view/print PDF:
%   dvips -Pcmz -Ppdf -j0 -G0 -o sampler.ps sampler
%   ps2pdf sampler.ps sampler.pdf
%   acroread sampler.pdf (to view/print)
%   
\documentclass{article}

% make sure of okay hyphenation
% (this may no longer be needed, but at one time it fixed a bug)
\usepackage[english]{babel}
\selectlanguage{english}

% some useful packages
\usepackage{url}	% has \url for formatting URLs
\usepackage{html}	% has stuff that helps latex2html generate HTML
\usepackage{graphicx}	% has \includegraphics
\usepackage{moreverb}	% has \verbatimtabinput and others

% allow more figures on a page
\setcounter{topnumber}{10}
\setcounter{bottomnumber}{10}
\setcounter{totalnumber}{10}
\setcounter{dbltopnumber}{10}
\def\topfraction{1.0}
\def\bottomfraction{1.0}
\def\textfraction{0.0}
\def\dbltopfraction{1.0}

% my macros -- if you have a lot of these you will use in many
%   documents, put them in a separate file foo.tex and use \input{foo}
%   to include them
% macros to reference sections, equations, consistently
% notice the "~" to disallow line breaks between Section, etc., and
%   number
\newcommand{\SectionRef}[1]{Section~\ref{#1}}
\newcommand{\EqnRef}[1]{Equation~\ref{#1}}
\newcommand{\FigRef}[1]{Figure~\ref{#1}}
\newcommand{\TableRef}[1]{Table~\ref{#1}}
% macro to start an unindented paragraph with space before
\newcommand{\SpacedPar}{\vspace*{\baselineskip}\noindent}

% title, etc.
\title{A Sampler of \LaTeX\ Features}
\author{Berna Massingill}
\date{March 30, 2004}

%-----------------------------------------------------------------------

\begin{document}

\maketitle

\tableofcontents

\section{Text and sectioning}
\label{some-section}

\subsection{A subsection}
\label{some-subsection}

\LaTeX\ formats lines into paragraphs automagically.
I'll put in more words to show how that works.
words, words, words, words, words, words, words, words, words, words, 
words, words, words, words, words, words, words, words, words, words, 
words, words, words, words, words, words, words, words, words, words, 
words, words, words, words, words, words, words, words, words, words, 

A blank line in the source starts a new paragraph, like this
one.
words, words, words, words, words, words, words, words, words, words, 
words, words, words, words, words, words, words, words, words, words, 
words, words, words, words, words, words, words, words, words, words, 
words, words, words, words, words, words, words, words, words, words, 

You \emph{emphasize text} with the \verb+\emph+ macro.
There are also macros for doing various different fonts.
Here are some of them:
\verb+\textsf+ \textsf{looks like this},
\verb+\texttt+ \texttt{looks like this},
\verb+\textbf+ \textbf{looks like this},
\verb+\textit+ \textit{looks like this},
\verb+\textsl+ \textsl{looks like this}, and
\verb+\textsc+ \textsc{looks like this}.

You can also put in text of different sizes.  Here I'll combine that
with centering.
\begin{center}
\begin{large}
Some Large Text
\end{large}
\begin{small}
Some Small Text \\ % start a new line
with an explicit line break
\end{small}
\end{center}

\subsection{Another subsection}

words, words, words, words, words, words, words, words, words, words, 
words, words, words, words, words, words, words, words, words, words, 
words, words, words, words, words, words, words, words, words, words, 
words, words, words, words, words, words, words, words, words, words, 

\section{Lists}

% the blank comment lines are to provide visual separation in the
% source but avoid starting a new "paragraph" -- of which the first
% line would be indented

Here is an itemized list.
%
\begin{itemize}
\item An item.
\item Another item.
\end{itemize}
% 
It has some text after it.

% SpacedPar is a macro I defined earlier
\SpacedPar
Here is an enumerated list.  (See the source code for why
this paragraph isn't indented.)
%
\begin{enumerate}
\item An item.
\item Another item.
\end{enumerate}
%
It has some text after it.

\SpacedPar
Here is a description list.
%
\begin{description}
\item[Something.]  An item.
\item[Another thing.]  Another item.
\end{description}
%
It has some text after it.

\section{Math}

% the mbox prevents splitting the equation across lines
Here is some math inline:  \mbox{$c = \sqrt{a^2 + b^2}$}.
And here is the same math displayed:
\[
c = \sqrt{a^2 + b^2}
\]
And here it is again with an equation number:
\begin{equation}
c = \sqrt{a^2 + b^2} \label{eqn}
\end{equation}

\section{References}
\label{refs-section}

You can label things and reference them later.
For example, in this document
% EqnRef, etc., are my macros defined earlier
I labeled \EqnRef{eqn},
\SectionRef{some-section},
\SectionRef{some-subsection},
\FigRef{diagram-fig},
and
\TableRef{table-tbl}.
You can also have footnotes.\footnote{This is a footnote.
It could go on for a while.
words, words, words, words,
words, words, words, words,
words, words, words, words,
words, words, words, words,
}

There is also support for bibliographies.
Here I'm going to shamelessly plug two of my own papers
\cite{plop-1999,plop-2000} but also cite a book \cite{gof-book}
and a Web site \cite{MPI2}.

\section{Figures and tables}

words, words, words, words, words, words, words, words, words, words, 
words, words, words, words, words, words, words, words, words, words, 
words, words, words, words, words, words, words, words, words, words, 
words, words, words, words, words, words, words, words, words, words, 
%
\begin{figure}[htbp]
\begin{center}
\includegraphics[width=0.5\textwidth]{xor.eps}
\end{center}
\caption{Here is a picture of an XOR circuit I drew for my
	CSCI~2321 class.  It's scaled here to half the text width.
	I drew this with \texttt{xfig}.}
\label{diagram-fig}
\end{figure}
%
words, words, words, words, words, words, words, words, words, words, 
words, words, words, words, words, words, words, words, words, words, 
words, words, words, words, words, words, words, words, words, words, 
words, words, words, words, words, words, words, words, words, words, 
%
\begin{figure}[htbp]
\hrule
\vspace*{0.5\baselineskip}
\begin{verbatim}
#include <iostream>
int main(void) {
    cout << "Hello, world!\n";
    return 0;
}
\end{verbatim}
\vspace*{0.5\baselineskip}
\hrule
\caption{Here's a figure that consists of code.  Making it a figure
	keeps it all on one page and gives it a number we can
	reference.  YMMV, as they say.}
\label{code-fig}
\end{figure}
%
\begin{figure}[htbp]
\hrule
\vspace*{0.5\baselineskip}
\verbatimtabinput{hello.c}
\vspace*{0.5\baselineskip}
\hrule
\caption{Here's another figure with the same code
	as \FigRef{code-fig}, but included from a file.}
\label{morecode-fig}
\end{figure}
%
words, words, words, words, words, words, words, words, words, words, 
words, words, words, words, words, words, words, words, words, words, 
words, words, words, words, words, words, words, words, words, words, 
words, words, words, words, words, words, words, words, words, words, 
%
\begin{table}[htbp]
\begin{center}
\begin{tabular}{|l|c|r|}
\hline
This & that & a line \\
\hline
Whatever & whichever & another line \\
\hline
\end{tabular}
\end{center}
\caption{This is a simple table.}
\label{table-tbl}
\end{table}
%
words, words, words, words, words, words, words, words, words, words, 
words, words, words, words, words, words, words, words, words, words, 
words, words, words, words, words, words, words, words, words, words, 
words, words, words, words, words, words, words, words, words, words, 

\section{Hyperlinks}

No, you can't have hyperlinks in a PostScript document
but the package \texttt{html} defines macros that 
\texttt{latex2html} will convert to hyperlinks.
The \texttt{url} package includes a macro to typeset
URLs in a way I think is reasonable.
For example, my home page is \url{http://www.cs.trinity.edu/~bmassing}.

% replace "plain" with "alpha" to get the author/year style ---
%   e.g., MMS99 and MMS00 for my papers
\bibliographystyle{plain}
\bibliography{mybiblio}

\end{document}
