# How to use Latex formulas with xfig

This document is shamelessly copy-pasted from http://web.math.auc.dk/~dethlef/Links/latex_figures.html......

Inside xfig, add the LaTeX expressions to the figure, using $...$ to switch to math-mode where necessary. Use the normal method in xfig for adding text, but set the "special text" mode using the "Text flags" menu at the bottom of the screen.

Export the figure from xfig twice: firstly using the format "Combined PS/LaTeX (PS part)" to a file such as fig1.pstex, secondly using "Combined PS/LaTeX (LaTeX part)" to a file such as fig1.pstex_t.

Create a driver file (e.g., fig1.tex) containing something like:

\documentclass{article}
\usepackage{epsfig}
\usepackage{color} (note: you might not might not need to do this)
\setlength{\textwidth}{100cm}
\setlength{\textheight}{100cm}
\begin{document}
\pagestyle{empty}
\input{fig1.pstex_t}
\end{document}


Run the commands:

latex fig1.tex
dvips -E fig1.dvi -o fig1.eps


You should now have a file named "fig1.eps" which can be included (with scaling and rotation if desired) in other LaTeX documents.

Note that there is a problem in old versions of dvips (pre 1997) in that the BoundingBox in the "fig1.eps" file only takes account of latex output, not the included figure.

Li-Yi Wei