% Example LaTeX Document

% Preamble:  Sets up General Parameters which are Global
\documentclass[12pt]{article}
\usepackage{doublespace,fullpage}
\usepackage{epsfig}
\usepackage{wrapfig}

% Body:  Main Document
\begin{document}
\title{Using {\LaTeX} to Create  Documents}
\author{D. W. Hyatt}
\maketitle

\begin{abstract}
This document extends a previous paper on creating {\LaTeX} documents.
 Examples are provided within the text of the paper, but the reader can 
also view the source code for further clarity.  This paper was designed
to create a web page version to post on the Internet.
\end{abstract}

\section{Introduction}
{\LaTeX}\cite{Kopka} is a text formatting program that is extensively
used to produce scientific journals, textbooks,  and many other publications.
The software is able to take 
irregular blocks of text with embedded commands, and assemble a device
independent file that can be displayed on a computer screen or sent to a
printer.
\par
Similar to HTML tags used for the World Wide Web\cite{DecRan}, {\LaTeX}  commands  direct the program to produce a formatted document including graphics. 
Some of the formatting may seem more difficult than HTML, but the richness
available in {\LaTeX}  is amazing including mathematical symbols and even a 
separate tag for software's own name ($\backslash$LaTeX).  As of now, 
{\LaTeX} remains a standard for document presentation in many scientific 
communities.

\section{Some {\LaTeX} Basics}
There are some basic principles of {\LaTeX} that can help a person organize
a research paper.  These will be described in more detail in each subsection 
below with code examples for reference.
\subsection{Document Header or {\bf Preamble} }
The preamble of a {\LaTeX} document contains a number of global parameters
that will control the entire document.  It is similar to a Cascading Style
Sheet in HTML.  It this paper, the following header tags are used:
\begin{verbatim}
      \documentclass[12pt]{article}
      \usepackage{doublespace,fullpage}
      \usepackage{epsfig}
      \usepackage{wrapfig}
\end{verbatim}

In the first tag, {\bf  $\backslash$documentclass}, parameters are used to indicate that 
the basic font size will be {\bf 12 point}, and the general format for the 
document will be an {\bf article}.
\par
The next three tags tell the software to use special packages such as
{\bf doublespace} and {\bf fullpage}, as well as {\bf epsfig} for
incorporating embedded postscript figures or graphics, and {\bf 
wrapfig} so that text can be made to wrap around a figure or graphic
image if so desired.  These commands will be used later on in this
document.
\par
The next section begins the body of the document, including how to define
the {\bf $\backslash$title} and the {\bf $\backslash$author}.  Since the 
date is not specified,
this will be included as part of the {\bf $\backslash$maketitle} command 
when the document
is actually compiled.  The actual code for this is listed below:

\begin{verbatim}
      \begin{document}
      \title{An Example {\LaTeX}  Document}
      \author{D. W. Hyatt}
      \maketitle
\end{verbatim}

The {\bf abstract} tag allows the author to define what exactly goes into
the official abstract of the paper.  This will typically be printed on the
title page of the document.
\begin{verbatim}
      \begin{abstract}
      This document presents a few examples showing the use of {\LaTeX}, 
      a powerful document processing package developed primarily for UNIX 
      platforms.  
      \end{abstract}
\end{verbatim}
The actual body of the paper will then be listed afterwards in various sections
or subsections until the final {\bf $\backslash$end\{document\}} tag is 
reached.



\subsection{Sections and Subsections}

Text blocks are usually arranged in various {\bf sections}, {\bf subsections}
or {\bf subsubsections}.  Titles
associated with these text blocks will be sequentially numbered and labeled
properly by {\LaTeX}.  An author must merely decide the general organization of 
the paper, and then permit {\LaTeX} to handle all the details including default 
fonts and layout.
\par
Be careful of making {\sl \bf too many} subsections or subsubsections as 
this may
cause a paper to seem too fragmented.  Sometimes, an author will use
these structures for initial organization purposes, almost as in creating 
an outline for the paper, but then notice that only one paragraph may be 
present in each subsection after the paper is actually written.
 In that case, it may be better to remove a bit of this excess structure
and use good paragraph development to relay the same meaning.  
Usually, a well written topic sentence
in a paragraph is sufficient to help the reader understand the
content, and transition sentences from one thought to the next
can assist in understanding.
Therefore, it would not be necessary to have titles for subsections
with ony one paragraph each, and maybe several of these sections 
could be grouped together with a single, more inclusive title.

\subsection{Enumerated Lists}
The equivalent of the "ordered list" in HTML is called the enumerated list 
in {\LaTeX}. An enumerated list allows people to organize a list of items
and then permit the software to handle automated numbering.   
\par
The general format for an enumerated list is as follows:
\begin{verbatim}
      \begin{enumerate}
      \item First Item 
      \item Second Item 
      \item  Last Item
      \end{enumerate}
\end{verbatim}

The following numbered sequence that shows how to 
run {\LaTeX} on the systems at TJHSST is such an enumerated list.  
Review the source code of this document to see how this list and the 
other examples were created.

\begin{enumerate}
\item Make sure the computer knows where {\LaTeX} is located on our system.
\\ ({\bf /usr/share/texmf/bin})
\item  Type a text file with the proper {\LaTeX} commands using vi or 
other editor.  Save the source as {\bf $<$filename$>$.tex}. 
{\sl (Example: vi paper1.tex)}
\item  Type the command: {\bf latex $<$filename$>$} without the .tex extender. 
{\sl (Ex: latex paper1)}
\item If there are errors, edit the file and repeat from step \#3.  
If there are unresolved references such as footnotes, it may be necessary to 
repeat \#3 again.
\item  View the output by typing {\bf xdvi $<$filename$>$.dvi}.  
{\sl (Ex: xdvi paper1.dvi)}
\item  Print the output, type the command {\bf dvips $<$filename$>$.dvi} 
to create a Postscript file and send that to a printer.  \\
{\sl (Ex: dvips paper1.dvi} ... followed by ...  {\sl  lpr paper.ps)} 
\end{enumerate}

\subsection{Unordered Lists}
Just as in HTML, it is also possible to include unordered lists in {\LaTeX}.  
The bullet-ed items below point out a few of {\LaTeX}'s more powerful features 
and were created using such a list.  The basic command 
{\bf $\backslash$begin\{itemize\}} starts the list structure, and each
bulleted entry is identified with a {\bf $\backslash$item} tag.  The end
of the list is identified with a {\bf $\backslash$end\{itemize\}} tag.
\par
The following other features of {\LaTeX} are written as entries in an 
unordered list.  
\begin{wrapfigure}[]{r}[0in]{0in}
\epsfig{file=hyatt.ps, width = 1in}
\end{wrapfigure}

\begin{itemize}
\item  Graphics such as the author's picture can be included also.   This 
is accomplished by using the $\backslash$epsfig tag with appropriate filename 
and size parameters. 
\item If the author wishes that the text wrap around the figure,
it is also possible to use elements from the {\bf wrapfigure package}
indicating where the image should be placed on the page.  The text below
will place a Postscript image of the author with a width of only one
inch to the right side of the page, allowing text to
wrap around that image.
\begin{verbatim}
      \begin{wrapfigure}[]{r}[0in]{0in}
      \epsfig{file=hyatt.ps, width = 1in}
      \end{wrapfigure}
\end{verbatim}

\item   {\LaTeX} allows for page formatting and additional 
{\Large \sl font choices} by using {\bf $\backslash$Large} for 
one of the standard large fonts, followed by
{\bf $\backslash$sl} for a slant font.
\item  For more information on {\LaTeX}, check out the texts \cite{Kopka}
 available in the lab.  For information on the proper way to display
online references, refer to the materials published by
Columbia University \cite{Style}.
\end{itemize}

\subsection{Math Features}
The ability to display  mathematics formulas of exceptional complexity is 
one of the most valuable assets of {\LaTeX}.  A simple formula like the 
solution to the quadratic equation is not possible to write using current 
versions of HTML but is easy in {\LaTeX}.  For instance, the following code:

\begin{verbatim}
      \begin{displaymath}
      x = \frac{-b \pm \sqrt[2]{b^2 - 4ac}}{2a}
      \end{displaymath}
\end{verbatim}

Produces the following formula:
\begin{displaymath}
x = \frac{-b \pm \sqrt[2]{b^2 - 4ac}}{2a}
\end{displaymath}

Even strange formulas with Greek letters, such as 
$\delta = \pi sin(\theta -\Sigma)$, can be 
inserted right within a line of text by surrounding the necessary
components of the equation with dollar signs ({\bf \$}).
\begin{verbatim}
       $\delta = \pi sin(\theta -\Sigma)$
\end{verbatim}
\par
To insert sections of computer code so that it keeps the same format, try
using the {\bf $\backslash$begin\{verbatim\}} tag.  For instance, the
following segment of code was printed using this option. 

\begin{verbatim}
      main()
            { cout << "Hello \LaTeX" << endl;
            }
\end{verbatim}



\subsection{Tables and Bibliography}
In many wordprocessors, students must spend considerable time creating
formatted items such as tables, as well as organizing bibliographic 
references.  In {\LaTeX}, these operations are relatively simple.
\par
The general format for setting up a table is to define a table 
 using "l", "r", or "c" for positioning and vertical bar for
column lines.  The ampersand {\bf \&} is used to separate items and
the "hline" tag for row lines.  The code below is used to define
the table comparing the advantages of various word processing
products:

\begin{verbatim}
      \begin{center}
      \begin{tabular}{r|lcc|}\hline
      No. & Formatting Language & Cost & Utility \\ \hline \hline
      1. & HTML & free & fair \\ \hline
      2. & LaTeX & free & good \\ \hline
      3. & Microsoft Word & expensive & good \\ \hline
      4. & vi & free & poor \\ \hline
      5. & Word Perfect 5.1 & cheap & fair \\ \hline
      \end{tabular}
      \end{center}
\end{verbatim}
The actual table looks like the following:


\begin{center}
\begin{tabular}{r|lcc|}\hline
No. & Formatting Language & Cost & Utility \\ \hline \hline
1. & HTML & free & fair \\ \hline
2. & LaTeX & free & good \\ \hline
3. & Microsoft Word & expensive & good \\ \hline
4. & vi & free & poor \\ \hline
5. & Word Perfect 5.1 & cheap & fair \\ \hline
\end{tabular}
\end{center}

\par
Bibliographic references are very handy since {\LaTeX} coordinates
any citations in the text to the bibliograph list.  Each bibliography
reference needs to have an identifier such as 
{\bf $\backslash$bibitem\{RefID\}  $<$reference info$>$ } in the 
bibliography, and then anytime that reference is cited with the
proper {\bf $\backslash$cite\{RefID\}}, {\LaTeX} will handle all
the coordination and numbering of items in the list.

\section{Additional Uses}
Students who want to produce professional looking research papers should 
learn how to use {\LaTeX}.  Like many programs distributed on the Internet, 
the latest version will always have wonderful new features. 
\par
Although there are word processors that can do much of the same formatting 
shown here, {\LaTeX} is freely available for many UNIX platforms and is 
installed on the  {\bf Linux } systems in the Computer Systems Lab.  
Another really powerful feature of this document processing language
is that people have 
written programs that will convert a standard document written in 
{\LaTeX} format into a complete website using the program {\bf latex2html}.
\cite{latex2html}  The program converts every section or subsection
into a separate web page including appropriate navigation tools, and also
turns all of the equations and  into separate GIF images.  
\par
The software
also creates a separate cascading style sheet so that the 
resultant document can be quickly converted to some desired format.
Take a look at the cascading style modifications used to change the 
background to white in this document as well as headers and links to 
different colors: latex.css



\begin{thebibliography}{99}
\bibitem{DecRan} John December and Neil Randall, 
\underline{The World Wide Web Unleashed}, Sams Publishing, 1994.
\bibitem{Kopka} Helmut Kopka and Patrick W. Daly, \underline{A Guide
 to LATEX}, Addison-Wesley Publishing Co., Inc., 1993.
\bibitem{latex2html} Nikos Drakos and Ross Moore, \underline{LaTeX2HTML
Translator} Version 99.2 beta8(1.43), Macquarie University, Sydney, 1999.
\bibitem{Style} Walker, Janice R. et al., "The Columbia Guide to Online Style",
1995.\\ http://www.columbia.edu/cu/cup/cgos/idx\_basic.html (August 11, 2000) 
\end{thebibliography}

\end{document}
