[Rd] Graphics device hook to manipulate plotmath

Paul Murrell p.murrell at auckland.ac.nz
Sun Dec 11 22:17:50 CET 2011


On 7/12/2011 9:34 a.m., Zack Weinberg wrote:
> Is there a hook that allows a graphics device to apply transformations
> to plotmath expressions *before* they are rendered?  If there isn't
> one yet, would it be feasible to add one?

No such hook exists.  Plotmath expression get split off before the 
graphics engine (in 'graphics' and 'grid').

One possibility might be to add a device flag that says the device wants 
to handle plotmath, plus a new device call, DEV_math() say, so that 
'graphics' and 'grid' can send plotmath unaltered to the device.  But 
there are likely to be complications.  For example, both 'graphics' and 
'grid' can ask for metric information about text, so there would be more 
work to ensure that metric information corresponded to what the device 
would draw for plotmath expressions.


> The motivation for this hook is graphic devices that feed into
> something that already has support for math layout, such as the
> tikzDevice package (which has TeX downstream). Given
>      text(x, y, expression(alpha+beta+gamma+delta))
> it would be ideal (in terms of output quality) if tikzDevice could
> process that as if
>     text(x, y, "$\\alpha+\\beta+\\gamma+\\delta$")
> had been written instead.  This would also be easier to *implement*,
> from the device side, than a back-conversion from Adobe-Symbol glyph
> requests to TeX math symbol macros.
> (Users of tikzDevice can of course write all their TeX math
> expressions directly, but this may be a great deal of conversion work,
> and is also inconvenient for someone tweaking their plots in one of
> the interactive graphics devices before saving them permanently.)
> Thanks in advance,
> zw
> p.s. I am not subscribed to this list, please cc: me on replies.
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel

Dr Paul Murrell
Department of Statistics
The University of Auckland
Private Bag 92019
New Zealand
64 9 3737599 x85392
paul at stat.auckland.ac.nz

More information about the R-devel mailing list