# Re: [Rd] Graphics device hook to manipulate plotmath

From: Paul Murrell <p.murrell_at_auckland.ac.nz>
Date: Mon, 12 Dec 2011 10:17:50 +1300

Hi

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.

Paul

> 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.)
>
> 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
Auckland
New Zealand
64 9 3737599 x85392
paul_at_stat.auckland.ac.nz
http://www.stat.auckland.ac.nz/~paul/

______________________________________________
R-devel_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel

Received on Sun 11 Dec 2011 - 21:20:50 GMT

This quarter's messages: by month, or sorted: [ by date ] [ by thread ] [ by subject ] [ by author ]

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Sun 11 Dec 2011 - 21:30:17 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-devel. Please read the posting guide before posting to the list.