\documentclass{article}
\usepackage{local} % a couple of local macros I'm using
\usepackage{amssymb,latexsym,amsmath}

\begin{document}
\filename          % this macro is defined in local.sty

An example of basic mathematics typesetting in \LaTeX:

\begin{center}
\fbox{\parbox{4in}{\noindent\hspace*{5pt}
To solve 
\begin{equation}
\label{E:linde}
  \frac{dy}{dx} + \frac{3}{x} y = x^4,
  \quad y_0 = \sqrt{2},
\end{equation}
we use the \emph{integrating factor}
$\rho(x) = e^{\int p(x)\,dx}$ (where $p(x)$ is 
the coefficient of $y$ in~(\ref{E:linde})).  This is
\begin{align}
  \rho(x) &= e^{\int (3/x)\,dx} = e^{3\ln|x|}\notag \\
          &= x^3\ (\mbox{because}\ 3\ln|x| = x^3).\label{E:ifac}
\end{align}
\ldots Finally, we might ask: what is
$\lim_{x\to\infty} \sqrt[n]{y(x)}$, $n\in I$, $n\ne 2$?
}}
\end{center}

\begin{center}
\fbox{\parbox{4in}{\ttfamily
\noindent
\bsl documentclass\{article\}\\  % \bsl is defined in local.sty
\bsl usepackage\{amsmath\} \% we need this for the align macro\\
\bsl begin\{document\}\\
To solve\\
\bsl begin\{equation\}\bsl label\{E:linde\}\\
\hspace*{5pt}\bsl frac\{dy\}\{dx\}+\bsl frac\{3\}\{x\}y = x\^{}4, 
  \bsl quad y\_0=\bsl sqrt\{2\},\\
\bsl end\{equation\}\\
we use the \bsl emph\{integrating factor\}
\$\bsl rho(x) = e\^{}\{\bsl int p(x)\bsl,dx\}\$ (where \$p(x)\$ is the
coefficient of \$y\$ in\~{}(\bsl ref\{E:linde\})).
This is\\
\bsl begin\{align\}\\
\hspace*{5pt}\bsl rho \&= e\^{}\{\bsl int (3/x)\bsl,dx\}
  = e\^{}\{3\bsl ln|x|\}\bsl notag\bsl\bsl \\
\hspace*{5pt} \qquad\&= x\^{}\{3\}\bsl\ (\bsl mbox\{because\}\bsl\ 
  3\bsl ln|x|=x\^{}\{3\}).\\
\bsl end\{align\}\\
\bsl ldots Finally, we might ask: what is\\
\$\bsl lim\_\{x\bsl to\bsl
infty\}\bsl sqrt[n]\{y(x)\}\$, \$n\bsl in I\$, \$n\bsl ne 2\$?\\
\bsl end\{document\}\par
}}
\end{center}

\noindent
Some things to note about this:
\begin{itemize}
\item
  \emph{Inline math} equations are delimited with \texttt{\$\ldots\$}.
\item
  \emph{Displayed math} equations are delimited in a number of ways:
  to get a numbered equation, use \texttt{\bsl begin\{equation\}\ldots
  \bsl end\{equation\}}.  To get a simple, unnumbered equation,
  replace \texttt{equation} with \texttt{equation*} in the
  \texttt{begin} and \texttt{end} macros\footnote{The
  \texttt{equation*} and \texttt{align} equation environments require 
  that you load the \texttt{amsmath} package with the \texttt{\bsl
  usepackage\{amsmath\}} command included in the document header.  If
  you're not using this package, you can also get an unnumbered
  displayed equation by using \texttt{\bsl[} and \texttt{\bsl]}
  instead of the \texttt{\bsl begin\{equation*\}} and \texttt{\bsl
  end\{equation*\}} commands.\label{F:amsmth}}. To get multi-line
  equations, we use something like \texttt{align} (see below).
\item
  By using the \texttt{\bsl label} macro, we can ``label'' an equation
  displayed with \texttt{\bsl equation} and refer to it later with the
  \texttt{\bsl ref} command.  Note that in our example we didn't label 
  equation~(\ref{E:ifac})\footnote{\ldots sort of.}, but still let it
  get numbered.
\item
  All spaces are ignored in equations.  To specify spacing other than
  that which \LaTeX\ puts in, we have to specify it.  Spacing commands
  are \texttt{\bsl ,} 
% in cm10, 1em = 10.5pt; \quad = 1em; \, = 1/6 quad, \: = 2/9 quad,
%    \; = 5/18 quad
  (~\makebox[2.55pt]{\rule{.4pt}{2pt}\hrulefill\rule{.4pt}{2pt}}~), 
  \texttt{\bsl :} 
  (~\makebox[3.13pt]{\rule{.4pt}{2pt}\hrulefill\rule{.4pt}{2pt}}~),
  \texttt{\bsl ;} 
  (~\makebox[3.72pt]{\rule{.4pt}{2pt}\hrulefill\rule{.4pt}{2pt}}~),
  \texttt{\bsl quad} 
  (~\makebox[11.3pt]{\rule{.4pt}{2pt}\hrulefill\rule{.4pt}{2pt}}~), and
  \texttt{\bsl qquad} 
  (~\makebox[21.8pt]{\rule{.4pt}{2pt}\hrulefill\rule{.4pt}{2pt}}~).  But
  usually you can trust \LaTeX\ to get things right.
\item
  To include text in math, use \texttt{\bsl mbox\{\ldots\}} to avoid
  it being typset in $math italic$ (with no spaces).
\item
  Greek symbols are available in math as you'd expect, through the
  macros \texttt{\bsl alpha}, \texttt{\bsl beta},\ldots.  (And in
  capitals, too(!): \texttt{\bsl Gamma},\ldots)
\item
  Include standard operators and functions in math with the
  corresponding \LaTeX\ commands: \texttt{\bsl in}, \texttt{\bsl ln},
  \texttt{\bsl ne}, \texttt{\bsl sin}, \texttt{\bsl to}, \textit{etc.}
\item
  Finally, notice the \texttt{align} equation
  environment\footnote{Which requires the \texttt{amsmath}
  package---see footnote~\ref{F:amsmth}.}.  This allows alignment of
  several equations---the marker that indicates where the alignment takes
  place is the ampersand.
  \begin{itemize}
    \item
      Each of the equations in the \texttt{align} environment
      (\emph{except the last}) is ended with a line break
      (\texttt{\bsl\bsl}). 
    \item
      By default each of the equations is individually numbered, but
      we can suppress numbering on one or more of the equations
      with the \texttt{\bsl notag} command.  (Inserted before the
      \texttt{\bsl\bsl}.)
    \item
      We can also label any numbered equation with a \texttt{\bsl
      label} command, the same way we labelled the first
      equation---for example, by appending \texttt{\bsl
      label\{E:intfac\}} at the end of the equation (before the
      \texttt{\bsl\bsl} if we're not labelling the last equation). 
  \end{itemize}
\end{itemize}

\end{document}
