Using Xfig and LaTeX together

i) Start xfig with this command:

xfig -specialtext -latexfonts -startlatexFont default &

ii) Draw a diagram -or- Import a picture into xfig.

xfig prefers to import .eps files. Use ps2epsi to convert .ps files to .epsi files (.epsi files are simply .eps files which include a 'preview'). Use xv or some other paint program to convert bitmaps to postscript.

iii) Use the 'T' button to enter LaTeX text as you normally would in a .tex file right on to your picture within xfig.

iv) Create a .tex file for LaTex that starts something like this (depending on your figures you may not need these specifications):

\documentclass[12pt,bezier,amstex]{article} % include bezier curves
\usepackage{epsfig,color}

v) Export the picture (select 'Export' under the 'File" menu)

Method 1:

Export as 'LaTeX picture': This creates a file called filename.latex. Insert this snippet into your .tex file

\begin{figure}[h]
\begin{center}
\input{filename.latex}
\caption{caption here}
\label{figure:example}
\end{center}
\end{figure}

Compile your .tex as usual. This works for most line drawings created in xfig.

Method 2:

Export as 'Combined PS/LaTeX (both parts)': This creates two files, filename.pstex and filename.pstex_t. Insert this snippet into your .tex file

\begin{figure}[h]
\begin{center}
\input{filename.pstex_t} %the difference is just this part
\caption{caption here}
\label{figure:example}
\end{center}
\end{figure}

Compile your .tex as usual. This will work for more complicated drawings. (note: you don't need to specify the .pstex filename, that is already contained in the .pstex_t file).

Example (see here 22kb .pdf)

The first example was done with Method 2. Method 1, used for the second example fails to capture the fill used in the box.