Notes on xfig

update 2004-DEC-13

Due to bugs in xfig you need to run the command to generate postscript files on the command line instead of from within xfig. Use command:

fig2dev -Leps  filename.fig  filename.eps

In 1996, we moved from Xfig.2.1.8/transfig.2.1.8 to xfig.3.1.4/transfig.3.1.2. The change requires a different way to include figures in your LaTeX files. For a unknown reason, no instructions as how to do this is documented anywhere in the package. The following was what I found after a test run.

There are two ways to do it.

The first way

When you use xfig to create a figure, you can export (using the manual button 'export') the figure to one of several file formats (or language formats, if you wish). For most people, the default .eps file will be fine. (Of course, you would also save the file in .fig file using the manual button 'file'.)

In your latex file, you can either have 1. \documentstyle[epsf]{article} (if you use latex209) 2. \usepackage{epsf} (if you use latex2e) 3. \input{epsf}

and at wherever you want the figure, say foo.fig, use the following structure:

\begin{figure}
\centerline{\epsfbox{foo.eps}}
\caption{A figure}
\end{figure}

This works fine until you need to place mathematics formula in the figure. In that case you would like to use the second method.

The second way

Start xfig using xfig -sp

Just save the figure in a .fig file, say foo.fig. Then run transfig using

transfig -L pstex foo.fig
make

In your latex file, do any of the following

  1. \documentstyle[epsfig]{article} (if you use latex209)
  2. \usepackage{epsfig} (if you use latex2e)

and at the place where you want the figure do

\begin{figure}
\begin{center}
\input{foo}
\end{center}
\caption{A figure}
\end{figure}