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):
-
If you use plain latex + dvipsi, then do the following.
- Copy the /bin/sh shell script (text file) called fig2eps
(which I made up) into a directory (such as ~/bin) in your search path,
where you put executable files.
Name the file fig2eps.
- Ensure fig2eps is executable via the UNIX command
chmod u+x fig2eps.
- The script relies on the following programs which are commonly
found in UNIX (or LINUX, MAC OSX) setups:
fig2dev, latex, dvips and ps2eps.
You might need to install them, or modify
the script if your instillation uses alternative, equivalent, programs.
-
If you use pdflatexi, then do the following.
- Copy the /bin/sh shell script (text file) called fig2pdf
(which I made up) into a directory (such as ~/bin) in your search path,
where you put executable files.
Name the file fig2pdf.
- Ensure fig2eps is executable via the UNIX command
chmod u+x fig2pdf.
- The script relies on the following programs which are commonly
found in UNIX (or LINUX, MAC OSX) setups:
fig2dev, latex, dvips, ps2eps, and eps2pdf.
You might need to install them, or modify
the script if your instillation uses alternative, equivalent, programs.
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.
Disclaimer
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)