Problem with Tikz and options(DecOut=',') #760

Closed
jan-glx opened this Issue Jan 30, 2013 · 1 comment

Comments

Projects
None yet
2 participants

jan-glx commented Jan 30, 2013

When changing the decimal sign in R to ",", plotting to a tikz device is possible using standard plot function but not using ggplot.

Building the tikz dictionary (before changing the decimal separator) by plotting using ggplot2 solves the problem.

Even through it could also be a tikz bug please try to fix or at least warn the user as I spent more than an hour trying to find a solution. Thanks for providing this great tool!

Minimal Examples:
R:

options(OutDec = ",")
require(ggplot2)
require(tikzDevice)
tikz('example.tex',standAlone = TRUE, width = 5,height = 5)
qplot(1:4,1:4,xlab="$\\pi$");
dev.off()

knitr:

\documentclass{artcl}
\begin{document}
\begin{figure}
<<example,dev='tikz',cache=FALSE>>=
options(OutDec = ",")
require(ggplot2)
qplot(1:4,1:4,xlab="$\\pi$");
@
\caption{I need comma as decimal point.\label{fig:example}}
\end{figure}
\end{document}

in either case the error is:

(C:\Users\Jan\AppData\Roaming\MiKTeX\2.8\tex\generic\pgf\basiclayer\pgfcoregraphic Fehler in getMetricsFromLatex(TeXMetrics) : 
TeX was unable to calculate metrics for the following string or character:

1:4

Common reasons for failure include:
  * The string contains a character which is special to LaTeX unless
    escaped properly, such as % or $.
  * The string makes use of LaTeX commands provided by a package and
    the tikzDevice was not told to load the package.

The contents of the LaTeX log of the aborted run have been printed above,
it may contain additional details as to why the metric calculation failed.
Owner

hadley commented Feb 24, 2014

Weird, sorry about that.

hadley closed this Feb 24, 2014

krlmlr referenced this issue in yihui/tikzDevice Feb 25, 2014

Closed

Weird issue when setting OutDec option #57

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment