With the help of Dr. Paul Murrell, I seem to have solved 90% of the problem. Cheers!
Actually I’ve never noticed the problem of drawing Chinese characters in a pdf/postscript device until Sizhe LIU brought forward a solution using the package pictex of MiKTex. I even didn’t know such a problem existed then because rarely have I used Chinese texts in R graphics.
In order to use (simplified) Chinese characters in pdf/postscript devices of R graphics system, we need to specify the argument “family” in the function pdf() or postscript(). For instance,
pdf("d:/cn.pdf", family = "GB1")
plot(1, main = "你好") # use Chinese characters in the main title
dev.off()
postscript("d:/cn.ps", family = "GB1")
plot(1, main = "你好")
dev.off()
Usually there’ll be no problem with pdf files, but it’s a little more complicated for postscript files. If we want to view the ps file normally, the next step is to edit a ghostscript file named “cidfmap” which exists in a directory like C:\Program Files\CTeX\gs\gs8.51\lib\. A line /BousungEG-Light-GB << /FileType /TrueType /Path(C:/Windows/Fonts/gbsn00lp.ttf) /SubfontID 0 /CSI [(GB1) 2] >> ; should be appended to that file in order that ghostscript knows how to find the font BousungEG-Light-GB, which needs to be downloaded and installed from ftp://ftp.gnu.org/pub/non-gnu/chinese-fonts-truetype/ beforehand. After all these work has been done, we can view the ps file using ghostscript now.
Besides, if we want to include such eps files (for R there’s no difference between eps and ps) in a LATEX document, there’s nothing different with the case when we use English graphics except that the dvi files seem to be abnormal. However, we can first compile the document to dvi, then ps, then pdf.
I’m indeed grateful to Dr. Paul Murrell for his great help.
赞赏
作为一名没有固定工作的自由职业者,我非常感谢您通过捐赠的方式来支持我的写作和开源软件开发。当然,捐赠纯属自愿。无论金额多少,都是一片诚挚的心意。支付方式如下:
| 微信 | ← 奋力支开它俩 → | 支付宝 |
|---|---|---|
![]() |
其它爱心通道 ↓ Venmo: @yihui_xie Zelle: xie@yihui.name PayPal: xie@yihui.name |
![]() |
若使用 Venmo/Zelle/Paypal,请添加备注“gift”或“donation”,以免捐赠被视为我的可税收入。若使用 Paypal,支付类型请选 Family and Friends,而不要选 Goods and Services。
在不影响生活的前提下,我会将收到的捐赠以尽量大的比例回馈给开源社区和慈善机构。作为参考,2024-25 年间我共收到约三万美元捐赠,完税后我转手捐出了一万五千美元。

