[R] Graphics and LaTeX documents with the same font

Frank E Harrell Jr f.harrell at vanderbilt.edu
Fri Sep 28 16:56:31 CEST 2007


Paul Smith wrote:
> On 9/28/07, Prof Brian Ripley <ripley at stats.ox.ac.uk> wrote:
>>> I know how to export graphics as pdf files and then how to include
>>> them in LaTeX documents. However, I do not know how to do in order to
>>> have the text of the graphics written with the font selected for the
>>> LaTeX document. Is that possible?
>> Well, it depends on what that font is.  But if it is TeX font,
>> see the section called 'TeX fonts' in ?postscript and the detailed
>> description in the article in R-news 6/2 by Paul Murrell and myself.
>>
>> If it is an Adobe Type1 font such as Times New Roman, just specify an
>> appropriate family in the pdf() call.
>>
>> Dietrich Trenkler wrote:
>>
>>> maybe you will find the psfrag package useful.
>> I doubt it will be even usable with PDF (there are pdfrack and Xfigfrag,
>> though), and with postscript it is at best a kludge as R does its own
>> micro-positioning of text based on the font metrics.
> 
> Thanks to both. PSTricks
> 
> http://en.wikipedia.org/wiki/PSTricks
> 
> draws figures that, when inserted in a LaTeX document, their font
> matches the one selected for the LaTeX document. If I may, I would
> like to submit to your consideration the suggestion of implementing
> the exportation of R graphics to PSTricks.
> 
> Paul

See http://biostat.mc.vanderbilt.edu/PsFrag for a way to semi-automate 
the process.

Frank

-- 
Frank E Harrell Jr   Professor and Chair           School of Medicine
                      Department of Biostatistics   Vanderbilt University



More information about the R-help mailing list