Dan Hatton
2007-Sep-24 21:52 UTC
[R] PicTeX output: how to suppress escaping of $ signs and braces?
Dear All, I'm trying to draw a TeX histogram with the following pair of commands, pictex(file = "realhisto.tex") hist(Peaklist$V3,xlab="Height $z/\\ut{mm}$",ylab="Probability density $\\phi{}(z-z_0)/(1/\\ut{mm})$") However, in the resulting file realhisto.tex, I get, for example \put {Height \$z/\ut\{mm\}\$} [lB] <0.00pt,0.00pt> at 136.13 9.17 when what I'd like is \put {Height $z/\ut{mm}$} [lB] <0.00pt,0.00pt> at 136.13 9.17 i.e. the $ signs and braces not to be escaped with backslashes. I've tried a couple of things that "help(Quotes)" hints at, like replacing the double quotes with single quotes or backticks, or explicitly escaping the $ signs with backslashes, but none of these things seem to help. Any ideas, please? -- Thanks very much Dan Hatton <http://www.bib.hatton.btinternet.co.uk/dan/>
Prof Brian Ripley
2007-Sep-25 06:39 UTC
[R] PicTeX output: how to suppress escaping of $ signs and braces?
R is trying to do device-independent graphics and produce the same annotation output on any graphics device. It assumes that when you write '$' you want a dollar sign, and so on. Also, it needs to be able to render the text to find its bounding box (and baseline) and so place it accurately. The necessary escaping is done in C in the pictex() device, and it is not optional. You would need to make a modified version of the pictex() device to alter this, but you would still have the problem that the precise placement is done at a much higher level in code common to all devices. On Mon, 24 Sep 2007, Dan Hatton wrote:> > Dear All, > > I'm trying to draw a TeX histogram with the following pair of commands, > > pictex(file = "realhisto.tex") > hist(Peaklist$V3,xlab="Height $z/\\ut{mm}$",ylab="Probability density $\\phi{}(z-z_0)/(1/\\ut{mm})$") > > However, in the resulting file realhisto.tex, I get, for example > > \put {Height \$z/\ut\{mm\}\$} [lB] <0.00pt,0.00pt> at 136.13 9.17 > > when what I'd like is > > \put {Height $z/\ut{mm}$} [lB] <0.00pt,0.00pt> at 136.13 9.17 > > i.e. the $ signs and braces not to be escaped with backslashes. > > I've tried a couple of things that "help(Quotes)" hints at, like > replacing the double quotes with single quotes or backticks, or > explicitly escaping the $ signs with backslashes, but none of these > things seem to help. > > Any ideas, please? > >-- Brian D. Ripley, ripley at stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595