Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tikzStringWidthCalc.log is not found (used to work) #176

Open
shedig opened this issue Mar 15, 2018 · 17 comments
Open

tikzStringWidthCalc.log is not found (used to work) #176

shedig opened this issue Mar 15, 2018 · 17 comments

Comments

@shedig
Copy link

shedig commented Mar 15, 2018

On Windows 10 and R 3.4.3 I get the following error message when running the following short R skript.
I used tikZDevice for several other figures and it always worked...

library(MASS)
library(mixtools)

set.seed(747)

library(tikzDevice)
tikz(file = "plot_intro.tex", width=8.5, height=11)

size_choose <- 20
covmat <- matrix(c(1,0.7,0.7,1), nrow=2, ncol=2)
real <- as.data.frame(mvrnorm(n=size_choose, mu=c(0,0), Sigma=covmat))
fake <- as.data.frame(mvrnorm(n=4, mu=c(0,0), Sigma=covmat))

plot(real, xlim=c(-4,4), ylim=c(-4,4), xlab="$X_1$", ylab="$X_2$", pch=16, cex.lab=1.5, cex.axis=1.5)
Measuring dimensions of: m
Running command: "C:\PROGRA1\MIKTEX1.9\miktex\bin\x64\pdflatex.exe" -interaction=batchmode -halt-on-error -output-directory "C:\Users\name1\AppData\Local\Temp\Rtmpc1AUUi\tikzDevice28b0410b1e9e" "C:/Users/name1/AppData/Local/Temp/Rtmpc1AUUi/tikzDevice28b0410b1e9e/tikzStringWidthCalc.tex"
Error in file(con, "r") : cannot open the connection
In addition: Warning message:
In file(con, "r") :
cannot open file 'C:\Users\name~1\AppData\Local\Temp\Rtmpc1AUUi\tikzDevice28b0410b1e9e/tikzStringWidthCalc.log': No such file or directory

where i changed the actual username to "name"

some further points:

The file tikzStringWidthCalc.tex actually exists in the temporary folder

the output of tempdir() looks as follows
"C:\Users\name~1\AppData\Local\Temp\Rtmpc1AUUi"
note: i tried changing the tempdir to one where there is no space in the username, the error remains.

Thanks for any help:)

@shedig
Copy link
Author

shedig commented Mar 16, 2018

Solved it by using XeLatex instead of PdfLadex

@bellackn
Copy link

Hi @shedig, glad you found a workaround that works for you. However, I tried to reproduce this behavior on a Windows 10 VM without success, everything worked smoothly for me with the code example you provided.

It seems like there is a backslash in your output when there should be a forward slash directly before tikzStringWidthCalc.log.

Running on my VM, the path looks correct:

Running command: "C:\texlive\2018\bin\win32\pdflatex.exe" -interaction=batchmode -halt-on-error -output-directory "C:\Users\User\AppData\Local\Temp\RtmpURkf2h\tikzDevice1f58568e3553" "C:/Users/User/AppData/Local/Temp/RtmpURkf2h/tikzDevice1f58568e3553/tikzStringWidthCalc.tex"

Could you please check if this error still occurs for you?

@samawelch
Copy link

samawelch commented Aug 14, 2018

Hi, I hope it's alright if I jump in with the same issue. I'm just trying to run the example code in the manual:

library(tikzDevice)

tikz('tikz-example.tex',
     width = 3.25, height = 3.25)
plot(1, 1, main = 'Hello \\TeX !')
dev.off()

and I get the error:

Measuring dimensions of: m
Running command: "C:\Users\name~1\AppData\Roaming\TinyTeX\bin\win32\pdflatex.exe" -interaction=batchmode -halt-on-error -output-directory "C:\Users\name~1\AppData\Local\Temp\RtmpsHFDGr\tikzDevice224459df42e" "C:/Users/name~1/AppData/Local/Temp/RtmpsHFDGr/tikzDevice224459df42e/tikzStringWidthCalc.tex"
Error in file(con, "r") : cannot open the connection
In addition: Warning message:
In file(con, "r") :
  cannot open file 'C:\Users\name~1\AppData\Local\Temp\RtmpsHFDGr\tikzDevice224459df42e/tikzStringWidthCalc.log': No such file or directory

with the same backslash when there should be a forward slash.

When I try and compile tikzStringWidthCalc.tex manually using tinytex::pdflatex(), compiling fails:

! Missing \endgroup inserted.
<inserted text> 
                \endgroup 
l.22 \end{document}

Error: Failed to compile tikzStringWidthCalc.tex. See test.log for more info.

If I manually change the \@@end on the last line to a \end{tikzpicture} and \end{document} I can compile tikzStringWidthCalc.tex into a pdf of the letter m manually, but nothing I've tried using tikz() (including switching to XeLaTeX and LuaTeX fixes the issue or even changes the error message.
Win 8.1 / tinytex 0.6.7 / tikzDevice 0.12 / R 3.5.1

@bellackn
Copy link

Hi @samawelch, thanks for reporting!
I finally managed to reproduce this error on a Windows 10 VM with the same program versions you have posted. We will definitely address support for TinyTeX in the future. However, if you need to get it going right now, I'd suggest you give it a shot with TeX Live.
I would recommend the same to you, @shedig. I have not tried it with MikTeX yet, but if you are not content using this workaround you mentioned, this might be worth a try.

@Uri92
Copy link

Uri92 commented Dec 20, 2018

Still having the same problem ".../tikzStringWidthCalc.log': No such file or directory"

Using texlive (also tried MiKTeX, same problem), R version 3.5.1

Changing the compiler, running as administrator, updating R packages/texlive did not solve the issue.

@Uri92
Copy link

Uri92 commented Feb 17, 2019

Hi @samawelch, thanks for reporting!
I finally managed to reproduce this error on a Windows 10 VM with the same program versions you have posted. We will definitely address support for TinyTeX in the future. However, if you need to get it going right now, I'd suggest you give it a shot with TeX Live.
I would recommend the same to you, @shedig. I have not tried it with MikTeX yet, but if you are not content using this workaround you mentioned, this might be worth a try.

This workaround does not do the trick. Any news on this issue?

@rstub
Copy link
Member

rstub commented Feb 20, 2019

@Uri92 and anybody else having this problem: Please post the output of running tikzDevice::tikzTest() in the R console.

@Uri92
Copy link

Uri92 commented Feb 20, 2019

@rstub This is the output in the R console:

> tikzDevice::tikzTest()

Active compiler:
	C:\texlive\2018\bin\win32\pdflatex.exe
	pdfTeX 3.14159265-2.6-1.40.19 (TeX Live 2018/W32TeX)
	kpathsea version 6.3.0

Measuring dimensions of: A
Running command: "C:\texlive\2018\bin\win32\pdflatex.exe" -interaction=batchmode -halt-on-error -output-directory "C:\Users\USER\AppData\Local\Temp\Rtmp2h8ns8\tikzDevice351070195eae" "C:/Users/USER/AppData/Local/Temp/Rtmp2h8ns8/tikzDevice351070195eae/tikzStringWidthCalc.tex"
This is pdfTeX, Version 3.14159265-2.6-1.40.19 (TeX Live 2018/W32TeX) (preloaded format=pdflatex)
 restricted \write18 enabled.
entering extended mode
Error in file(con, "r") : cannot open the connection
In addition: Warning message:
In file(con, "r") :
  cannot open file 'C:\Users\USER\AppData\Local\Temp\Rtmp2h8ns8\tikzDevice351070195eae/tikzStringWidthCalc.log': No such file or directory

@rstub
Copy link
Member

rstub commented Feb 21, 2019

Thanks @Uri92 . Can you check if the log file exists in that location. In case you quit the R session, please re-run the command and look at the new location. In addition can you please post the content of the produced .tex file?

@Uri92
Copy link

Uri92 commented Feb 22, 2019

@rstub tikzStringWidthCalc.log does not exist, however there is a texput.log file

The .tex file contains the following:

\documentclass[10pt]{article}

\usepackage{tikz}

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

\PreviewEnvironment{pgfpicture}

\setlength\PreviewBorder{0pt}

\usepackage[T1]{fontenc}

\usetikzlibrary{calc}

\batchmode
\begin{document}
\begin{tikzpicture}
\node[inner sep=0pt, outer sep=0pt, scale=1] (TeX) {A};
\path let \p1 = ($(TeX.east) - (TeX.west)$),
    \n1 = {veclen(\x1,\y1)} in (TeX.east) -- (TeX.west)
    node{ \typeout{tikzTeXWidth=\n1} };
\end{tikzpicture}
\end{document}

@rstub
Copy link
Member

rstub commented Feb 22, 2019

@Uri92 Thanks, the .tex file looks fine. The texput.log file is probably quite long. Does it contain a line like this

 tikzTeXWidth=7.49817pt

close to the end of the file?

@Uri92
Copy link

Uri92 commented Feb 22, 2019

@rstub This is the content of the texput.log file:

This is pdfTeX, Version 3.14159265-2.6-1.40.19 (TeX Live 2018/W32TeX) (preloaded format=pdflatex 2018.12.20)  22 FEB 2019 08:39
entering extended mode
 restricted \write18 enabled.
 %&-line parsing enabled.
**C:/Users/USER/AppData/Local/Temp/RtmpS0XDWR/tikzDevice3300647a2867/tikzStringWidthCalc.tex
! Emergency stop.
<to be read again> 
                   \protect 
<*> C:/Users/USER
                    1/AppData/Local/Temp/RtmpS0XDWR/tikzDevice3300647a2867/t...
 
Here is how much of TeX's memory you used:
 5 strings out of 492616
 259 string characters out of 6132767
 56950 words of memory out of 5000000
 4017 multiletter control sequences out of 15000+600000
 3640 words of font info for 14 fonts, out of 8000000 for 9000
 1141 hyphenation exceptions out of 8191
 3i,0n,0p,1b,6s stack positions out of 5000i,500n,10000p,200000b,80000s
!  ==> Fatal error occurred, no output PDF file produced!

@rstub
Copy link
Member

rstub commented Feb 22, 2019

@Uri92 Thanks for you patience. I was now able to reproduce the issue after creating a test user with a long enough name in my Windows environment. This means that as a workaround you can try to use a user with a short user name.

@rstub
Copy link
Member

rstub commented Feb 22, 2019

@Uri92 Can you please try the version from the issues/176 branch:

remotes::install_github("daqana/tikzDevice@issues/176")

@Uri92
Copy link

Uri92 commented Feb 22, 2019

@rstub Thank you very much for your support, installing the version you suggested worked!

@rstub
Copy link
Member

rstub commented Feb 25, 2019

@Uri92 Thanks for checking. I have now merged this into master and put the package unto our drat repository, i.e.

if (!requireNamespace("drat", quietly = TRUE))
  install.packages("drat")
drat::addRepo("daqana")

install.packages("tikzDevice")

will give you the most recent version. Since there are still some issues with the CI pipeline, it will take some time before a CRAN release, which is why I am keeping this issue open for the time being.

@shedig , @samawelch Can you also check if this fixes the issue for you?

@rstub
Copy link
Member

rstub commented Aug 8, 2019

@shedig , @samawelch This fix has been released to CRAN. Can you please check if this fixes the issue for you?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants