Putting LaTeX into Xfig figures

Thousands of people, particularly those using UNIX (or LINUX or MAC OS X) computers, use the Xfig program to produce diagrams to be included in their LaTeX documents. Frequently, one needs to put mathematical symbols or expressions in their diagrams. Instructions found on the internet are often vague on how to do this. Here is an easy solution, which I make available to you. Please send me a "thank you" email if this solution has proved helpful, or send me any suggestions or comments.

NOTICE: A much fancier and robust version of this may now be available at Sourceforge. It is called fig2ps.

How to set it up (do this only once):

  1. If you use plain latex + dvipsi, then do the following.
  2. If you use pdflatexi, then do the following.

How to make diagram:

How to place diagram into LaTeX document:

Problems I have seen

Side Effects

The fig2eps script creates a few temporary files in your /tmp/ directory, and reports what it is doing in the command window. The script normally deletes these temporary files during cleanup. If the script fails and the cleanup does not proceed, then do not worry. The /tmp/ directory is wiped out each time you reboot a UNIX machine.


The usual disclaimers hold, as detailed in the file fig2eps. You may have to slightly modify the file, such as the location of your temporary directory, and program names. You may have to install some of the programs such as eps2pdf (using, for example, Macports on a Mac) The script is not terribly robust against program errors etc (volunteers?). Have fun with it!

Modified: 2012.12.15 by goddyn@sfu.ca (Luis Goddyn)