[R] dev.copy(postscript,...) generates a disrupted string

Marius Hofert m_hofert at web.de
Sat Oct 24 22:09:09 CEST 2009


Dear R-Users,

I have the following problem: I would like to create a postscript file  
containing an r-plot with the string "\\vartheta" in it (reason: this  
is later converted to the TeX-string "\vartheta" and a vartheta is  
printed in the figure). In the minimal example below, the problem is  
that the created postscript file does _not_ contain the string "\\vartheta 
" as a whole, but rather the following code:
...
284.38 36.00 (\\v) 0 ta
-0.300 (ar) tb
0.480 (theta) tb gr
...
The problem is, that the program which converts the created .ps file  
to a .tex file does not understand this disrupted string. Why does the  
dev.copy(postscript,..)-command produce such an output and how can I  
prevent it from doing so? If I use a different string such as "\\v_i",  
then everything works fine and "\\v_i" appears as a whole string in  
the postscript file. So why does it not work for "\\vartheta"?

Thanks in advance,

Marius

====Code==========================================================

remove(list=objects())
library(lattice)

x=c(1,2,3)
y=c(1,4,9)

xyplot(y~x,xlab=list("\\vartheta"))
dev.copy(postscript,color=F,horizontal=F,onefile=F,file="myfile.ps")
dev.off()




More information about the R-help mailing list