Xfig

From CUC3
Revision as of 13:13, 14 July 2008 by import>Jg525
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

LaTeX fonts in Xfig figures

Xfig supports LaTex fonts. Fig files are thus a convenient intermediate file format when generating figures for LaTeX documents.

Manual modification of fig files

To use LaTex fonts in Xfig:

Start Xfig.
Select the text tool and on the bottom toolbar choose LaTeX fonts.
Set the "special" text mode.
Enter text. Be sure to use $...$ to denote math symbols.
Compound/group all components of the figure.
Save as filename.fig.

Scripts with fig output

The textspecial mode can also be set in gnuplot scripts

#!/usr/bin/gnuplot -persist
# gnuplot script snippet
set terminal fig color textspecial
set output "filename.fig"
set ylabel "$\\text{y}}$, $y$";
set xlabel "x, $x$";

and in Octave scripts

#!/usr/bin/octave -qf
# octave script snippet
filename = ["filename.fig"];
ylabel("$\\text{y}}$, $y$");
xlabel("x, $x$");
print(filename,'-color','-textspecial');

Note the additional "\" in the LaTeX markup.

Conversion to eps and pdf

To convert fig files to eps and pdf files you will need fig2eps and epstopdf.

At the command line, run fig2eps filename.fig to create an eps file of your graphic.

Run fig2eps filename.fig and then epstopdf filename.eps to create a pdf.

Document preparation

To include a graphic in a LaTeX (or pdfLaTeX document), add
\includegraphics{/.../filename}
to your document and run latex filename.tex (or pdflatex filename.tex) at the command line. Note that no file extension is needed.