[R] Font settings in xfig
Kevin E. Thorpe
kevin.thorpe at utoronto.ca
Fri May 16 15:09:03 CEST 2008
Scionforbai wrote:
>> 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
> (http://www.xfig.org/userman/fig-format.html), 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 :
>
> \documentclass{article}
> \usepackage{epsfig}
> \usepackage{color} %(note: you might not might not need to do this)
> \begin{document}
> \pagestyle{empty}
> \input{FILE.pstex_t}
> \end{document}
>
> 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
>
I asked because I have found the plotmath capabilities in R to be
sufficient for LaTeXish text on plots. Then there are no
intermediate steps. It didn't seem that from the OP that
anything incredibly complex was being attempted.
--
Kevin E. Thorpe
Biostatistician/Trialist, Knowledge Translation Program
Assistant Professor, Department of Public Health Sciences
Faculty of Medicine, University of Toronto
email: kevin.thorpe at utoronto.ca Tel: 416.864.5776 Fax: 416.864.6057
More information about the R-help
mailing list