[tex-eplain] Inserting TeX in Xfig

Dean S. Messing deanm at sharplabs.com
Fri Nov 21 02:48:31 CET 2003


Not sure if you are using TeX or LaTeX.  I'm currently writing a paper
with lot's of maths in figures.  Here's how I do it.  (There must be
better ways but this works for me.)

On the Xfig side (I'm using version 3.2 patchlevel 4)

1) Open xfig. Hit the "T" for text entry.
2) Click the "Text Flags" button near the font size button at bottom.
3) Set Special Flags to "Special"
4) Now just type in the labels you want where you want them, putting
    $...$ around the maths.

On the LaTeX side this is what I have.
Note that many of my figures are .eps figures with no TeX in them.
So I first show how I do that. (You will see why.)

Also I'm using an IEEE pre-defined style file called spconf
(signal processing conference).  This gives me the two-column format
that the conference requires.  I don't think it is very relevant to
the figures though.
     
1) \usepackage{epsfig ,color} near top.
2) Here's an example block for a .eps figure (also made with Xfig):

\begin{figure}[htb]
\begin{minipage}[b]{1\linewidth}
  \centering
  \centerline{\epsfig{figure=UrFigure.eps,width=1.0\linewidth}}
  \caption[caption]{UrCaption}
  \label{UrLabel}
\end{minipage}
\end{figure}

The figure is UrFigure.eps. Its  width is controlled with
width=1.0\linewidth.  I just change 1.0 to, say, 0.75 to get
a smaller figure.

To do figures with TeX in them, I export "Combined PS/LaTeX (both
parts)" in the export menu of Xfig, instead of exporting EPS.

This generates two files.  For "UrFigure.fig" I'll get
"UrFigure.pstex" and "UrFigure.pstex_t".
I now delete the \centerline{...} line above and substitute:

  \input{UrFigure.pstex_t}

"latex" and "dvips" it and out comes nice figures with beautiful TeX
Mathematics in them!  You don't need to use the "latex" fonts in
Xfig either.   The other fonts seem to work.

One problem with this is that the scale of the figure must be adjusted
via the "Magnification" in the Xfig Export menu.  But I have a way to
make this efficient. I get a "gv UrPaper.ps&" running and displayed on
screen. I have gv setup to auto-update when the underlying file is updated.

I also have "xfig UrFigure.fig&" running in a window.
I do my LaTeX-ing in Emacs so I have UrPaper.tex open in Emacs.
I simply bring up the Export Menu in Xfig, quickly adjust the Magnification,
and re-export the fig.

Then I hit a key-stroke in Emacs which re-compiles the LateX and
regenerates the .ps.  I can make a change in size (or the text of the
paper, for that matter) and see the result in under 3-5 seconds.
Pretty close to WYSIWYG.

Hope that helps.

Dean


 ::     Is there an easy way to incorporate TeX source text (in math mode) 
 ::     in an Xfig figure, for the purpose of labelling arrows etc.?
 :: 
 :: I googled for  xfig tex label  and found:
 :: http://hilbert.math.albany.edu:8800/hm/emj/1996/msg00123.html
 :: 
 :: Another link, which talks about latex but does not seem to be too deeply
 :: wedded to it:
 :: http://www.cs.sfu.ca/~rbenkocz/personal/xfig/mathxfig.html
 :: 
 :: The faq answer mentions the psfrag latex package, which could perhaps be
 :: adapted:
 :: http://www.tex.ac.uk/cgi-bin/texfaq2html?label=labelfig
 :: 
 :: Unfortunately I don't see an easy answer that "just works".  From what I
 :: gather, some people are producing figures in MetaPOST or Metafont, which
 :: have better support for labels.  I wonder if there is something like
 :: pstricks for plain TeX.
 :: 
 :: Anyway, if none of these satisfy, you might write to texhax at tug.org or
 :: comp.text.tex, since those will reach many more people.  Be sure to
 :: mention what you've tried and why it's insufficient :).
 :: 
 :: Hope this helps (a little),
 :: karl


                         Dean S. Messing
                         Display Algorithms & Visual Optimization Lab
                         Information Systems Technologies Dept.
                         Sharp Laboratories of America
                 E-Mail: deanm at sharplabs.com


More information about the tex-eplain mailing list