\documentclass[twocolumn, 11pt]{article}
\sloppy
% I like this font family better than the default
\usepackage{mathpazo}
% makes clickable, colored links
\usepackage[colorlinks = true,
linkcolor = blue,
urlcolor = blue,
citecolor = teal]{hyperref}
% fancy header, makes it easy to customize headers
\usepackage{fancyhdr}
\lhead{\LaTeX{} Intro}
\rhead{Homberger}
\cfoot{\thepage}
\pagestyle{fancy}
% adds in extra math symbols and environments
\usepackage{amsmath, amssymb}
% allows 'theorem-like' environments
\usepackage{amsthm}
\newtheorem{defn}{Definition}
\newtheorem{thm}{Theorem}
% lets you draw in tex
\usepackage{tikz}
\usetikzlibrary{decorations, trees}
\usepackage{pgfplots}
\newcommand{\tbs}{\textbackslash}
\begin{document}
\title{A Brief Introduction to \LaTeX{}}
\author{
Cheyne Homberger\footnote{Supported by GMA and I-Cubed}\\
University of Florida
}
\date{\today}
\maketitle
\begin{abstract}
In this paper, we try to give a brief overview of the capabilities of
\LaTeX{}.
\end{abstract}
\tableofcontents
% \listoffigures
\section{Introduction}
\LaTeX{} is a computer program for typesetting documents, created by D. E. Knuth.
\section{Creating Graphics}
\subsection{Plotting Functions}
There are many packages available for \emph{creating} graphics, including TikZ, xypic, and pstricks.
You should probably just pick one and stick with it. Tikz is the most capable,
and has extensive examples online to help you learn.
\begin{figure}[ht] \label{tikzexample}
\centering
\begin{tikzpicture}
\draw[->] (0,0) -- (0,5);
\draw[->] (0,0) -- (5,0);
\draw (1,0) -- (1,.25);
\draw (2,0) -- (2,.25);
\draw (3,0) -- (3,.25);
\draw (4,0) -- (4,.25);
\draw (0,1) -- (.25, 1);
\draw (0,2) -- (.25, 2);
\draw (0,3) -- (.25, 3);
\draw (0,4) -- (.25, 4);
\draw[color = blue, very thick] (0,0) -- (1,3) -- (2,1) -- (3,1) -- (4,4);
\end{tikzpicture}
\caption{A Simple Tikz Drawing}
\end{figure}
Tikz is also a scripting language, allowing you to use loops to simplify repetitive tasks.
If you include the package \texttt{pgfplots}, Tikz allows you to graph functions, as we saw in figure \ref{functiongraph} on page \pageref{functiongraph}.
\begin{figure}[ht] \label{functiongraph}
\centering
\begin{tikzpicture}[scale = .8]
\begin{axis}[ xlabel=$x$, ylabel={$f(x) = x^2 -x + 4$} ]
\addplot{x^2 - x + 4};
\end{axis}
\end{tikzpicture}
\caption{A graph with PGFplots}
\end{figure}
PGFplots allows 3d surfaces as well.
\begin{figure}[ht]
\centering
\begin{tikzpicture}
\begin{axis}[grid = both]
\addplot3[mesh,domain=-2:2] {exp(-x^2-y^2)};
\end{axis}
\end{tikzpicture}
\caption{3d mesh plot of $z = e^{-x^2 - y^2}$}
\end{figure}
More complicated diagrams and figures can be drawn, and there is a huge database\footnote{\url{http://texample.net/tikz/examples/}} of examples online.
\subsection{More Interesting Drawings}
Tikz supports a \emph{wide} range of images. The easiest way to draw a complicated drawing is usually to separate it into `nodes'. Nodes can be given a wide variety of attributes, including shapes, labels, colors, etc. Figure \ref{simpletree} on page \pageref{simpletree} shows a simple example.
\begin{figure}[ht] \label{simpletree}
\centering
\begin{tikzpicture}[scale=.8, every node/.style={}]
\node[circle, fill = blue!20] (top) at (0,4) {$e$};
\node (mid1) at (-2,2) {$a$};
\node (mid2) at (2,2) {$b$};
\node (bot1) at (-3,0) {$a^2$};
\node (bot2) at (-1,0) {$ab$};
\node (bot3) at (1,0) {$ba$};
\node (bot4) at (3,0) {$b^2$};
\draw (top) -- (mid1);
\draw (top) -- (mid2);
\draw (mid1) -- (bot1);
\draw (mid1) -- (bot2);
\draw (mid2) -- (bot3);
\draw (mid2) -- (bot4);
% \draw[thick, color=blue, ->] (top) -- (mid1) -- (bot2) -- (bot3) -- (mid2);
\end{tikzpicture}
\caption{A simple tree}
\end{figure}
Figure \ref{colortree} on page \pageref{colortree} shows a much more complicated example (stolen from Till Tantau\footnote{\url{http://www.ctan.org/author/tantau}})
\begin{figure}[ht] \label{colortree}
\centering
\begin{tikzpicture}[grow cyclic,shape=circle,very thick,level distance=13mm,
cap=round, scale=.8]
\tikzstyle{level 1}=[sibling angle=120]
\tikzstyle{level 2}=[sibling angle=60]
\tikzstyle{level 3}=[sibling angle=30]
\tikzstyle{every node}=[fill]
\tikzstyle{edge from parent}=[decorate, decoration={snake,expanding waves},segment length=1mm, segment angle=10,draw]
\node {} child [color=\A] foreach \A in {red,green,blue}
{ node {} child [color=\A!50!\B] foreach \B in {red,green,blue}
{ node {} child [color=\A!50!\B!50!\C] foreach \C in {black,gray,white}
{ node {} }
}
};
\end{tikzpicture}
\caption{A nice tree drawn with Tikz}
\end{figure}
\subsection{Using Other Software}
\LaTeX{} is not well suited to more intensive computation. However, Tikz/PGF provide lots of options for incorporating images from other systems (MATLAB, Sage, Maple, etc) into documents while still keeping the same style. Documentation and examples can be found here: \url{http://pgfplots.sourceforge.net/pgfplots.pdf} .
\section{Formatting}
\subsection{Fonts}
Since \LaTeX{} uses font families instead of individual fonts, it can be difficult to change a single font. However, many families have been made into packages\footnote{\url{http://www.tug.dk/FontCatalogue/}}. The program XeLaTeX will build \LaTeX{} packages out of fonts currently installed on your computer, but this doesn't always work well.
\subsection{Tables and Arrays}
Tables (which are called arrays in math mode) are simple and easy to create. For example:
\begin{figure}[h]
\begin{tabular}{|l||c|c|c|}
\hline
Vegetables & Celery & Potato & Onion \\
\hline
Fruit & Banana & Grape & Pineapple \\
\hline
\end{tabular}
\caption{Categorizing food}
\end{figure}
And
$$ \mathcal{M} = \left( \begin{array}{cc}
1 & 1 \\
1& 0
\end{array} \right)
$$
\subsection{Definitions, Theorems, etc.}
With the \texttt{amsthm} package, you can create new `theorem' environments like so:
\begin{defn}
Let $n,k \in \mathbb{Z}$ with $0 \leq k \leq n$. Define the \emph{binomial coefficient} $\binom{n}{k}$ by
$$\binom{n}{k} = \frac{n!}{k!(n-k)!}.$$
\end{defn}
\begin{thm} \label{binomthm}
For all $n \in \mathbb{Z}^+$ and all $x \in \mathbb{R}$, the following expansion holds
$$ (x + 1)^n = \sum_{k=0}^n \binom{n}{k}x^k. $$
\end{thm}
Theorem \ref{binomthm} is known as the \emph{Binomial Theorem}.
\subsection{Complicated Equations}
Equations that span multiple lines can be formatted easily with the \texttt{align} environment. If you don't want it numbered, use \texttt{align*} instead. Note that the \texttt{align} environment already defaults to math mode, so you don't need to put in dollar signs.
\begin{thm}[Series Expansion]
$$ \frac{x}{1 - 3x + 2x^2} = \sum_{n \geq 0} (2^n - 1) x^n.$$
\end{thm}
\begin{proof}
\begin{align}
\frac{x}{1 - 3x + 2x^2}
&= \frac{x}{(1 - x) (1 - 2x)} \\
&= \frac{1}{1-2x} - \frac{1}{1-x} \label{parfrac} \\
&= \sum_{n \geq 0} 2^n x^n - \sum_{n \geq 0}x^n \\
&= \sum_{n \geq 0} (2^n - 1)x^n.
\end{align}
Line \ref{parfrac} follows from partial fraction decomposition.
\end{proof}
\subsection{Headers and Footers}
Just use the \texttt{fancyhdr} package, it's easy. See the preamble of this article for an example.
\section{Presentations}
\subsection{Slideshows}
Use \texttt{\textbackslash documentclass\{beamer\}}. Slides are specified with \texttt{\textbackslash begin\{frame\} ... \textbackslash end\{frame\}}.
The \texttt{\textbackslash pause} command makes information show up incrementally.
The \texttt{\textbackslash begin\{block\}\{blocktitle\} ... \textbackslash end\{block\}} allows you to put information in containers called blocks, which help you to organize a presentation.
\subsection{Posters}
Beamer can also be used to make posters, using the block environment to organize information. Many examples can be found online.
\section{Reference Management}
There are two main options when creating a bibliography. The first is to style the bibliography yourself, include it at the end, and let \LaTeX{} handle citations throughout the document. The other is to use BibTeX, a different (but closely related) program to style your bibliography from the basic data, then let \LaTeX{} handle the rest.
\subsection{Without BibTeX}
Use the \texttt{thebibliography} environment at the end of the document to enter bibliography elements. Then you can just use \texttt{\textbackslash cite\{name\}} to cite an entry.
\subsection{With BibTeX}
The first method is simpler, but requires you to do more work. The second is more complicated at first, but makes it extremely easy to change styles. We'll use the BibTeX method here. Here's an example citation \cite{euclid}. And here's another \cite{wiles}.
The default styles can be found here: \url{http://en.wikibooks.org/wiki/LaTeX/Bibliography_Management#Bibliography_styles}. Many journals and conferences will provide their own bibliography style file (\texttt{.bst}) for use in publications. New styles can be automatically generated using \texttt{makebst} tool, but this can get \emph{very} complicated.
Note that, by default, reference entries are only generated if they are cited in the document somewhere. If you want a reference to show up regardless of whether it is cited, use the \texttt{\textbackslash nocite\{name\}} command. Using \texttt{\textbackslash nocite\{*\}} will make all references defined in the \texttt{.bib} file appear in the document.
\bibliographystyle{alpha}
\bibliography{example}
\end{document}