[Rd] Changing ComputerModern in postscript(...): A first attempt at contributing....

Mark Van De Vyver mvdv at spamcop.net
Tue Mar 16 06:41:43 MET 2004

First off, thanks to all the various R developers, your package is very

I'm not sure what the protocols are for contributing, and I've not done this
before, so please excuse nay obvious errors or oversights...  Also I'm by no
means an R,TeX/LaTeX, or typesetting expert, I have largely stumbled my way
to this point.

Objective: I'd like to get R postscript(...) to generate output that has the
TeX italic font when I use italic(...) in an R graphic.  

I found out that the R postscript(..font="ComputerModern") outputs slanted
text when the R function italic(..) is used in a graphic.  I think the text
should use the italic font.
For a quick overview of italic vs. slant vs. oblique see

A response from Brian Ripley pointed me to the src/main/devPS.c file, and I
traced this behaviour to the use of the slanted/oblique afm font files,
rather than the italic afm font files.  Anyway, I did some homework and
realised that making the change may not be too difficult, except for needing
the Computer Modern afm font files - not included in MikTeX (on my machine
at least).  Fortunately the Latin Modern fonts do include the afm files and
are supposed to be an improvement over Computer Modern, so I thought to make
both changes; update/replace Computer Modern with Latin Modern, and change
the font used when italic text is output.

I read on one OpenSource project that they prefer patches generated from
"diff -u4".  I couldn't see explicit instructions on the R web site so I've
attached a "diff -u4" file.

Adopting this patch would require adding the following Latin Modern afm font
files to the R afm fonts folder:

These fonts are available in the Latin Modern Fonts package.  To find out
about Latin Modern see
Note, I had to leave the CM_symbol_10 file since I'm not sure that there is
a Latin Modern replacement?

Unfortunately I wasn't able to build R using Cygwin (configure works OK but
make fails), so I have not been able to test the changes.  I'll keep looking
into getting R to build, but in the mean time I thought someone may be
interested in the changes?
I think the change I made means that font="ComputerModern" still works but
outputs Latin Modern fonts and this is misleading, so perhaps drop
"ComputerModern" in favour of "LatinModern" and/or obtain Computer Modern
italic afm font files and update CM_italic_10.afm and
CM_boldx_italic_10.afm.  I'm not a font pro but it seems that converting
between different font files is not so straight forward, but the Computer
Modern italic afm files may be available to someone?

Mark Van De Vyver
B.Bus(Hons), PhD(Dist)
Finance Discipline
School of Business
Faculty of Economics and Business
Economics & Business Building H69
The University of Sydney  
Sydney  NSW  2006  Australia
Telephone: +61 2 9351-6452
Fax: +61 2 9351-6461
Mobile: 0428 281407

mailto:mvdv at spamcop.net

More information about the R-devel mailing list