Hi all,
I can't fathom why the accented "?" in the following ggplot2 graph
makes
R hangs when using tikzdevice,? whereas it works using simple pdf device.
######
library(tikzDevice)
library(ggplot2)
options(tikzDefaultEngine = "luatex")
tikzLualatexPackages =c(
? "\\usepackage{tikz}\n",
? "\\usepackage[active,
tightpage,psfixbb]{preview}\n",
? "\\usepackage{fontspec,xunicode}\n",
? "\\PreviewEnvironment{pgfpicture}\n",
? "\\setlength\\PreviewBorder{0pt}\n"
)
x<- rnorm(10)
y<- rnorm(10)
df <- data.frame(x=x, y=y)
#### This example works
tikz(standAlone = TRUE)
ggplot(df, aes(x=x, y=y))+geom_point() +xlab("e")
dev.off()
####
#### This example hangs and never completes
tikz(standAlone = TRUE)
ggplot(df, aes(x=x, y=y))+geom_point() +xlab("?")
dev.off()
####
#### Working OK when using pdf device
pdf()
ggplot(df, aes(x=x, y=y))+geom_point() +xlab("?")
dev.off()
####
Thanks for your help
Jacques
[[alternative HTML version deleted]]
Martin Møller Skarbiniks Pedersen
2017-Oct-22 20:03 UTC
[R] ggplot2 and tikzDevice : problems with accents
On 22 October 2017 at 17:56, Jacques Ropers <jropers at gmail.com> wrote:> > Hi all, > > I can't fathom why the accented "?" in the following ggplot2 graph makes > R hangs when using tikzdevice, whereas it works using simple pdf device. >[...] I just tried your code and my R doesn't hang but it does give an TeX-error: (/usr/share/texlive/texmf-dError in getMetricsFromLatex(TeXMetrics, verbose = verbose) : TeX was unable to calculate metrics for the following string or character: 77 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. Regards Martin [[alternative HTML version deleted]]