-
-
Notifications
You must be signed in to change notification settings - Fork 116
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
Rmarkdown not working: ! LaTeX Error: File `grffile.sty' not found. #152
Comments
Hi! I'm using TinyTex to build PDF documents through Travis-CI and I have the same error. When I run build that passed one or two weeks ago, it failed to build PDF documents due to this error. I've noticed that the grffile package was updated few days ago, maybe it's broken something? |
I just experienced the exact same problem. Everything worked fine until yesterday, then I updated through
So I assume, the update has not been distributed yet to those mirrors? Is there any way to run the Knit function anyway? I am not using any graphics or anything, so I don't really need it. |
This is related to other questions from a few days ago around the web:
It seems the It has been removed from pandoc template a week ago jgm/pandoc@4d5fd9e with an issue to follow how it evolves. see jgm/pandoc#5848 @yihui I am not an expert in Latex but I think there may be a change required in tex template in Rmarkdown 📦 to go along with pandoc choices. Hopes it helps. |
I just tested on a small example to knitr using
dir.create(tmp_dir <- tempfile())
xfun::write_utf8(c(
'---',
'title: "Untitled"',
'output: pdf_document',
'---',
'',
'## R Markdown',
'',
'```{r pressure, echo=FALSE}',
'plot(pressure)',
'```'
), file.path(tmp_dir, "test.Rmd")) # not working
rmarkdown::render(file.path(tmp_dir, "test.Rmd"),
output_options = list(latex_engine = "pdflatex"))
#> processing file: test.Rmd
#> output file: test.knit.md
#> "C:/PROGRA~3/CHOCOL~1/bin/pandoc" +RTS -K512m -RTS test.utf8.md --to latex --from markdown+autolink_bare_uris+tex_math_single_backslash --output test.tex --template "C:\Users\chris\Documents\R\win-library\3.6\rmarkdown\rmd\latex\default-1.17.0.2.tex" --highlight-style tango --pdf-engine pdflatex --variable graphics=yes --lua-filter "C:/Users/chris/Documents/R/win-library/3.6/rmarkdown/rmd/lua/pagebreak.lua" --lua-filter "C:/Users/chris/Documents/R/win-library/3.6/rmarkdown/rmd/lua/latex-div.lua" --variable "geometry:margin=1in" --variable "compact-title:yes"
#> tlmgr search --file --global "/grffile.sty"
#> Warning in parse_packages(logfile, quiet = c(TRUE, FALSE, FALSE)): Failed
#> to find a package that contains grffile.sty
#> ! LaTeX Error: File `grffile.sty' not found.
#>
#> ! Emergency stop.
#> <read *>
#> Error: Failed to compile test.tex. See https://yihui.name/tinytex/r/#debugging for debugging tips. See test.log for more info.
# not working
rmarkdown::render(file.path(tmp_dir, "test.Rmd"),
output_options = list(latex_engine = "lualatex"))
#> processing file: test.Rmd
#> output file: test.knit.md
#> "C:/PROGRA~3/CHOCOL~1/bin/pandoc" +RTS -K512m -RTS test.utf8.md --to latex --from markdown+autolink_bare_uris+tex_math_single_backslash --output test.tex --template "C:\Users\chris\Documents\R\win-library\3.6\rmarkdown\rmd\latex\default-1.17.0.2.tex" --highlight-style tango --pdf-engine lualatex --variable graphics=yes --lua-filter "C:/Users/chris/Documents/R/win-library/3.6/rmarkdown/rmd/lua/pagebreak.lua" --lua-filter "C:/Users/chris/Documents/R/win-library/3.6/rmarkdown/rmd/lua/latex-div.lua" --variable "geometry:margin=1in" --variable "compact-title:yes"
#> tlmgr search --file --global "/grffile.sty"
#> Warning in parse_packages(logfile, quiet = c(TRUE, FALSE, FALSE)): Failed
#> to find a package that contains grffile.sty
#> ! LaTeX Error: File `grffile.sty' not found.
#>
#> ! Emergency stop.
#> <read *>
#> Error: Failed to compile test.tex. See https://yihui.name/tinytex/r/#debugging for debugging tips. See test.log for more info.
# not working either
rmarkdown::render(file.path(tmp_dir, "test.Rmd"),
output_options = list(latex_engine = "xelatex"))
#> processing file: test.Rmd
#> output file: test.knit.md
#> "C:/PROGRA~3/CHOCOL~1/bin/pandoc" +RTS -K512m -RTS test.utf8.md --to latex --from markdown+autolink_bare_uris+tex_math_single_backslash --output test.tex --template "C:\Users\chris\Documents\R\win-library\3.6\rmarkdown\rmd\latex\default-1.17.0.2.tex" --highlight-style tango --pdf-engine xelatex --variable graphics=yes --lua-filter "C:/Users/chris/Documents/R/win-library/3.6/rmarkdown/rmd/lua/pagebreak.lua" --lua-filter "C:/Users/chris/Documents/R/win-library/3.6/rmarkdown/rmd/lua/latex-div.lua" --variable "geometry:margin=1in" --variable "compact-title:yes"
#> tlmgr search --file --global "/grffile.sty"
#> Warning in parse_packages(logfile, quiet = c(TRUE, FALSE, FALSE)): Failed
#> to find a package that contains grffile.sty
#> ! LaTeX Error: File `grffile.sty' not found.
#>
#> ! Emergency stop.
#> <read *>
#> Error: Failed to compile test.tex. See https://yihui.name/tinytex/r/#debugging for debugging tips. See test.log for more info.
fs::file_delete(fs::dir_ls(tmp_dir, glob = "*.Rmd", invert = TRUE))
# modify template ---
# get template
file.copy(system.file("rmd/latex/default-1.17.0.2.tex", package = "rmarkdown"), to = tmp_dir)
#> [1] TRUE
xfun::gsub_file(file.path(tmp_dir, "default-1.17.0.2.tex"),
pattern = "\\usepackage\\{graphicx,grffile\\}",
replacement = "\\usepackage{graphicx}")
# include new template
rmarkdown::render(file.path(tmp_dir, "test.Rmd"), output_options = list(template = "default-1.17.0.2.tex"))
#> processing file: test.Rmd
#> output file: test.knit.md
#> "C:/PROGRA~3/CHOCOL~1/bin/pandoc" +RTS -K512m -RTS test.utf8.md --to latex --from markdown+autolink_bare_uris+tex_math_single_backslash --output test.tex --template default-1.17.0.2.tex --highlight-style tango --pdf-engine pdflatex --lua-filter "C:/Users/chris/Documents/R/win-library/3.6/rmarkdown/rmd/lua/pagebreak.lua" --lua-filter "C:/Users/chris/Documents/R/win-library/3.6/rmarkdown/rmd/lua/latex-div.lua"
#>
#> Output created: test.pdf
list.files(tmp_dir)
#> [1] "default-1.17.0.2.tex" "test.pdf" "test.Rmd"
#> [4] "test.tex"
unlink(tmp_dir, recursive = TRUE)
xfun::session_info(c("rmarkdown", "tinytex"))
#> R version 3.6.1 (2019-07-05)
#> Platform: x86_64-w64-mingw32/x64 (64-bit)
#> Running under: Windows 10 x64 (build 17134)
#>
#> Locale:
#> LC_COLLATE=French_France.1252 LC_CTYPE=French_France.1252
#> LC_MONETARY=French_France.1252 LC_NUMERIC=C
#> LC_TIME=French_France.1252
#>
#> Package version:
#> base64enc_0.1.3 digest_0.6.22 evaluate_0.14 glue_1.3.1
#> graphics_3.6.1 grDevices_3.6.1 highr_0.8 htmltools_0.4.0
#> jsonlite_1.6 knitr_1.25 magrittr_1.5 markdown_1.1
#> methods_3.6.1 mime_0.7 Rcpp_1.0.2 rlang_0.4.1
#> rmarkdown_1.16 stats_3.6.1 stringi_1.4.3 stringr_1.4.0
#> tinytex_0.16 tools_3.6.1 utils_3.6.1 xfun_0.10
#> yaml_2.2.0
#>
#> Pandoc version: 2.7.3
tinytex::tlmgr("--version")
#> tlmgr --version
tlmgr revision 52585 (2019-10-31 19:26:15 +0100)
tlmgr using installation: C:/Users/chris/AppData/Roaming/TinyTeX
TeX Live (http://tug.org/texlive) version 2019 Created on 2019-11-10 by the reprex package (v0.3.0) |
Awesome, many thanks @cderv for the digging deeply into it and the quick fix (you saved my day; dealing with texlive dependencies on CentOS R on high performance VM today has already been frustrating enough ;-))! 💯 : can confirm: # let's skip reprex for now...
> reprex::reprex(input = here::here("hands-on", "2019-11_task-bayesian-data-science", "rePreparing reprex as .R file:, outfile = here::here("hands-on", "2019-11_task-bayesian-dat * /home/baumanph/local/46_swiss-ssl/hands-on/2019-11_task-bayesian-data-science/reprex-
rendered_reprex.R
Rendering reprex...
Error: callr subprocess failed: cannot change working directory
> # Errors
> rmarkdown::render(
+ here::here("hands-on", "2019-11_task-bayesian-data-science",
+ "2019-11_course-work-bayesian-data-science-baumann.Rmd")
+ )
processing file: 2019-11_course-work-bayesian-data-science-baumann.Rmd
| | | |............. | 20%
ordinary text without R code
| |.......................... | 40%
label: setup (with options)
List of 1
$ include: logi FALSE
| |....................................... | 60%
ordinary text without R code
| |.................................................... | 80%
label: unnamed-chunk-1
| |.................................................................| 100%
ordinary text without R code
output file: 2019-11_course-work-bayesian-data-science-baumann.knit.md
/home/baumanph/.cabal/bin/pandoc +RTS -K512m -RTS 2019-11_course-work-bayesian-data-science-baumann.utf8.md --to latex --from markdown+autolink_bare_uris+ascii_identifiers+tex_math_single_backslash --output 2019-11_course-work-bayesian-data-science-baumann.tex --template /home/baumanph/R/x86_64-redhat-linux-gnu-library/3.5/rmarkdown/rmd/latex/default-1.17.0.2.tex --highlight-style tango --latex-engine pdflatex --variable graphics=yes --variable 'geometry:margin=1in' --variable 'compact-title:yes'
This is pdfTeX, Version 3.14159265-2.6-1.40.20 (TeX Live 2019) (preloaded format=pdflatex)
restricted \write18 enabled.
entering extended mode
tlmgr search --file --global '/grffile.sty'
! LaTeX Error: File `grffile.sty' not found.
! Emergency stop.
<read *>
Error: Failed to compile 2019-11_course-work-bayesian-data-science-baumann.tex. See https://yihui.name/tinytex/r/#debugging for debugging tips. See 2019-11_course-work-bayesian-data-science-baumann.log for more info.
In addition: Warning message:
In parse_packages(logfile, quiet = c(TRUE, FALSE, FALSE)) :
Failed to find a package that contains grffile.sty
>
> # to render the document on the VM (enough RAM to load cached obj> ## fixes bug :-)
> rmd_root_dir <- here::here("hands-on", "2019-11_task-bayesian-dat> science")
> file.copy(system.file("rmd/latex/default-1.17.0.2.tex", package = "rmarkdown"),+ to = rmd_root_dir)[1] TRUE
[1] TRUE
>
> xfun::gsub_file(file.path(rmd_root_dir, "default-1.17.0.2.tex"),
+ pattern = "\\usepackage\\{graphicx,grffile\\}",
+ replacement = "\\usepackage{graphicx}")
>
> rmarkdown::render(
+ here::here("hands-on", "2019-11_task-bayesian-data-science",
+ "2019-11_course-work-bayesian-data-science-baumann.Rmd"),
+ output_options = list(template = "default-1.17.0.2.tex")
+ )
processing file: 2019-11_course-work-bayesian-data-science-baumann.Rmd
| | | |............. | 20%
ordinary text without R code
| |.......................... | 40%
label: setup (with options)
List of 1
$ include: logi FALSE
| |....................................... | 60%
ordinary text without R code
| |.................................................... | 80%
label: unnamed-chunk-1
| |.................................................................| 100%
ordinary text without R code
output file: 2019-11_course-work-bayesian-data-science-baumann.knit.md
/home/baumanph/.cabal/bin/pandoc +RTS -K512m -RTS 2019-11_course-work-bayesian-data-science-baumann.utf8.md --to latex --from markdown+autolink_bare_uris+ascii_identifiers+tex_math_single_backslash --output 2019-11_course-work-bayesian-data-science-baumann.tex --template default-1.17.0.2.tex --highlight-style tango --latex-engine pdflatex
Output created: 2019-11_course-work-bayesian-data-science-baumann.pdf
>
> xfun::session_info(c("rmarkdown", "tinytex"))
R version 3.6.0 (2019-04-26)
Platform: x86_64-redhat-linux-gnu (64-bit)
Running under: CentOS Linux 7 (Core)
Locale:
LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C
LC_TIME=de_CH.UTF-8 LC_COLLATE=en_US.UTF-8
LC_MONETARY=de_CH.UTF-8 LC_MESSAGES=en_US.UTF-8
LC_PAPER=de_CH.UTF-8 LC_NAME=C
LC_ADDRESS=C LC_TELEPHONE=C
LC_MEASUREMENT=de_CH.UTF-8 LC_IDENTIFICATION=C
Package version:
base64enc_0.1.3 digest_0.6.21 evaluate_0.14 glue_1.3.1
graphics_3.6.0 grDevices_3.6.0 highr_0.8 htmltools_0.3.6
jsonlite_1.6 knitr_1.23 magrittr_1.5 markdown_1.0
methods_3.6.0 mime_0.7 Rcpp_1.0.2 rmarkdown_1.13
stats_3.6.0 stringi_1.4.3 stringr_1.4.0 tinytex_0.16
tools_3.6.0 utils_3.6.0 xfun_0.8 yaml_2.2.0
Pandoc version: 1.17.2 |
Thanks @cderv for this! Is there any way to
for documents that's easy to implement? I am desperate as I need to meet a deadline. |
Thanks @cderv for explaining what was causing this problem. I solved it using the new pandoc template as you suggested. @jrennstich you could use the new template use by the pandoc team as @cderv said. You can find it here in the pandoc repo. Just place the template.tex in the same folder as your
|
@jrennstich you can follow @clementviolet advice to use pandoc template or just do the trick I did to get the current rmarkdown template and replace the line # copy the template file locally
file.copy(system.file("rmd/latex/default-1.17.0.2.tex", package = "rmarkdown"),+ to = "fixed_rmd_latex_template.tex")
# replace the line
xfun::gsub_file("fixed_rmd_latex_template.tex",
pattern = "\\usepackage\\{graphicx,grffile\\}",
replacement = "\\usepackage{graphicx}") then you'll have locally a tex template for pandoc identical with the previous one except this line and you can add with
Know that you could also include that in your Rmd file directly and it should work ---
title: "Your Title"
output:
pdf_document:
template: fixed_rmd_latex_template.tex
---
```{r latex_template, include = FALSE}
# copy the template file locally
if (!file.exists("fixed_rmd_latex_template.tex")) {
file.copy(system.file("rmd/latex/default-1.17.0.2.tex", package = "rmarkdown"), to = "fixed_rmd_latex_template.tex")
# replace the line
xfun::gsub_file("fixed_rmd_latex_template.tex",
pattern = "\\usepackage\\{graphicx,grffile\\}",
replacement = "\\usepackage{graphicx}")
}
```
If for any reason you want to avoid the copy you could also read, then gsub and write locally. local({
template <- xfun::read_utf8(system.file("rmd/latex/default-1.17.0.2.tex", package = "rmarkdown"))
template <- gsub(pattern = "\\usepackage\\{graphicx,grffile\\}",
replacement = "\\usepackage{graphicx}",
x = template
)
xfun::write_utf8(template, "fixed_rmd_latex_template.tex")
}) |
Dear @clementviolet and @cderv - thanks so much for your support and quick replies! This was v helpful and most welcome! |
Any suggestions for how to make this work with
|
I think you need to open an issue there to modify their template. Currently you can’t provide your own to use with komaletter because it in the code itself There maybe another way to solve this issue though because a lot of things will break. Maybe using a older version of latex with a specified version of the grffile package ? |
Thanks for the report! I just fixed it in rmarkdown. You can install the development version via remotes::install_github('rstudio/rmarkdown') |
This solved my issue! |
These changes should not be necessary anymore, there were some problems in the TL packages that are sorted out now. grfffile is now an empty stub that loads graphicx, and nothing else. @ALL if these kinds of errors happen, please check also the TeX Live mailing list, there these issues are reported usually faster than anywhere else. Thanks Norbert |
Thanks @norbusan! |
…become a legacy package, and won't be available in future versions of TeX Live)" This reverts commit 1f63943. The fix is no loner necessary since the grffile package is back: rstudio/tinytex#152 (comment)
Hi @yihui ! Sorry to bother you again, but I've just updated my R and Rstudio versions, and upon trying to knit am now getting
Any ideas? |
@mariadelmarq I don't know the internals of tinytex, but it seems that you have a TeX Live 2018 installed (via tinytex), and this cannot be directly updated to TeX Live 2019. Could it be that you have multiple TeX LIve versions installed? What does
say? |
@mariadelmarq Please see #116. |
@mariadelmarq No worries! I'll see if this can be automated so other users won't need to ask in the future. |
@yihui a few things: First of all, thanks for your hard work on TinyTeX!!! I think this is a really great project. BTW, did I or Karl ask you to write an TUGboat article about it, we would be very grateful!! I have no (again) read through the FAQs etc and have some comment, most importantly concerning the Debian/Ubuntu equivs. Why do you use the outdated 2016 version? We provide equivs files at https://tug.org/texlive/debian.html (see heading "Integrating vanilla TeX Live with Debian"). I somehow agree with your evaluation concerning the packaging level (collection versus single packages), but this is a historical issue back then (10 years or so ago) when I packaged TL for Debian the first time, debian-devel rejected the idea to package each TL package into a single TL package. I guess, asking today would give a different answer. And I might do that in the future, but there is a trade-off: we at TL try to keep collection self-supported, that is, if you install a collection and its dependencies, you get all you need to use all the included packages. But for package-to-package dependencies, we don't track them in TeX Live. So that would mean we wouldn't have package-to-package dependencies in Debian either, which is a problem. Anyway, I might revisit all this in the future ... times permitting. All the best Norbert |
http://www.aoc.nrao.edu/~smyers/vlass/latex/grffile.sty I downloaded this file and put that in the same folder. |
@yi and @yi-apr |
Hi, I searched this https://github.com/Distrotech/dblatex/blob/master/latex/misc/ragged2e.sty. You may check the raw file and save as .sty (not .txt) file, and then put it in the same folder with you Rmarkdown files.
Hope it helps.
On Jan 6, 2020, at 23:42, Ben <[email protected]<mailto:[email protected]>> wrote:
ragged2e.sty
|
@bac3917 @yi-apr You can find the LaTeX package name via the R function: > tinytex::parse_packages(files = "ragged2e.sty")
tlmgr search --file --global '/ragged2e.sty'
[1] "ragged2e" Then install it via |
@norbusan Yes, Karl asked me to write an article for TUGboat last year, and it has been published: http://tug.org/TUGboat/Contents/contents40-1.html I was not aware of the equivs files at https://tug.org/texlive/debian.html. Thanks for the pointer! I appreciate most of packages that Debian provides, but I still feel the Basically, since TeX Live can be installed to a self-contained folder without the root privilege, I'm happy to install it that way. I hate having to turn to IT for help every time for LaTeX installation issues, which I could have easily solved by myself. Meanwhile, I also hate being locked to a software version provided by the operating system's developers or volunteers (I appreciate their effort, but freedom is more important to me). I tend to user newer versions, but obviously Debian values stability (much) more. Newer (or latest) versions are not necessarily better or worse. It is just my personal preference. Thanks for your explanation and comments! |
Hi @yihui Concerning the Debian packages: Yes I understand why you choose this way, fully understandable. Actually, we = TeX Live Team suggest using this method. I just keep the Debian packages because they are necessary, and for most users it is not necessary to have the latest versions of all packages. In addition, those using Debian testing or sid get practically monthly updates, which is quite good a rythm I think. But true, stable is always old. Concerning the Anyway, good luck with your work, I really appreciated, both from the TeX side as well as the R side (I'm a heavy R user, too). |
I have an .Rmd file that I am trying to knit to PDF and am experiencing what seems to be a similar issue to the above:
The compile was working fine until I tried to include a pipe table in the document, as follows:
I saw that others resolved such issues by downloading the relevant .sty file and saving it in the folder that contains the .Rmd file. I found the footnote.sty in mdwtools package here, and after saving the file in my working directory the PDF did compile, but it has some strange lines in it before the bottom rule. Can anyone explain? |
Oops, it seems this was a simple syntax error; I was not supposed to include |
tlmgr search --file --global '/grffile.sty'
! LaTeX Error: File `grffile.sty' not found.
! Emergency stop.
<read *>
Error: Failed to compile hw04.tex. See https://yihui.name/tinytex/r/#debugging for debugging tips. See hw04.log for more info.
In addition: Warning message:
In parse_packages(logfile, quiet = c(TRUE, FALSE, FALSE)) :
Failed to find a package that contains grffile.sty
Execution halted
The text was updated successfully, but these errors were encountered: