Sharpie/RTikZDevice — Issue #44: Support for plotmath
Author: zackw
Created: 2011-12-04 20:39:41+00:00
State: open

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:

suppressPackageStartupMessages(library(tikzDevice))
tikz("plotmath.tex", standAlone=TRUE, width=1, height=1)
par(mai=c(0,0,0,0))
plot.new()
# the next two lines should produce identical (but for positioning)
# draw commands in the output, but they don't
text(.5, .6, expression(alpha+beta+gamma+delta))
text(.5, .4, "$\\alpha+\\beta+\\gamma+\\delta$")
invisible(dev.off())

Concrete test case 2:

suppressPackageStartupMessages(library(tikzDevice))
tikz("plotmath2.tex", standAlone=TRUE, sanitize=TRUE)
demo(plotmath)
invisible(dev.off())

-->
> draw.plotmath.cell(expression(x %+-% y), i, nr); i <- i + 1
Error in function (string, strip = getOption("tikzSanitizeCharacters"), :
Unable to sanitize string, you may be trying to pass in an unsupported symbol