A Sample LaTeX File

A Sample LaTeX File


\documentclass[12pt]{article}
\usepackage{2130}
\headers{\footnotesize\bf Memorial University of Newfoundland} 
{} 
{\footnotesize\bf Department of Mathematics and Statistics}
\footers{\footnotesize Applied Mathematics 2130}
{\footnotesize Sample \LaTeX}
{\footnotesize Page \thepage}
\underheadoverfoot

\begin{document}

\begin{center}
{\Large\bf Just a sample document}
\end{center}
You can typeset plain text as with any other typesetting software. The
fun part is when you wish to display mathematical symbols. You can have
mathematics embedded in the text like $y = \sin (x)$ or you can display
mathematics on a line all its own like

\[
y = x^2 + \sqrt{x^4 + 1}.
\]

If you wish to have a displayed line of mathematics along with a number
you do

\begin{equation}
f(x) = \int_1^x \frac{1}{z} dz.
\label{eq:first}
\end{equation}

The label command is not required but if at a later point in your text
you wish to make a reference to that equation  (\ref{eq:first}) you can
do it with the command

\begin{verbatim}
      (\ref{eq:first}).
\end{verbatim}

The backslash is the symbol used to start any \LaTeX\/ command and the
curly brackets are used for command arguments. 

You can generate itemized lists:
\begin{itemize}
\item first item,
\item second item,
\item etc ...
\end{itemize}
and you can also generate numbered lists:
\begin{enumerate}
\item first item,
\item second item,
\item etc ...
\end{enumerate}

There are lots and lots of special symbols:
\[
\alpha,\ \beta,\ \eta,\ \iota,\ \zeta,\ \omega,\ \Omega,\ \sigma,\ \Sigma,
\ \int,\ \infty,\ \ldots
\]

There are commands for creating arrays like:
\[
\left[ \begin{array}{cc}
        a & b \\
	c & d \\
	\end{array} 
\right].
\]
and there are some for multi-line equations like:
\begin{eqnarray*}
\cos(2\theta) &=& \cos^2(\theta) - \sin^2(\theta) \\
	      &=& 2\cos^2(\theta) - 1 \\
	      &=& 1 - 2\sin^2(\theta)
\end{eqnarray*}
In that last command (look in the .tex file), the ``*'' suppresses the printing 
of line numbers.  Remove that asterisk and we get
\begin{eqnarray}
\cos(2\theta) &=& \cos^2(\theta) - \sin^2(\theta) \\
	      &=& 2\cos^2(\theta) - 1 \\
	      &=& 1 - 2\sin^2(\theta)
\end{eqnarray}

There are other commands that will permit you to typeset tables of data
(look up the {\bf tabular} environment), figures with captions (look up
the {\bf figure} environment), bibliographies. In short, everything you
can think of that publishers and authors make use of.

\section*{Next in line}
There are sectioning commands that create the appropriate amount of
white space and changes to bold face fonts for the title of the section.
Once again, an asterisk (look in the .tex file) suppresses numbering of
sections. Remove it and the section numbers will be automatically
generated.

\section*{The bare bones}
All papers have a beginning and an end. So it is for computer programs and so it is
for {\tt .tex} documents. 

\smallskip\noindent
All {\tt .tex} documents must begin with the statements
\begin{verbatim}
       \documentclass{article}
       \begin{document}
\end{verbatim}
All {\tt .tex} documents must end with a 
\begin{verbatim}
       \end{document}
\end{verbatim}
so \LaTeX\/ knows when it is quitting time. At the start, between the {\tt
documentclass} and {\tt begin\{document\}} statements, one can include a whole
bunch of typesetting commands which adjust the layout of the page and load
packages that are not part of the standard implementation, for example, packages
to handle graphics. This area is called the {\tt preamble}. Look at the original
{\tt .tex} file for this document to see what was put in the preamble and try to
guess what it did.

\end{document}