[R] some questions about font

Paul Murrell p.murrell at auckland.ac.nz
Wed Jan 26 00:16:50 CET 2005


Hi


Paul Murrell wrote:
> Hi
> 
> 
> Bobai Li wrote:
> 
>>
>> Hi,
>>
>> I have been using R to create some mathematical and statistical graphs 
>> for a book manuscript, but I got some problems:
>>
>> 1)  Some web positngs said that default typeface for math expressions 
>> is italic, but in my system (R 2.01 on WinXP), the default is regular 
>> font.
>> How can I change the default to ilatic?
> 
> 
> 
> expression(italic(whatever))
> 
> 
>> 2)  When use ComputerModern font,  (i.e., 
>> family=c("CM_regular_10.afm","CM_boldx_10.afm","cmti10.afm","cmbxti10.afm","CM_symbol_10.afm") 
>> ), some accented symbols are not available. For example, 
>> "expression(hat(beta))" will produce warning message like "font 
>> metrics unknown for character 94."
> 
> 
> 
> That appears to be a bug (that requires changes to the PostScript device 
> driver).  A nastyish workaround for hat(beta) is widehat(beta), but I 
> suspect there are other problems that this will not solve.


Some good news and some bad news.

The good news is that this can be worked around fairly simply (i.e., 
without installing a new version of R) as follows:
(i) make a copy of $R_HOME/library/grDevices/afm/ISOLatin1.enc (or 
possibly $R_HOME/afm/ISOLatin1.enc, depending on your R version) and 
call the copy CMISOLatin1.enc.  Modify CMISOLatin1.enc so that the 
second line starts with CMISOLatin1Encoding (rather than 
ISOLatin1Encoding) and (further down the file) change \asciicircum to 
\circumflex and \asciitilde to \tilde.
(ii) when opening your PostScript device, as well as specifying the 
family argument as you do above, specify encoding="CMISOLatin1".

The bad news is that R does not position the accents as well as LaTeX 
does it (e.g., a hat is not located above a beta in quite the same place).

Do you know about PSfrag ...?

Paul
-- 
Dr Paul Murrell
Department of Statistics
The University of Auckland
Private Bag 92019
Auckland
New Zealand
64 9 3737599 x85392
paul at stat.auckland.ac.nz
http://www.stat.auckland.ac.nz/~paul/




More information about the R-help mailing list