Embedding Graphics Files in LaTeX Documents

We strongly recommend the use of Version 1.10 of the psfig.sty file for including graphics in LaTeX text. It is easier to use than the epsf.sty package, and will serve for most necessary applications. The version of psfig.sty we use in processing the files can be found here. We recommend you download and use this version to ensure that your proposal is processed correctly (if you really want to use epsf.sty, use this version). You should use psfig in normal text mode. Using it in an environment (e.g. figure, center etc) will not work correctly (though see below for a more complex use of psfig).

The psfig command takes several parameters, most of which are optional. Full documentation can be found in the preamble in the file itself. The most important are indicated in the sample command below.

\psfig{file=fig.ps,angle=90,width=5in}

This will load a file called fig.ps, rotate it by 90 degrees and scale it to be 5 inches wide. There is a similar height command. If you use both, you may scale the figure anamorphically. This usage will take the file as it would appear to you in something like ghostview and include it. Any blank white space around the margins that are in the original are included here too.

To remove such extra material, you should specify the bounding box of the figure. The bounding box gives the co-ordinates of the lower left and upper right corners of your figure in device independent units. You may also need to specify a bounding box if LaTeX can't find the box dimensions in the file itself (this sometimes happens for files generated in slightly non-standard packages for example). The easiest way to find the bounding box is to use a package such as ghostview to view your figure. This includes a running cursor. You can use this to determine the co-ordinates of the lower left and upper right corners of your figure.

Once you've determined the required co-ordinates, the box can be specified in the psfig command as follows:

\psfig{file=fig.ps,width=5in,bbllx=10pt,bblly=30pt,bburx=500pt,bbury=600pt}

The options here are bbllx, bblly, bburx, bbury and refer to the lower left x, lower left y, upper right x and upperright y co-ordinates respectively. Here the lower left corner is at (10,30), the upper right at (500,600). Note that LaTeX insists numerical quantities must have a specified unit. This can be anything but it must be there. The unit itself is ignored by psfig.

Lastly, if there is material outside the bounding box you specify it will still be printed unless you also add the following clip option:

\psfig{file=fig.ps,width=5in,bbllx=10pt,bblly=30pt,bburx=500pt,bbury=600pt,clip=}

Clip takes no arguments, but must have the = sign present

If you need to move the figure from where Latex places it by default use \vspace*{} and \hspace*{} commands. Remember that you can use negative arguments to these to move the figure back up the page.

Note that you do not need to enclose the file name in quotes - they are unnecessary, and may result in the submitted proposal printing without any figures!

Lastly, you can use psfig in a more complex fashion by placing the psfig command within a minipage environment. The following for example will place two figures side by side on the page with 1 inch of space between them.

\begin{minipage}{3in}
\psfig{file=fig.ps,width=3in}
\end{minipage} 
\hspace*{1in}
\begin{minipage}{3in}
\psfig{file=fig.ps,width=3in}
\end{minipage}

Note if you leave a blank line between the first end and second \begin{minipage} you will get the figures separated vertically too. Also the sum of the two minipages and the horizontal spacing given by the hspace shouldn't exceed the textwidth to make this work correctly. You can also use this to write text alongside the figure by placing text in the second minipage. By placing the psfig command in a minipage you can then also use a center environment to place it on the page as follows:

\begin{center}
\begin{minipage}{3in}
\psfig{file=fig.ps,width=3in}
\end{minipage}
\end{center}

You should still avoid using the figure environment if you want to avoid difficulties. Please do not include one or more \psfig commands within a centerline or tabular environment, as this may result in your figure(s) not appearing at all in the uploaded version. Use the minipage environment instead, as shown above (but avoid putting more than one \psfig per minipage).

Examples of all of these uses of psfig can be found in the
example Latex file. You will also need the example PostScript figure.

The results of the example Latex file can also be found in these four jpeg images. The commands are shown on the figures. Sorry the quality of these figures isn't great due to the conversion from PostScript to jpeg.

Return to "Submitting an AATAC application".


©Anglo-Australian Observatory, PO Box 296, Epping NSW 1710, Australia


Last modified by: Stuart Ryder, aatac -@- aao.gov.au
Last modification date: 1 June 2006
Original author: Stuart Lumsden