%% -*- Mode: LaTeX -*-
%% -*- Module: test.tex

%% set the documentstyle
\documentclass{article}
\usepackage{epsfig}
\usepackage{times}

%% we will get a new page for each example so make pages high enough
\textheight=10in

\def\illpref/{}
% \def\illpref{/u/vojta/Xdvi/xdvi-examples}

\begin{document}

Here we go with some tests.  We want to make sure we have examples for
all possibilities.  For instance, we believe that xdvi should be able to
show a figure that has a bounding box and is included via psfig.  Here
is an attempt, which we call Fig.~\ref{fig:f1}.

\begin{figure}[h]
  \centerline{\psfig{figure=\illpref/f1.ps,width=5in}}
  \caption{Figure with bounding box included with psfig.}
  \label{fig:f1}
\end{figure}

This figure is a crude postscript figure created with an in-house program.

\newpage

This next figure is created with matlab.
Also included courtesy of psfig.

\begin{figure}[h]
  \centerline{\psfig{figure=\illpref/f2.ps,height=5in}}
  \caption{Figure with bounding box included with psfig.  More robust
    postscript.}
  \label{fig:f2}
\end{figure}

You will no doubt notice the figure does not seem to be centered.  It
is in fact centered as you can check by clicking on the {\em ``View PS''}
option and checking out its bounding box.  It just so happens
that the program that generated this figure comes out with weird bb's.

\newpage

Now, we might want to try figures that are somewhat different.  For
instance Fig.~\ref{fig:f3} has no bounding box.  We wish to include it
by means of a special.  Here we go...

\begin{figure}[h]
  \vspace{2in}
  \special{psfile=\illpref/f3.ps.gz hoffset=-10 vscale=200 hscale=200}
  \caption{Figure without a bounding box included with special.}
  \label{fig:f3}
\end{figure}

You no doubt noticed that the figure is not centered, either horizontally
or vertically.  With a {\em special} command you would have to do
that on your own by specifying the hoffset, voffset, etc.  In contrast
{\em psfig} or {\em epsf} will do that for you automagically.

Also, you will notice that since the figure is included with a
{\em special}, it is impossible to know its bounding box (even if it
had one---see next example).  Therefore it cannot be shown.

\newpage

Now the following figure, Fig.~\ref{fig:f4}, does have a bounding box
but we still include it with a simple special.  Plus it is color!

\begin{figure}[h]
  \vspace{5.5in}
  \special{psfile=\illpref/f4.ps hoffset=-100 voffset=-200}
  \caption{Figure with a bounding box included with special.}
  \label{fig:f4}
\end{figure}

Even though the figure does have a bounding box we cannot show it
since it was included with a {\em special} which does no filtering
of the file whatsoever.

\newpage

The following figure, Fig.~\ref{fig:f5}, is included with {\em epsf}.

\begin{figure}[h]
  \epsfysize=5in
  \epsffile{f5.ps}
  \caption{Postscript code directly from an {\em epsf} command.}
  \label{fig:f5}
\end{figure}  

\begin{figure}[h]
  \epsffile{f6.ps}
  \caption{Postscript code directly from an {\em epsf} command (FP).}
  \label{fig:f5}
\end{figure}  

\newpage

The following figure, Fig.~\ref{fig:f6}, is included with {\em epsf}.
It is the same figure as above but a Bounding box is provided.

\begin{figure}[h]
  \epsfysize=2in
  \epsffile[100 100 400 500]{f5.ps}
  \caption{Postscript code directly from an {\em epsf} command.}
  \label{fig:f6}
\end{figure}  

This example is interesting because it shows that if you are not
careful with either the dimensions you think the picture has or the
bounding box you use for it (assuming it does not have one), then you
may have strange things happen to you.

\newpage

The following figure, Fig.~\ref{fig:f7}, is an example of raw
postscript being sent to the driver.  It was taken from the
{\em dvips} manual.

\begin{figure}[h]
  \vspace{2in}
  \vbox to 100bp{
    \special{" newpath 000 000 moveto 100 100 lineto 394 0 lineto
      closepath gsave 0.8 setgray fill grestore stroke}\vfil}
  \caption{Postscript code directly from a {\em special} command.}
  \label{fig:f7}
\end{figure}  

It may come as a bit of a surprise, but this was the last type of
{\em special} command to be implemented.  But it has now been implemented.
It has no bounding box.

\end{document}
