[Tikzdevice-bugs] tikzDevice character metric error

Cameron Bracken cameron.bracken at gmail.com
Fri Jan 29 01:41:10 CET 2010


Yeah, the error is not very informative but I believe it is because
the underscore ('_') character is only valid in math mode and latex is
getting an error. If for some reason the commands you use are ones
that are specially defined then you need to add the definitions and/or
 packages with the "tikzLatexPackages" option.

for example if you need the siunitx package then set:

options("tikzLatexPackages" =
c(getOption("tikzLatexPackages"),"\\usepackage{siunitx}"))

Hope that helps.

-Cameron

--
Cameron Bracken
Graduate Research Assistant
CADSWES
University of Colorado at Boulder
cameron.bracken at colorado.edu
(707) 986-8633



On Thu, Jan 28, 2010 at 5:17 PM, Chris Hoefler <hoeflerb at brandeis.edu> wrote:
> Hello,
>
> I have just started using tikzDevice to output R plots for inclusion in
> a latex document. The output looks very good. Nice package!
>
> I've stumbled into a problem, though. I'm trying to include this axis label:
>
> title(ylab = "\\ce{k_{obs}} (\\si{\\per\\second})")
>
> When I do this, running the script gives me this error:
>
> In getMetricsFromLatex(TeXMetrics) : NAs introduced by coercion
>
> I've narrowed down the problem to the \ce{} command, which comes from
> the mhchem package for typesetting chemical formulas. If I encapsulate
> the string in a math environment ($...$), it works fine. So I'm not sure
> what the problem is; it may be a bug.
>
> I can work around this by using this label instead:
>
> title(ylab="$\\textrm{k}_\\textrm{obs}$ (\\si{\\per\\second})")
>
> The result is almost identical, but not quite. Any thoughts on how to
> solve this?
>
>
> Thanks,
> Chris
> _______________________________________________
> Tikzdevice-bugs mailing list
> Tikzdevice-bugs at lists.r-forge.r-project.org
> https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/tikzdevice-bugs
>


More information about the Tikzdevice-bugs mailing list