%
% Example to demonstrate how to use psfrag to include equations into
% SIMFIT graphs and how to send the simfit dictionary as a separate
% header file to save disk space and increase printing speed.
% It needs the standard LaTeX graphicx, pslatex and psfrag packages
% but you can leave out the \usepackage{pslatex} if you do not have
% the required fonts.
%

\documentclass[dvips,11pt]{article}

   \usepackage{graphicx}
   \usepackage{pslatex}
   \usepackage{psfrag}

   \setlength{\parindent}{0in}
   \setlength{\topmargin}{-0.25in}
   \setlength{\textheight}{9.0in}
   \setlength{\textwidth}{6.0in}
   \setlength{\oddsidemargin}{0.125in}
   \setlength{\evensidemargin}{0.125in}
   \pagestyle{empty}

\special{header=psfragex.ps1}

\begin{document}
\noindent
{\Large\textbf{Plotting mathematical equations in simfit}}

\mbox{}

It is frequently necessary to label graphs with
equations and, although this can be done on screen
using the \textbf{\textsf{simfit}} maths features, it is tedious.
In fact, a far better and more convenient way to add equations
to graphs is to use
\LaTeX\ with \textsf{\textbf{psfrag}}, as in this next example.
\begin{center}
%
% here is how to use the psfrag command:
% \psfrag{string}{replacement} as in the next example.
% Note that there are extra arguments for positioning
% the equation if you need them.
%
   \psfrag{phi(x)}
                  {$\displaystyle \phi(x) =
                   \frac{1}{\sigma \sqrt{2\pi}}
                   \int_{-\infty}^x
                   \exp\left\{
                   -\frac{1}{2} \left( \frac{t-\mu}{\sigma} \right)^2
                   \right\}\,dt $}
   \mbox{\includegraphics[width=6in]{psfragex.ps2}}
\end{center}
David Carlisle, who helped me prepare the
\textbf{\textsf{simfit}} PostScript interface, has recently upgraded
\textbf{\textsf{psfrag}} and he has now helped me to incorporate the
power of this package into \textbf{\textsf{simfit}} graphics.
The dynamic link library \textbf{\textsf{graphics.lib}} has been
upgraded to include a special feature that allows you to create
PostScript files from \textbf{\textsf{simfit}} in such a way that
\textbf{\textsf{psfrag}} can be used very easily. To construct the above
graph I first used \textbf{\textsf{makdat}} to get the
ASCII text coordinate data file for a normal \textit{cdf.}
 Then I read
the data into \textbf{\textsf{simplot}} and generated the plot in the
normal way. However, I included an extra text
string as a marker
to tell \LaTeX\ exactly where to place the equation.
The equation itself was prepared using standard \LaTeX\
commands.
To see how this is done, examine the files \texttt{psfragex.tex},
\texttt{psfragex.ps1} and \texttt{psfragex.ps2}
in the installation package.

\mbox{}

These files show you how to exploit another new
\textbf{\textsf{simfit}} graphics feature;
you can cut out the simfit dictionary from the graphics file and send
it separately as a header file. This means that when preparing a document
you can cut out all of
the headers defining the dictionary in the included graphics files
and just use the header once with the completed documents. This is
demonstrated in \texttt{psfragex.tex}.
This results in great savings in disk space and much faster printing
if documents contain a lot of graphics.
\end{document}

