\documentclass[12pt, a4paper]{article}
\usepackage{graphicx}
\title{An Introduction to \LaTeX~in One Short Talk}
\author{Robyn Owens (Edited Mar 2013 Rachel Cardell-Oliver)}
%Comments come after a percentage sign.
%RCO 2013 psfig refs changed to graphics
\begin{document}
\maketitle
\begin{abstract}
This very short talk will not tell you much about \LaTeX,
but hopefully it will entice you to learn lots more, because
it is a beautiful mark-up language and produces the most
professional looking documents. It is accepted worldwide
and, indeed, insisted upon by some journals.
\end{abstract}
\section{Introduction}
In this paper I will tell you how to write a lovely
looking paper using \LaTeX.
It doesn't matter how many spaces
you have between letters, \LaTeX will typeset everything
beautifully.
However, a line space will indicate the beginning of a new
paragraph.
As we know, a new paragraph should be used for each new thought.
Typesetting simple text is easy. To mark-up {\bf bold} or
{\em emphases}, you use simple and obvious commands.
Sometimes, an {\em emphasis}\/ requires a bit of extra space
if it is followed immediately by another word; if you do not
do this, it can look a bit {\em squashed} up. Moreover, the
emphasis command is a toggle command; {\em if you use it
{\em twice}, you will find the usual result.}
A tied space in \LaTeX~is provided by using the \verb+~+ command.
You use it most often when making citations, such as in citing
Knuth's~\cite{knuth} work, or with constructs like Chapter~1,
Algorithm~2, Theorem~3, Corollary~4 and Lemma~5 so that the
number doesn't go over to the next line.
There are four kinds of dashes in \LaTeX: the hyphen, such as
in user-friendly; the dash between ranges of numbers, such as
in 121--123; the dash between phrases, such as in ``Which do you
prefer---black or white?''; and the mathematical minus sign,
such as in $-1$. They should all be used consistently.
Ellipses are typeset as \ldots, not as ..., because \LaTeX~
typesets dots as full stops, and puts them up close to the
previous symbol.
\LaTeX~uses various types of logical environments to typeset
the different logical structures within your document. If you
are familiar with HTML then you will already have a head start
of logical mark-up.
The easiest environment is the list environment, and
\LaTeX~provides many. The most common are the \verb+itemize+,
\verb+enumerate+, and \verb+description+ environments.
Here's how they work.
An itemised list uses bullet points for each list item.
\begin{itemize}
\item Here is the first item on my list. It can be whatever I
like it to be.
\item Here's the 2nd.
\item And here's the last, which is going to have $x+y=4$ in it.
\end{itemize}
An enumerated list uses numbers.
\begin{enumerate}
\item Here is the first item on my list. It can be whatever I
like it to be.
\item Here's the 2nd.
\item And here's the last, which is going to have $x+y=4$ in it.
\end{enumerate}
The description list is more commonly used to define terms.
\begin{description}
\item [Item 1] Here is the first item on my list. It can be
whatever I like it to be.
\item [Item 2] Here's the 2nd.
\item [Item 3] And here's the last, which is going to have
$x+y=4$ in it.
\end{description}
\section{Mathematics}
Now we really should do some mathematics, where the beauty of
\LaTeX~becomes evident.
Mathematics can be typeset in the \verb+math, displaymath+, and
\verb+equation+ environments, and in the short forms \verb+$...$+
and \verb+\[...\]+.
Here I put in some simple mathematical terms, such as
$E = mc^2$, or my favorite equation is \[e^{i \pi} = -1.\]
Other terms that are simple
to handle are fractions, subscripts and superscripts,
such as
\begin{math}
\frac{1}{n+2} = x_i + y^3.
\end{math}
It is standard practice to typeset in-line fractions, such as
the one in this paragraph, as $1/(n+2) = x_i + y^3$,
making it easier to read.
Let's do something more complicated, like
\begin{equation}
\int x^2e^{x^3}dx = \frac{1}{3} \int e^{x^3}(3x^2)dx
\end{equation}
Note that in the \verb+equation+ environment, each equation is
numbered. You can suppress the numbering with the
\verb+\nonumber+ command. The \verb+displaymath+ environment
produces unnumbered formulae.
The tabular environment is used for arrays of ordinary text,
whereas the array environment is used for mathematical arrays.
Here's a table:
\begin{center}
\begin{tabular}{|l|c|r|} \hline
Department & EFTSUs & Budget (in \$) \\ \hline
Astronomy & 100 & 1,250,000 \\
Theology & 15 & 250,000 \\
Genetic Engineering & 200 & 5,700,000 \\ \hline
\end{tabular}
\end{center}
The array environment can beautifully typeset matrix equations,
such as in the following few lines of text:
The relationship between the two coordinate systems $(c,x,y)$
and $(C,X,Y,Z)$ is given by
\begin{equation}
x = \frac{Xf}{Z} \hspace{1cm}\mbox{and}\hspace{1cm} y = \frac{Yf}{Z}.
\end{equation}
This can be written linearly in homogeneous coordinates as
\[
\left[
\begin{array}{c}
sx \\
sy \\
s
\end{array}
\right] =
\left[
\begin{array}{cccc}
f & 0 & 0 & 0 \\
0 & f & 0 & 0 \\
0 & 0 & 1 & 0
\end{array}
\right] \cdot
\left[
\begin{array}{c}
X \\
Y \\
Z \\
1
\end{array} \right], \]
where $s \neq 0 $ is a scaling factor.
There are lots of other beautiful things you can do in mathematics,
but let's move on to including diagrams and images.
\section{Figures}
To include diagrams and images into your document, you can use
a \LaTeX~macro called \verb+graphicx+. This usage is declared in
the header of your \LaTeX~source as follows:
\begin{verbatim}
\documentclass{article}
\usepackage{graphicx}
\end{verbatim}
\noindent{and then to include a pdf file you simply use the command}
\verb+ \includegraphics[width=0.5\textwidth]{image}+
The size of the figure can be controlled by setting width or height options.
This is illustrated with the inclusion of a nice image somewhere in
this document but probably not exactly {\em here}!
\begin{figure}
\begin{center}
\includegraphics{image}
\caption{Here is a nice picture of a dragon fly}
\end{center}
\end{figure}
I can fiddle around with commands in \verb+graphicx+ to change the size and
orientation of the pdf figure fairly easily and get something
like the image shown in Figure~\ref{fig:silly}.
\begin{figure}
\begin{center}
\includegraphics[width=0.1\textwidth]{image}
\end{center}
\caption{Here is a small picture of a dragonfly.}
\label{fig:silly}
\end{figure}
\section{Getting some output}
Once your source is beautifully typeset, you might want to print it
out. Tools, such as \verb+pdflatex+ will
create \verb+.pdf+ output, which can be read by an Adobe Acrobat
reader.
%The program \verb+tth+ is a \LaTeX~to HTML converter, although
%it is not yet perfect and the HTML source may require some work
%before you make it available on the web.
Don't forget to use a spelling checker, such as \verb+ispell+, which
will check all your spelling and ignore most \LaTeX~commands.
\begin{thebibliography}{9}
\bibitem{knuth}
D. E. Knuth. {\em The \TeX~Book.}\/
Addison-Wesley, Reading, Massachusetts, 1984.
\end{thebibliography}
\end{document}