Re: [R] Font settings in xfig

From: Scionforbai <>
Date: Fri, 16 May 2008 14:56:57 +0200

> Is there a reason you are going through this route to get figures > into LaTeX instead of using postscript (or PDF for pdflatex)?

To have LaTeX-formatted text printed onto your pdf figures, to include in LaTeX documents.

R cannot output 'special' text in xfig. You need to post-process the .fig file, according to the fig format
(, replacing, on lines starting with '4', the correct values for font and font_flags. Using awk (assuming you work on Linux) this is straightforward :

awk '$1==4{$6=0;$9=2}{print}' R_FILE.fig > OUT.fig

Then, in order to obtain a pdf figure with LaTeX-formatted text, you need a simple driver.tex:

driver.tex :

\usepackage{color} %(note: you might not might not need to do this)

Now you can go through the compilation:

fig2dev -L pstex OUT.fig > OUT.pstex
fig2dev -L pstex_t -p OUT.pstex OUT.fig > OUT.pstex_t sed s/FILE/"OUT"/ driver.tex > ./OUT.tex latex OUT.tex
dvips -E OUT.dvi -o OUT.eps
epstopdf OUT.eps

Of course you need R to write the correct Latex math strings (like $\sigma^2$). Hope this helps,

scionforbai mailing list PLEASE do read the posting guide and provide commented, minimal, self-contained, reproducible code. Received on Fri 16 May 2008 - 13:01:01 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Fri 16 May 2008 - 17:30:37 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.

list of date sections of archive