next up previous
Next: KNOWN BUGS & PROBLEM Up: Including postscript files Previous: Including postscript files


The psfig macro

Use of the psfig macro has been found to be the most successful at incorporating external postscript files into LaTeX documents, and at producing reasonable latex2html output.

In order to use this macro, the LaTeX document must contain the required definitions. This is most easily done by making use of the LaTeX \include command:

\include{psfig.tex}
somewhere soon after the \begin{document} command.

A copy of the psfig.tex is available from legacy.gsfc.nasa.gov via the OGIP's anonymous ftp or gopher servers. The following LaTeX code can then be used to include an external postscript file called fig1.ps in the LaTeX and html documents:

{\begin{figure}[tbh]
        \htmlimage{thumbnail=0.1}
        \centerline{
        \psfig{figure=fig1.ps,width=15cm}}
        \caption{This is the caption of the figure. 
	This particular example is actually the components of the PSPC
        {\it psf} versus off-axis angle at 0.188 keV.}
        \label{fig:fig1}
\end{figure}}
with the result shown in Figure 1.

Figure 1: This is the caption of the figure. This particular example is actually the components of the PSPC psf versus off-axis angle at 0.188 keV.
\begin{figure}\centerline{
\psfig{figure=fig1.ps,width=15cm}} \end{figure}

There are several points to note in the above example:

Firstly, it should be noted that in the LaTeX document, the placement of the 'figure' follows the normal LaTeX rules for floats. In the above example the [tbh] qualifier to the \begin{figure} commands instructs LaTeX to attempt to place the 'figure' in the following locations with the following priorities:

  1. at the top of a page (the t in [tbh]),
  2. at the bottom of a page (the b in [tbh]),
  3. right here on the current page (the h in [tbh])
  4. (if all else fails) the next available position.
As can be seen for them the inspection of the figure produced in the LaTeX document, the external postscipt file to be included (fig1.ps) is actually fairly large, and takes an entire page to be plotted along with the figure caption (at least for those funny US-sized pages). Thus the figure floats to the end of the document.

In contrast, in the latex2html version of the document, the figure (having been converted to a GIF image) is displayed exactly where it is defined in the LaTeX source code (ie in a location equivalent to h in the [tbh] qualifier).

Secondly there are many possible arguments to the \psfig command:

\psfig{file=, figure=, height=, width=, bbllx=, bblly=, bburx=, bbury=,
       rheight=, rwidth=, clip=, angle=, silent=}
where Besides the obvious figure (or file), the width, height and angle arguments are straightforward and allow novice users to satisfy most of their requirements.

Thirdly latex2html provides some control of the image size in the html version of the document via arguments to the \htmlimage command:

These are further described in the latex2html manual (see the latex2html "Home Page") For most applications, we have found the thumbnail argument to most useful since it allows small inlined images to be produced speeding up load-time, but (assuming it is big enough !) still enables users to get a feel as to what the figure contains and hence whther they wish to bother viewing the full-sized image.


next up previous
Next: KNOWN BUGS & PROBLEM Up: Including postscript files Previous: Including postscript files
Mike Corcoran 2002-02-15