next up previous
Next: Sources of figures Up: Psfig/TeX 1.10 Users Guide Previous: Introduction

Simple figures

To include a PostScript figure with psfig, include the psfig style at the top of your document:

\documentstyle[psfig,...]{article}
and then, when you wish to include a figure, invoke the macro
\psfig{figure= input}
where input is the name of a PostScript file. Psfig will automatically position the figure at the current point on the page, and reserve the proper amount of space in TeX so that it doesn't block any other objects on the page. For example, if we have a file called `piechart.ps' which contains the PostScript code to draw the chart in the introduction, we could use the commands
\par
\centerline{\psfig{figure=piechart.ps}}
\par
to include it as a centered paragraph. Since no mention of size was made in the above example, psfig draws the figure at its natural size (as if it was printed directly on a PostScript printer.) The pie's natural size is several inches across, which is a little large; the pie in the introduction was produced with:
\centerline{\psfig{figure=piechart.ps,height=1.5in}}
The height option specifies how tall the figure should be on the page. Since no width was specified, the figure was scaled equally in both dimensions. (This will also happen with a width but no height option.) By listing both a height and width, figures can be scaled disproportionately, with interesting results:

This figure was produced with:

\centerline{\hbox{
\psfig{figure=rosette.ps,height=.8in,width=.15in}
\psfig{figure=rosette.ps,height=.8in,width=.35in}
\psfig{figure=rosette.ps,height=.8in}
\psfig{figure=rosette.ps,height=.8in,width=1.2in}
\psfig{figure=rosette.ps,height=.8in,width=1.5in}
}}
The \psfig macro is (unfortunately) sensitive to whitespace, and will be confused by any extra spaces or newlines in its argument.


service@gate.sinica.edu.tw