\documentclass[a4paper]{article}
\usepackage[dvips]{graphicx}
\usepackage{fullpage}

\newcommand{\image}[2][]
{%HEVEA\imgsrc{#2.jpg}
%BEGIN LATEX
\includegraphics[#1]{#2.eps}
%END LATEX
}
\begin{document}

\centerline{\image{graphps_logo}}

\bigskip

\centerline{\Huge{\bf {Caml drawings in PostScript}}}

\bigskip

\centerline{\Large{\bf {Pierre Weis}}}

\section{What is GraphPS ?}

GraphPs is a Caml library used to generate PostScript files from
Caml graphics drawings.

GraphPs provides a module similar to the usual graphics drawings
module {\tt Graphics} of the regular Caml distribution. This module,
also named {\tt Graphics}, has (almost) the same signature as the
original {\tt Graphics} module. Thus, using the GraphPs {\tt Graphics}
module, your Caml drawing programs transparently generate PostScript
files (that can be encapsulated into \TeX\, or \LaTeX\, files), instead of
drawing graphics directly onto the screen.

\section{Using GraphPS}

Intended usage of this library could be seen as a three phases process:

\begin{itemize}

\item write a regular Caml program (either batch or interactive) using
the regular {\tt Graphics} library.

\item use the GraphPS library instead of the regular {\tt Graphics}
library (for instance you can just change the Caml library load path
to obtain linking of GraphPS in place of {\tt Graphics}). Recompile
your Caml program to obtain a new executable that produces PostScript
commands instead of {\tt Graphics} commands.

\item run the new executable to produce a PostScript file that exactly
corresponds to the drawing produced by your Caml program.

\end{itemize}

A PostScript program corresponding to your {\tt Graphics} sequence of
commands is printed to the standard output of the program, when
{\tt {close\_graph ()}} is evaluated, or alternatively when the normal
termination of the Caml program is reached. You can thus redirect the
output to whichever file you want. GraphPS generates {\em
encapusulated} PostScript files, which means that a so-called {\em
bounding box} (that gives the size of the drawing) is calculated and
inserted at the beginning of the PostScript file to help \LaTeX\, to
insert it into the document. Hence you should produce a {\tt .eps}
suffixed file.

\section{Using the PostScript files produced by GraphPS}

\subsection{Direct visualization}

You can visualize directly the files using any PostScript visualizers,
for instance {\tt ghostview} or {\tt gs} or {\tt gv}.

\subsection{Including PostScript files into your \LaTeX\, files}

This is not exactly a GraphPS problem, but a simple example may help
to solve this \LaTeX\, problem.

A very simple way to include your {\tt caml\_drawings.eps} file, is as
follows:

\begin{itemize}

\item use the {\tt graphicx} package of \LaTeX, writing the following
line into your \LaTeX\, document:

\begin{verbatim}
\usepackage[dvips]{graphicx}
\end{verbatim}

\item then order \LaTeX\, to include the {\tt caml\_drawings.eps} file
into the document by writing the line:

\begin{verbatim}
\includegraphics{caml_drawings.eps}
\end{verbatim}

\end{itemize}

For instance, the following line will draw the drawings of the file
{\tt euro.eps}, centered in the current line.

\begin{verbatim}
\centerline{\includegraphics[width=10cm]{euro.eps}}
\end{verbatim}

\section{Trouble shooting}

\subsection{Caml problems}

Most of the time, your original Caml program should work just fine
with no modification when using the {\tt Graphics} module provided by
GraphPs.

However, some {\tt Graphics} commands are not supported by the GraphPS
library, since they have no meaning for PostScript files (e.g. mouse
events handling commands). If the original program uses such commands,
you should remove them.

\subsection{PostScript problems}

To ensure proper inclusion of generated PostScript files, GraphPS does
not add any {\tt showpage} order at the end of the file.

If you want to send the produced PostScript file directly to a
PostScript printer, you may be obliged to add a {\tt showpage} order
at the end of the file.

\centerline{\image[width=5cm]{euro}}

\end{document}
