-
Notifications
You must be signed in to change notification settings - Fork 36
Support for plotmath #44
Comments
Just out of curiosity: why do you even want (the ugly) plotmath when you can write native (beautiful) LaTeX expressions in your plots with tikzDevice? |
I have a great many plots to convert from the stock PDF device + plotmath to tikzDevice. This is yet another hurdle. |
I can see the value of plotmath support for cases where the source code that produces a plot is difficult to change---such as plotting functions buried inside of 3rd party packages. However, achieving this would take quite a bit of work. One would need to develop a hash that mapped all the Adobe Symbol glyphs used by Right now I don't have the time to start such a project and, as Yihui mentioned, native LaTeX expressions work so much better that I don't even use However, I would be more than willing to review and merge a pull request that added this functionality. |
I'm not familiar with how this stuff works internally. Is there a |
I don't know if this is possible---one would have to work their way through the function calls, starting with
All text sent to the device is passed through a sanitization routine. This would be a good place to implement an Adobe Symbol -> LaTeX Math conversion. At the C level, there is a function call that hands the string off to some R-Level code for processing: https://github.com/Sharpie/RTikZDevice/blob/0.6.2/src/tikzDevice.c#L1958 It wouldn't be hard to extend this function call to pass a flag that indicated if the string to be sanitized contained Adobe Symbol glyphs. I could take care of this part. The rest of the job would be adding code to: https://github.com/Sharpie/RTikZDevice/blob/0.6.2/R/sanitizeTexString.R That swapped the symbol glyphs for LaTeX statements---this is the part that I don't have the time to dig into. |
A little poking at the R source tree gives me the impression there is
I don't have time right now either, but may try to find time in zw |
Plotmath expressions are not handled really at all by tikzDevice; anything that uses
%operators%
causes the string sanitizer to barf, Greek letters show up as the Latin letter corresponding to the position of the character in the Adobe Symbol font, and those are just the problems I've noticed so far.Ideal behavior would be for the device to translate plotmath into proper TeX math expressions, but I've no idea how difficult that would be.
Concrete test case 1:
Concrete test case 2:
-->
To be clear, I see this as a feature request rather than a bug, and I do have a workaround (edit all my graphics and replace plotmath with proper TeX math).
The text was updated successfully, but these errors were encountered: