This is a short little shell script which executes the right commands to generate and display a PDF from a latex file. I, personally, named it ‘pdf’ and just placed it in my ~/bin/ directory. The code for this can be found below:

#!/bin/sh

pdflatex $1

bibtex $1

pdflatex $1

pdflatex $1

rm “$1.aux”

rm “$1.bbl”

rm “$1.blg”

rm “$1.log”

rm “$1.toc”

xpdf “$1.pdf” &

PPPP(March 27, 2007 at 8:08 am)\documentclass[12pt]{article}

\usepackage{amsmath} % need for subequations

\usepackage{graphicx} % need for figures

\usepackage{verbatim} % useful for program listings

\usepackage{color} % use if color is used in text

\usepackage{subfigure} % use for side-by-side figures

\usepackage{hyperref} % use for hypertext links, including those to external documents and URLs

% don’t need the following. simply use defaults

\setlength{\baselineskip}{16.0pt} % 16 pt usual spacing between lines

\setlength{\parskip}{3pt plus 2pt}

\setlength{\parindent}{20pt}

\setlength{\oddsidemargin}{0.5cm}

\setlength{\evensidemargin}{0.5cm}

\setlength{\marginparsep}{0.75cm}

\setlength{\marginparwidth}{2.5cm}

\setlength{\marginparpush}{1.0cm}

\setlength{\textwidth}{150mm}

\begin{comment}

\pagestyle{empty} % use if page numbers not wanted

\end{comment}

% above is the preamble

\begin{document}

\begin{center}

{\large Introduction to \LaTeX} \\ % \\ = new line

\copyright 2006 by Harvey Gould \\

December 5, 2006

\end{center}

\section{Introduction}

\TeX\ looks more difficult than it is. It is

almost as easy as $\pi$. See how easy it is to make special

symbols such as $\alpha$,

$\beta$, $\gamma$,

$\delta$, $\sin x$, $\hbar$, $\lambda$, $\ldots$ We also can make

subscripts

$A_{x}$, $A_{xy}$ and superscripts, $e^x$, $e^{x^2}$, and

$e^{a^b}$. We will use \LaTeX, which is based on \TeX\ and has

many higher-level commands (macros) for formatting, making

tables, etc. More information can be found in Ref.~\cite{latex}.

We just made a new paragraph. Extra lines and spaces make no

difference. Note that all formulas are enclosed by

\$ and occur in \textit{math mode}.

The default font is Computer Modern. It includes \textit{italics},

\textbf{boldface},

\textsl{slanted}, and \texttt{monospaced} fonts.

\section{Equations}

Let us see how easy it is to write equations.

\begin{equation}

\Delta =\sum_{i=1}^N w_i (x_i – \bar{x})^2 .

\end{equation}

It is a good idea to number equations, but we can have a

equation without a number by writing

\begin{equation}

P(x) = \frac{x – a}{b – a} , \nonumber

\end{equation}

and

\begin{equation}

g = \frac{1}{2} \sqrt{2\pi} . \nonumber

\end{equation}

We can give an equation a label so that we can refer to it later.

\begin{equation}

\label{eq:ising}

E = -J \sum_{i=1}^N s_i s_{i+1} ,

\end{equation}

Equation~\eqref{eq:ising} expresses the energy of a configuration

of spins in the Ising model.\footnote{It is necessary to process (typeset) a

file twice to get the counters correct.}

We can define our own macros to save typing. For example, suppose

that we introduce the macros:

\begin{verbatim}

\newcommand{\lb}{{\langle}}

\newcommand{\rb}{{\rangle}}

\end{verbatim}

\newcommand{\lb}{{\langle}}

\newcommand{\rb}{{\rangle}}

Then we can write the average value of $x$ as

\begin{verbatim}

\begin{equation}

\lb x \rb = 3

\end{equation}

\end{verbatim}

The result is

\begin{equation}

\lb x \rb = 3 .

\end{equation}

Examples of more complicated equations:

\begin{equation}

I = \! \int_{-\infty}^\infty f(x)\,dx \label{eq:fine}.

\end{equation}

We can do some fine tuning by adding small amounts of horizontal

spacing:

\begin{verbatim}

\, small space \! negative space

\end{verbatim}

as is done in Eq.~\eqref{eq:fine}.

We also can align several equations:

\begin{align}

a & = b \\

c &= d ,

\end{align}

or number them as subequations:

\begin{subequations}

\begin{align}

a & = b \\

c &= d .

\end{align}

\end{subequations}

We can also have different cases:

\begin{equation}

\label{eq:mdiv}

m(T) =

\begin{cases}

0 & \text{$T > T_c$} \\

\bigl(1 – [\sinh 2 \beta J]^{-4} \bigr)^{\! 1/8} & \text{$T