I have an issue with tikzdevice when using accented characters which is
illustrated in the script below. This UTF8 encoded script runs correctly
using
> Sweave('minimal.rnw', encoding="UTF-8")
and the result can be compiled with XeLaTeX. However, when I replace "e" by
"é" in plot(rnorm(10,1,1), main ="e"), then I get the following error
message from R :
In getMetricsFromLatex(TeXMetrics) :
XeLaTeX was unable to calculate metrics for some characters:
Missing character: There is no � in font ec-lmbx10!
Am I doing something incorrectly ?
Thanks for your help and for this nice package.
Regards,
Jacques
##########################
\documentclass{article}
\usepackage{Sweave}
\usepackage{fontspec}
\usepackage{tikz}
\begin{document}
éàè %these accents are displayed correctly
<<label = debut, echo=FALSE, results=hide >>=
options(tikzMetricsDictionary = "metrics")
options(tikzLatex = "xelatex.exe")
options(tikzDefaultEngine = "xetex")
options(tikzDocumentDeclaration = "\\documentclass{article}")
options( tikzLatexPackages = c(
"\\usepackage{fontspec}"
,"\\usepackage{tikz}"
,"\\usepackage{calc}"
,"\\usepackage{color}"
))
require(tikzDevice, quietly=TRUE)
@
<<label = plot, fig=FALSE, echo=FALSE, results=hide>>=
tikz(file="plot.tex", standAlone=FALSE, bareBones=TRUE, width=5, height=6)
plot(rnorm(10,1,1), main ="e") ### Problem here if "é" instead of "e"
dev.off()
@
\begin{tikzpicture}[x=1pt,y=1pt]
\input{plot.tex}
\end{tikzpicture}
\end{document}
_______________________________________________
Tikzdevice-bugs mailing list
Tikzdev...@lists.r-forge.r-project.org
https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/tikzdevice-bugs
Sorry for not responding sooner---I have been busy lately.
Your example works fine for me on OS X and Linux, but fails as you describe
on Windows 7 with R 2.14.0 and tikzDevice 0.6.1. I suspect this may be an R
issue as there are reports of UTF-8 character being sensitive to the locale
on windows:
http://stackoverflow.com/questions/5031630/how-to-source-r-file-saved-using-utf-8-encoding
Also see this post by Brian Ripley:
https://groups.google.com/d/msg/r-help-archive/qLI_O_qNaCc/Zr6iCGgnimoJ
Hope this helps!
-Charlie