Sharpie / RTikZDevice

A R package for producing graphics output as PGF/TikZ code for use in TeX documents.
32 stars 36 forks source link

TikZ device not calculating metrics, producing errors #71

Open ntguardian opened 7 years ago

ntguardian commented 7 years ago

Consider the following example:

library(tikzDevice)
tikz("test.tex")
plot(1:10)
dev.off()

An error will be produced once the plot is created, with a lot of code but near the end the error appears:

("C:\ProgramError in getMetricsFromLatex(TeXMetrics, verbose = verbose) : 
TeX was unable to calculate metrics for the following string
or character:

    m

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.
In addition: Warning messages:
1: In readLines(texLog) :
  incomplete final line found on 'C:\Users\cgmil\AppData\Local\Temp\Rtmp6FouwP/tikzStringWidthCalc.log'
2: In readLines(texLog) :
  incomplete final line found on 'C:\Users\cgmil\AppData\Local\Temp\Rtmp6FouwP/tikzStringWidthCalc.log'

There are other examples from websites and the tikzDevice vignette that are not working; sometimes they point to the string/character "m", sometimes a mysterious number like "36".

All of this is on a machine I bought on Sunday, so my version of all these packages should presumably be the most recent version. What's going on?

I noticed that I do not have this problem on my work computer, where I installed this package today. So here is the session information for the installation with which I'm having the problem.

R version 3.3.2 (2016-10-31)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)

locale:
[1] LC_COLLATE=English_United States.1252  LC_CTYPE=English_United States.1252   
[3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C                          
[5] LC_TIME=English_United States.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] tikzDevice_0.10-1

loaded via a namespace (and not attached):
[1] tools_3.3.2  filehash_2.3 grid_3.3.2