Dear Paul,
Thank you for your help!
1. I know how to use "expression(italic(whatever))", but I don't know how to make "expression(whatever)" to produce italic font.
2. With regard to the CM font, I guess psfrag may be to best way to get around the problem. Indeed, I have been using psfrag since I am also using LaTeX. My only complaint is that I have yet to find out an easy way to export the modified graph back to the EPS format (to be used in other documents). I know how to do it the hard way, but here I am talking about handling some 100 graphic files (It would be more efficient to have a R file to create all graphic files with psfrag tags and a latex file to replace the tags and export individual graphs to EPS; and it would be ideal if the latex file can also be generated automatically from R)
3. If you don't mind, I would like ask another question: how to write a function f(x) to define--- x <<- "x"
Many thanks for your help!
Bobai
Paul Murrell wrote:
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
______________________________________________ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html