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
Using tikzDevice in child documents in different folders: Unable to calculate metrics #143
Comments
I guess the error doesn't occur if child.Rtex is in the main directory? |
No, this happens only when:
Plus, it worked year ago. This is probably problem of knitr rather than tikzDevice, do you think I should move it there? |
Another workaround might be to set the tikz preamble to use ../empty.sty, or to use a symlink if your system supports these. Perhaps @yihui knows a knitr-based fix? |
Could you simply upload the reproducible example as a zip file here? |
Here it is. You can see how it was translated. First graph shows that all the translation went good as this is in the main file. The second graph shows where errors happens, you can see that in this case, part of graph was still created and thus PDF could be created as well. |
I see. That is a knitr issue. I don't have a good solution, though. |
It's strange because tikz() seems to be run in the base directory since, like, forever (October 2014). What is the "base directory" for a child document? |
I can confirm that last year it worked. So maybe new introduction? Base directory of child document is the directory he is in, as because when you point at something with R inside that document, the relative path starts from the same folder (if you understand me). Which is probably problem for tikz as knitr/tikzDevice as it is taking the definition of LaTeX document and translating with that. How does that actually work you know probably better than me. |
I don't have time to investigate this issue closely, but I guess it was introduced by this change yihui/knitr#1073 |
I'm not sure yihui/knitr#1073 is the cause, according to @J-Moravec all is fine for the base document but not for the child document. I can run a bisect, but perhaps the only real fix at this time is to run tikz() from the root directory but write the output file to the base directory. This is going to be funny with raster images, too: these are external to the .tex file created by tikz() and must be in the same directory then. |
There's the I think setting |
sorry, I am trying to figure out what you mean. I was looking at TEXINPUTS, but I can't seem to find a way how to set it up from latex, only bash. Do you mean this? Is there any way to do it from LaTeX or do you mean setting it up for Knitr (and if so, where in knitr?) Thanks |
Could you try adding |
Ah, thank you, didn't know this R command. However, it fails to compute. Seems that setting TEXINPUTS overwrite defaults? I then get errors like this:
However, by default, TEXINPUTS are blank, as described here:
so combo: |
How about |
I'm also having quite some trouble with this, though it is perhaps somewhat different. Tikz for child documents is looking in the /figures folder for any additional classes, preamble, etc. MWE below, just change the document class to any old class file copied under Classes folder. This behaviour can be avoided if I specify fig.path = './' but this will get pretty messy. test.rnw
/child/child.rnw
|
Closing due to inactivity. @cdriveraus: Could you please open a new issue if you're still interested? |
I got eponymous error "Tex was unable to calculate metrics...".
It is probably some linking error connected with child document in different folder and local style document.
How to reproduce:
So such configuration could look like:
minimal.Rtex
examples/child.Rtex
empty.sty
How to quickfix: put style document into child folders as well, in this case:
examples/empty.sty
The text was updated successfully, but these errors were encountered: