daqana / tikzDevice

A R package for producing graphics output as PGF/TikZ code for use in TeX documents.
https://daqana.github.io/tikzDevice
132 stars 26 forks source link

Doesn't work with Cygwin latex #141

Closed ghost closed 6 years ago

ghost commented 8 years ago

Hi,

I'm trying to use tikzDevice using the official R binaries for Windows together with a LaTeX distribution from Cygwin. Unfortunately, tikzDevice does not appear to like this configuration:

library(tikzDevice) tikz('test') plot(rnorm(1,2,3),rnorm(1,2,4)) Creating temporary TikZ metrics dictionary at: C:\Users\me\AppData\Local\Temp\RtmpugLMLU/tikzMetricsDictionary Using TikZ metrics dictionary at: C:\Users\me\AppData\Local\Temp\RtmpugLMLU/tikzMetricsDictionary Measuring dimensions of: m Error in file(con, "r") : cannot open the connection In addition: Warning message: In file(con, "r") : cannot open file 'C:\Users\me\AppData\Local\Temp\RtmpugLMLU/tikzStringWidthCalc.log': No such file or directory

I thought the problem might be that the binary version of tikzDevice I got from CRAN might not be Cygwin-aware, so I also tried compiling it from source (using Cygwin's gcc), but with this self-compiled tikzDevice, R just aborts when I call tikz('somefile') - I get dropped back to my command prompt.

With the binary distribution, output is produced (after dev.off()), but it contains no text.

Is this a supported configuration?

krlmlr commented 8 years ago

R or the packages don't have to be compatible with Cygwin. What happens during measurement is:

According to the error message, the log file isn't created. Could you rerun and post the contents of this directory?

A native LaTeX distribution would probably work better anyway.

ghost commented 8 years ago

I've attached the contents of the directory here. The problem seems to be in the LaTeX file, which contains just this:

\documentclass[10pt]{article}

\usepackage{tikz}

\usepackage[active,tightpage,psfixbb]{preview}

\PreviewEnvironment{pgfpicture}

\setlength\PreviewBorder{0pt}

\usepackage[T1]{fontenc}

\usetikzlibrary{calc}

\begin{document} \begin{tikzpicture} \nodeinner sep=0pt, outer sep=0pt, scale=1 { m}; \path let \p1 = ($(TeX.east) - (TeX.west)$), \n1 = {veclen(\x1,\y1)} in (TeX.east) -- (TeX.west) node{ \typeout{tikzTeXWidth=\n1} }; \makeatletter \@@end

I've had some problems with MikTex way back in the past, hence why I'm on Cygwin now, but if you can't or don't want to support this configuration (or if the bug is simply Cygwin's rather than tikzDevice's), I completely understand :)

krlmlr commented 6 years ago

Thanks. The development version now has tikzTest() which can help troubleshoot problems. Please open a new issue if the problems persist.

Install the development version via

# install.packages("remotes")
remotes::install_github("yihui/tikzDevice")