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

Barry Rowlingson b.rowlingson at lancaster.ac.uk
Sat Oct 24 22:28:04 CEST 2009


On Sat, Oct 24, 2009 at 9:09 PM, Marius Hofert <m_hofert at web.de> wrote:
> 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"?

 Because postscript() doesn't know what you want to do with \vartheta,
and thinks you want to typeset the text itself. So it very cleverly
adjusts the spacing between the letters to look nice - this is called
'kerning'. This means the text has to be set by postscript in several
parts.

 You can do greek characters in plots - see help(plotmath).

Barry




More information about the R-help mailing list