Using
Latex Formulas inside xfig figures
by Rémy Malgouyres
Cette page existe en français
Contents
1) Special text in xfig
2) Export to generate pstex and generate eps
3) A script for automatization
1) Special text in
xfig
To include latex formulas in figures made with xfig, we use the
pstex format. It is a combined format
with two file, a latex file, with extension .pstex_t, with inside it a
latex picture
(picture environment of latex), which includes another file, which is
an eps file with
extension pstex by using epsfig or includegraphics (use the epsfig or
graphics
package accordingly)
To do this, we write some text in xfig, setting a text flag (text
options). We have to set
the special flag to special. This text will be classical latex code,
with some $ { \ etc.
Don't pay attention to the aspect of the text, it will be compiled when
including
the pstex_t file in latex.
2) Export to
generate pstex
Then, in xfig, we export choosing the "combined PS latex" format, which
generates two
files,
the pstex and the pstex_t.
To include the image in a latex document fichier.tex,
we can type for instance :
\input{myfile.pstex_t}
Then we generate postscript using dvips.
$ latex fichier.tex
$ dvips -E -o fichier.eps fichier.dvi
This technique is a bit tedious when you want to
use many figures, you have to make many operations
for each figure.
3) A script which
I find more convenient
I had made for myself a script my_fig2eps
which works well
You just save the .fig inside xfig and in the console you type
$ my_fig2eps myfile.fig
This generates directly an epsfile with the figure and the latex
formulas compiled in it
(we can then include the eps file into latex with epsfig).
Warning : the script uses a
temporary file myfile.tex. Do not name your
latex document by the same name as the xfig figure or it would be
erased !
I realised recently that there was a fig2eps
project which made several format conversions
and seems to work well. It looks cleaner that my little script !