Skip to content
This repository was archived by the owner on Sep 23, 2018. It is now read-only.
This repository was archived by the owner on Sep 23, 2018. It is now read-only.

Support for plotmath #44

@zackw

Description

@zackw

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

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).

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions