Closed jolars closed 8 years ago
It seems like adding external=TRUE
to the chunk options and \usepackage{tikz}
to the latex preamble makes the document compilation finish, although this means the tikz
compiled plot seems to ignore out.width
calls.
Sorry I cannot reproduce it on Windows. external = TRUE
is just the default. \usepackage{tikz}
should be automatically added to the tikz file as well. So I have no idea why the problem could be fixed by that.
Sorry, I meant the opposite. Adding external=FALSE
makes it work. I understand; I guess there's something on my end then. I'm using Tex Live 2015 is that makes any difference.
I see. This is probably a little hard to diagnose. I have MikTeX on Windows.
You can find the .tikz file under the figure/
directory, and try to run pdflatex on it and see what happens.
Thanks. I located the file and it compiles perfectly fine when I run pdflatex. It hangs on XeLaTeX too.
I tried running knit()
from the console. It stops at the same place but instead throws an error.
Quitting from lines 18-19 (fonts_plots.Rnw)
Error: failed to compile figure/test2-1.tikz to PDF
In addition: Warning message:
running command '"C:\texlive\2015\bin\win32\pdflatex.exe" "test2-1.tikz"' had status 1
Sorry, I have no idea about what could be wrong. All I can say for now is that if you want to debug the issue by yourself, here is where you need to look at: https://github.com/yihui/knitr/blob/c3085229/R/plot.R#L127-L149 Maybe TEXINPUTS
was the culprit; or getOption('tikzLatex')
points to the wrong pdflatex.exe
; ... It is difficult for me to fix it without being able to reproduce it first.
That sounds reasonable, thank. I'll play around with the settings and see if I can figure something out.
I have the same problem (and I am not the only one).
It seems to be related to my misconfigured network drive. See this SO thread about another unfortunate consequence of this misconfiguration (I am the author of this SO thread).
Indeed, after moving the Rnw
file to my C
drive, I can compile it without any issue.
But, contrary to the issue described in the SO thread, this has nothing to do with file.access
(I think).
Another information possibly helpful.
I modified knitr:::plot2dev
like this: system2(latex, shQuote(basename(path)), stdout = "out.txt", stderr="err.txt")
.
Then (when the compilation does not work, on my network drive), I get that in err.txt
:
Sorry, but C:\PortableApps\MikTeX\texmfs\install\miktex\bin\pdflatex.exe did not succeed.
The log file hopefully contains the information to get MiKTeX going again:
C:/PortableApps/MikTeX/texmfs/data/miktex/log/pdflatex.log
You may want to visit the MiKTeX project page, if you need help.
And in pdflatex.log
:
2017-02-03 20:42:59,947+0100 FATAL pdflatex - Info: path="U:/Data/Slides/SlidesMaria3:"
2017-02-03 20:42:59,947+0100 FATAL pdflatex - Source: Libraries\MiKTeX\Core\Directory\win\winDirectory.cpp
2017-02-03 20:42:59,947+0100 FATAL pdflatex - Line: 82
2017-02-03 20:44:03,901+0100 FATAL pdflatex - Windows API error 1251: This operation is supported only when you are connected to the server.
I've found this thread about this error, but this didn't help me (note that I don't have admin rights hence I can't try every proposal): http://tex.stackexchange.com/questions/51799/windows-api-error-5-access-is-denied-when-trying-to-compile-tikz-picture
This operation is supported only when you are connected to the server.
I'm pretty sure now. This message occurs when there's a relative path from a hard drive to another one.
@yihui , Is there a relative path from the Rnw file to MikTeX ? In this case, that's the problem.
hm, I also just ran into this problem - it's a pity as it seems to me that tikzDevice should be the preferred solution for reproducible reports
Okay, so I am kind of out of ideas now. I can confirm that the issues seems to be https://github.com/yihui/knitr/blob/c3085229/R/plot.R#L127-L149, LaTeX just does not find the .tikz file. I am running Win 10 with texlive 2017. Manually compiling the figure works fine - it is definately just about pointing LaTeX to the right file. Any ideas?
@kkmann For me, this error occurs only when I work on my network drive and when this network drive is offline. When I work on the C drive (where MikTeX is installed), there's no problem. There's no problem as well when I work on my network drive and when this one is online. Are you using two different hard drives ? If not, that would mean there are different possible causes of this issue...
Well, I guess my fix can only solve the initial problem. Your's seems to be way out of my league ;) Are you sure its knitr related? The error looks more like a TeX problem to me... Can you compile the .tikz file manually?
Yes, I can compile the tikz file manually (and I recall that everything works on the C drive anyway, knitr+LaTeX). I'll try your fix but I would be surprised that it solves my case. But who knows...
Maybe you should open a new issue as your case is different from @jolars and mine.
I have merged #1420. Please devtools::install_github('yihui/knitr')
and see if it fixes your issue.
Yes, it works !! Big thanks @kkmann !
Look at the log I posted, it contained the smoking gun !! :
path="U:/Data/Slides/SlidesMaria3:"
I didn't notice the colon !!!
took me two hours too, win/linux is always good for a surprise x)
@yihui thx for the quick merge and keep up your awesome work!
I'm so glad that this old issue has been resolved. And lessons learned. Thanks everyone!
This old thread has been automatically locked. If you think you have found something related to this, please open a new issue by following the issue guide (https://yihui.org/issue/), and link to this old issue if necessary.
This issue has been documented previously here and here but no solution has so far been offered. The issue does not seem related to
tikzDevice
since calling tikz() as device in R works flawlessly.Below I've borrowed an example from one of the links above, along with the output I get.
And it will just hang there until I decide to terminate.
Here's my sessionInfo():