\documentclass{report}
\usepackage[vmargin={3cm,2cm},hmargin=3cm,noheadfoot]{geometry}
\usepackage{parskip}
\usepackage{graphicx} % Use pdf, png, jpg, or eps with pdflatex; use eps in DVI mode
% TeX will automatically convert eps --> pdf in pdflatex
\usepackage{amsmath}
\usepackage{tabularx}
\usepackage{xtab}
\usepackage{tikz}
\usepackage{hyperref}
%Comments are made with the percent sign.
\begin{document}
\begin{large}
UW Instructional Computing Services
\end{large}
\begin{Large} %This "Large" is an environment.
Special Topics in \LaTeX\ % This is a special command to produce the quirky LaTeX logo.
\end{Large}
Robin Hill
\hfill {\itshape \Large DRAFT: May still be under development!} %This "Large" is a command.
\hfill Last Update: 4 December 2013; RKH
The typesetting suite \LaTeX\ serves as a batch word processor,
generally for academics in the sciences who use Unix or Linux systems,
with comprehensive and precise control over notation, layout, and
structure.
{\bfseries \large Review of Research Paper Structure in LaTeX} % bfseries gives bold face font
A \LaTeX\ document, in its source code form as a text file, has (1) a
preamble, starting with \verb!\documentclass{...}!, which contains
declarations but no content, and (2) a body, which is the content,
between the commands \verb!\begin{document}! and
\verb!\end{document}!. The file may include other components toward
the end, either explicitly or through commands that produce them, such
as an index or bibliography, and also other components at the
beginning, such as a table of contents or a list of figures.
{\bfseries For a Thesis or Paper for Publication:} Use document class \texttt{article} or \texttt{book}, for section and
chapter numbering, table of contents, lists of figures, and other
facilities. Bibliographies in the form of lists of references at the
end of the paper are written by a separate program, Bib\TeX, and then
appended in the next run of \texttt{latex}. Example for this
workshop: The ``Robust'' paper example \texttt{RobustPaper.tex} has
the separate bibliography file, \texttt{robust.bib} printed at the
end. The program Bib\TeX, using a bibliography file consisting of tagged
text entries, will produce a list of references in a format of your
choice.
{\bfseries \large More Notation, Mathematical and Scientific}
The Web is rife with examples of mathematical and other notation. All of the Greek letters are available, as commands in math mode named by their English spellings, both small (e.g. \verb!$\omega$! yields $\omega$) and large (e.g., \verb!$\Omega$! yields $\Omega$). And there is so much more.
Here is the quadratic formula, inline: $x = \frac {-b \pm \sqrt {b^2 - 4ac}}{2a}$\\
The \LaTeX\ source is: \verb#$x = \frac {-b \pm \sqrt {b^2 - 4ac}}{2a}$# Remember, if we wanted to display it instead (centered on lines of its own), we would use the \texttt{displaymath} environment or its shorthand brackets, \verb@\[@ and \verb@\]@, or the \texttt{equation} environment if we want numbered equations (adding labels if we want to refer to them by number).
Here is a matrix from the Art of Problem Solving site.
\begin{quote} % The "quote" environment indents.
The characteristic polynomial $f(\lambda)$ of the
$3 \times 3$ matrix
\[ % same as \begin{displaymath}
\left(
\begin{array}{ccc}
a & b & c \\
d & e & f \\
g & h & i \end{array}
\right)
\] % same as \end{displaymath}
is given by the equation
\begin{equation}
[ f(\lambda)
= \left|
\begin{array}{ccc}
\lambda - a & -b & -c \\
-d & \lambda - e & -f \\
-g & -h & \lambda - i \end{array}
\right|
\label{charpoly3x3}
\end{equation}
\end{quote}
And here is the same matrix, using commands defined in the \texttt{amsmath} package.
\begin{quote}
The characteristic polynomial $f(\lambda)$ of the
$3 \times 3$ matrix
\begin{displaymath}
\begin{pmatrix}
a & b & c \\
d & e & f \\
g & h & i
\end{pmatrix}
\end{displaymath}
is given by the equation
\[ f(\lambda)
= \begin{vmatrix}
\lambda - a & -b & -c \\
-d & \lambda - e & -f \\
-g & -h & \lambda - i
\end{vmatrix}.
\]
\end{quote}
That equation is the same as Equation \ref{charpoly3x3} above.
{\bfseries \large Incorporating, Placing, and Cross-Referencing Figures and Images}
I want to place a picture of a church bell, roped for ringing, right here. The picture is available in the file \texttt{BellPartsBroughtonAstley.png}, an accepted format. The source file has \verb!\usepackage{graphicx}! in the preamble. All I need is an \texttt{includegraphics} command, right there below.
\includegraphics[width=0.4\linewidth]{BellPartsBroughtonAstley.png}
Useful adjustments include scaling, cropping, and so forth, with hard-coded values. But those values are hard to determine and maintain, so most of the time, we can use the \texttt{wrapfigure} environment, or we could set up a \emph{float}. Most professional work will require embedding of an image in a \texttt{figure}, a floating environment that contains the \texttt{includegraphics} and a \texttt{caption}, and can be labeled and cross-referenced. So here the graphic is enclosed in a \texttt{figure} environment. This figure will (probably) float to the top of the current page, in accordance with the placement algorithm.
\begin{figure}
\centering\includegraphics[width=0.4\linewidth]{BellPartsBroughtonAstley.png}
\caption{Bell Parts © of St. Mary's Church Broughton Astley}
\end{figure}
%\clearpage
\newpage
{\bfseries \large Tables, Small and Large}
I want to make a table that shows a method of change-ringing called Plain Hunt, where each row shows the order of peal of a single round of four bells. We will try the \texttt{tabular} environment, with four centered columns, nested in a \texttt{table} environment with a caption and a label so that we can refer to it, Table \ref{PlainHunt}.
\begin{table}
\caption{The Plain Hunt Method, One Lead}
\label{PlainHunt}
\centering
\begin{tabular}{|c|c|c|c|}
\hline
\multicolumn{4}{|c|}{Plain Hunt}\\
\hline
1 & 2 & 3 & 4\\
\hline
2 & 1 & 4 & 3\\
\hline
2 & 4 & 1 & 3\\
\hline
4 & 2 & 3 & 1\\
\hline
4 & 3 & 2 & 1\\
\hline
3 & 4 & 1 & 2\\
\hline
3 & 1 & 4 & 2\\
\hline
1 & 3 & 2 & 4\\
\hline
1 & 2 & 3 & 4\\
\hline
\end{tabular}
\end{table}
A table is a \emph{float}, meaning that it is an independently positioned encapsulation of material, placed as described above.
Now we will try the enhanced \texttt{xtab} package with the \texttt{xtabular} environment, which can cross pages. In the source code, note the \verb!\vspace*{2cm}!, which will fill some vertical space, forcing the table down to where it has to cross the page break.
\vspace*{2cm}
\tablecaption{Plain Hunt, Full Extent}
\tablefirsthead{ \multicolumn{4}{c}{\ } \\}
\tablehead{ \multicolumn{4}{l}{\small Plain Hunt, continued} \\ }
\tabletail{ \hline \multicolumn{4}{r}{\small Continued, next page} \\ }
\begin{xtabular*}{100pt}{|*{4}{p{13pt}|}}
\hline
1 & 2 & 3 & 4\\
\hline
1 & 2 & 4 & 3\\
\hline
1 & 4 & 2 & 3\\
\hline
4 & 1 & 2 & 3\\
\hline
4 & 2 & 1 & 3\\
\hline
2 & 4 & 1 & 3\\
\hline
2 & 1 & 4 & 3\\
\hline
2 & 1 & 3 & 4\\
\hline
2 & 3 & 1 & 4\\
\hline
2 & 3 & 4 & 1\\
\hline
2 & 4 & 3 & 1\\
\hline
4 & 2 & 3 & 1\\
\hline
4 & 3 & 2 & 1\\
\hline
3 & 4 & 2 & 1\\
\hline
3 & 2 & 4 & 1\\
\hline
3 & 2 & 1 & 4\\
\hline
3 & 1 & 2 & 4\\
\hline
3 & 1 & 4 & 2\\
\hline
3 & 4 & 1 & 2\\
\hline
4 & 3 & 1 & 2\\
\hline
4 & 1 & 3 & 2\\
\hline
1 & 4 & 3 & 2\\
\hline
1 & 3 & 4 & 2\\
\hline
1 & 3 & 2 & 4\\
\hline
\end{xtabular*}
{\bfseries \large Selected Diagram Examples}
Diagrams, boxes, trees, and other graphics can be created right in the \texttt{picture} environment. But it's tedious and awkward; see an simple example in ``Brief Introduction to Campanology."
Alternatively, embed image files using \verb!\includegraphics! (and the package \texttt{graphicx}). If you are compiling with the command \texttt{latex} for \texttt{dvi} output, you are limited to Encapsulated Postscript; if you are compiling with the command \texttt{pdflatex} for \texttt{pdf} output, you can use most image formats. Most \LaTeX\ authoring environments will default to \texttt{pdflatex}.
Other options include tree diagrams, through various packages.
The TikZ facility, included as a package providing the \texttt{tikzpicture} environment, contains many other options and parameters. Since this binary search tree below is not enclosed in a \texttt{figure} environment, it does not float, but is output right here. (This kind of naked graphic is treated as one big character.)
\begin{tikzpicture}
\node[circle,draw](z){$389$}
child{node[circle,draw]{102} child{node[circle,draw]{71}} child[missing] }
child{
node[circle,draw]{833} child{node[circle,draw] {567}} child{node[circle,draw]{910}}};
\end{tikzpicture}
Diagrams are usually embedded in figures, which are floats, placed as described above.
{\bfseries \large Displaying Source Code in a Document}
To display typed material exactly as written, use the \texttt{verbatim} environment or the \texttt{verb} command. See ``Brief Introduction to Campanology" for examples of each.
{\bfseries \large References}
The \LaTeX\ WikiBook is a good textbook and reference.
Art of Problem Solving\\
\url{http://www.artofproblemsolving.com/Wiki/index.php/LaTeX:Commands}
Elevator Lady, a good source of compact but illustrative examples:\\
\url{http://elevatorlady.ca/doc/refcard/expressions.html}
\end{document}