Archive for the ‘Graphics’ Category

Xfig and PDFLaTeX (or LaTeX)

August 22, 2008

Although the GUI for Xfig is a little outdated, in my opinion it is the best software to use for academic vector-based diagrams. It allows the use of LaTeX equations in conjunction with the figure.

Screenshot of Xfig in action!

Screenshot of Xfig in action!

What I prefer is to make a .pdf of the figure through pdflatex and then include the image to the document of interest. The directions parallel the following website:

http://graphics.stanford.edu/lab/howto/xfig_latex.html

When adding LaTeX expressions to a figure use the $…$ to switch to math mode when necessary. Make sure you set the flag on the text to “Special Text” using the “Text Flags” menu on the bottom. Then export the figure from Xfig using the “Combined PS LaTeX (PS and LaTeX part)” to the default name.

Create a driver file (e.g., this case my default export name was fig1 thus I use fig1.tex) containing something like:

\documentclass{article}
\usepackage{epsfig}
\usepackage{color}
\setlength{\textwidth}{100cm}
\setlength{\textheight}{100cm}
\begin{document}
\pagestyle{empty}
\input{fig1.pstex_t}
\end{document}

Then run:

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

Note that you can change the name “fig1.eps” to anything that you want. I have included the driver file in the path ~\Work\TEX\driver\fig1.tex. There is something wrong with my version the Xfig export so when you export just export it to the name that the file is saved as (e.g. do not enter a new filename). Then change the driver file appropriately.

Some key notes about using Xfig.

  1. It’s always tough to figure out what scale you should draw these things on especially since the units on the border don’t mean all that much. My rule of thumb is to put down an arrow using the “polyline” function and then judge your sizes from then on.
  2. I find it impossible to pan side to side, this will get all your nerves. Zooming in and out is a pain too.
  3. Get a mouse. The middle mouse click is so useful.
  4. Xfig does not make good “3D” drawings (to my knowledge). Does anyone know an alternative?
Example of what you can do with Xfig! This is a diagram I made for my research.

Example of what you can do with Xfig! This is a diagram I made for my research.