rstudio/bookdown-demo

`bookdown-demo_files/figure-latex/nice-fig-1' not found

melindahiggins2000 opened this issue · 76 comments

I am having good luck getting both HTML and EPUB formats to work when running "Build Book" for the bookdown-demo. However, when compiling to PDF, I get the following errors (shown in the Build Book window). My sessionInfo() is also listed below. I am running RStudio Version 0.99.1128 on Windows-10 with MiKTeX v2.9.

Note: when compiling to HTML I do get the "nice-fig-1.png" figure created into my ".._book\bookdown-demo_files\figure-html" directory just fine.

Any help is appreciated.

Thank you, Melinda Higgins

----- Build Book errors -----------------------------------------------------------
latexmk.exe: MiKTeX encountered an internal error.
! LaTeX Error: File `bookdown-demo_files/figure-latex/nice-fig-1' not found.

Error: Failed to compile bookdown-demo.tex. See bookdown-demo.log for more info.
In addition: Warning messages:
1: running command '"C:\PROGRA~2\MIKTEX~1.9\miktex\bin\latexmk.exe" -pdf -latexoption=-halt-on-error -interaction=batchmode -pdflatex="pdflatex" "bookdown-demo.tex"' had status 1 
2: running command '"C:\PROGRA~2\MIKTEX~1.9\miktex\bin\latexmk.exe" -v' had status 1 
Execution halted

Exited with status 1.
----- Session Info -------------------------------------------
> sessionInfo()
R version 3.2.3 (2015-12-10)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)

locale:
[1] LC_COLLATE=English_United States.1252 
[2] LC_CTYPE=English_United States.1252   
[3] LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C                          
[5] LC_TIME=English_United States.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets 
[6] methods   base     

other attached packages:
[1] knitr_1.12.3    devtools_1.10.0

loaded via a namespace (and not attached):
 [1] Rcpp_0.12.4       bookdown_0.0.60   withr_1.0.1      
 [4] digest_0.6.9      mime_0.4          R6_2.1.2         
 [7] xtable_1.8-2      git2r_0.13.1      httr_1.1.0       
[10] curl_0.9.5        miniUI_0.1.1      rmarkdown_0.9.5.8
[13] tools_3.2.3       shiny_0.13.2      httpuv_1.3.3     
[16] yaml_2.1.13       rsconnect_0.4.2.2 memoise_1.0.0    
[19] htmltools_0.3.5
yihui commented

I cannot reproduce this issue on Windows. Can you print out the version of XeTeX?

system('xelatex --version')

Here is my xelatex version:

> system('xelatex --version')
MiKTeX-XeTeX 2.9.5840 (0.99992) (MiKTeX 2.9)
(C) 1994-2008 by SIL International, (C) 2009-2012 by Jonathan Kew, (C) 2010-2012 by Han Han The Thanh, (C) 2012-2013 by Khaled Hosny
TeX is a trademark of the American Mathematical Society.
compiled with zlib version 1.2.8; using 1.2.8
compiled with libpng version 1.6.19; using 1.6.19
compiled with poppler version 0.32.0
compiled with jpeg version 8.4
compiled with fontconfig version 2.11.94; using 2.11.94
compiled with FreeType2 version 2.5.5; using 2.5.5
compiled with Graphite2 version 1.2.4; using 1.2.4
compiled with ICU version 55.1; using 55.1
compiled with HarfBuzz version 0.9.40; using 0.9.40
using TECkit version 2.4
yihui commented

I cannot think of a possible reason why it could fail to find the figure file. Can you delete the _book directory and try to compile the example to PDF again?

Yihui - thank you. I did remove the _book directory and am still getting errors. I'll try updating my MiKTeX later today to see if that fixes the issues. I ran the "bookdown-demo.tex" file through "TeXworks" (v.0.4.6/MiKTeX 2.9) [r.c29723a] and get the errors noted in the log file below.

In digging through the LOG file, I'm getting what looks like cross-ref errors. For Chapter 2 - I get the following errors. Note: I changed the figure label from nice-fig to niceFig.

Chapter 2.

LaTeX Warning: Reference `intro' on page 7 undefined on input line 158.


LaTeX Warning: Reference `methods' on page 7 undefined on input line 160.

LaTeX Font Info:    Try loading font information for TS1+lmtt on input line 168
.
("C:\Program Files (x86)\MiKTeX 2.9\tex\latex\lm\ts1lmtt.fd"
File: ts1lmtt.fd 2009/10/30 v1.6 Font defs for Latin Modern
)

! LaTeX Error: File `bookdown-demo_files/figure-latex/niceFig-1' not found.

Thank you for the help!
Melinda

yihui commented

Can you add keep_tex: yes to _output.yml and retry? i.e.

bookdown::pdf_book:
  includes:
    in_header: preamble.tex
  latex_engine: xelatex
  citation_package: natbib
  keep_tex: yes

See if _book/bookdown-demo_files/figure-latex/niceFig-1.png exists?

I deleted everything I had before and re-downloaded the Github zipped repository to my local drive (bookdown-demo) to start again fresh.

I then added keep_tex: yes to _output.yml and ran "Build Book" and choose bookdown::pdf_book.

When I check my files there is a figure "nice-fig-1.pdf" located in a slightly different directory "..._book_bookdown_files\bookdown-demo_files\figure-latex"

maybe there is a directory setting that is off?

Note: Building the book to bookdown::gitbook and bookdown::epub_book both seem to be working fine. Just bookdown::pdf_book issues.

oops - sorry the directory is

. . . /_book/_bookdown_files/bookdown-demo_files/figure-latex/nice-fig-1.pdf

yihui commented

Scratching my head for a while and still have no idea how this could possibly happen. Are you available some time tomorrow for a short chat with screensharing?

When you build the book to PDF, do you see a directory bookdown-demo_files appear in the Files panel of RStudio? It only shows up there temporarily and will be moved away later. I have recorded a video to show what is expected to happen: https://dl.dropboxusercontent.com/u/15335397/misc/bookdown-demo.mp4

I might be able to do a online/chat meeting late tomorrow afternoon (4:00 pm EST). However, in the meantime, thank you very much for your video! I also did a quick video capture of what happens when I open the "bookdown-demo.Rproj", then open the "_output.yml" file and add the keep_tex: yes option and then Build the Book using bookdown::pdf_book. I also captured the directory changes so you could see them as they build on my computer. The latex figure does get created but in a slightly different directory & I'm still getting LaTeX "internal errors." See my video of my process and resulting errors at https://youtu.be/MlXuhC4GDjc I suspect it may be user error on my part - maybe I do not have MiKTeX configured correctly or perhaps I should be using a different LaTeX engine in Windows. I'll admit, I'm a bit of a newbie when it comes to LaTeX which is why I love Rmarkdown so much!

yihui commented

Can you move the bookdown-demo_files directory back to the root directory, and try to compile bookdown-demo.tex with xelatex?

Yihui, Thank you. That worked. Is there a directory setting I should update somewhere; or I'll just make a note of this issue and look for updates in the future?

By the way - AWESOME job on bookdown! I've been playing with Gitbook and the rgitbook package for awhile now and having very good success testing this out in workshops and classes. I'll definitely be testing bookdown more in the future. I love being able to compile and disseminate teaching materials, reports and research using these formats and the flexibility to move between online, mobile and hardcopy options.

Also, just curious - any future development planned for being able to support the rmarkdown::word_document() options? The majority of my collaborators and students need/want to work in MS Word and related office software products.

Thank you again for all the time and great feedback! Melinda Higgins

yihui commented

I guess we still have not solved the original issue. The Build Book button still does not work, right? You should not need to open .tex and compile it manually every time. I don't know what went wrong there.

Re: word documents, if you only want to combine multiple Rmd's and generate them into one Word document, that is easy. For other features like figure/table caption numbering / cross-references, I'm afraid they will be tricky to implement.

Yihui, I'll try to run a trace and walk though the specifics on my system and see if I can isolate the directory issue. In the meantime, the workaround is fine. I'll also test out using the KM (knit-then-merge) approach and play around with MS word formats. If I can get 90+% of the document done and exported to Word fixing the cross references later is fine.

Thank you again very much for all the time and insights. If I sort out the issue, I'll add a post in the future. In the meantime, you have my notes in case this shows up for another bookdown user/beta-tester.

:-) Melinda

I'm running into the same issue:

! LaTeX Error: File `bookdown-demo_files/figure-latex/nice-fig-1' not found.

If I run:

bookdown::render_book("index.Rmd", "bookdown::pdf_book",clean=FALSE)

Then I see nice-fig-1.pdf show-up in the figure-latex directory, but for some reason, when compiling the LaTeX file, it can't find this -- is this something to do with the file extension?

The other note that shows-up in my console is:

Error: Failed to compile bookdown-demo.tex. See bookdown-demo.log for more info.
In addition: Warning messages:
1: In FUN(...) :
  Perl must be installed and put on PATH for latexmk to work
2: running command '"pdflatex" -halt-on-error -interaction=batchmode "bookdown-demo.tex"' had status 1 
> 

Moving the *.tex file into the _bookdown_files folder and compiling works.

Windows 7 x64
bookdown 0.0.74
R 3.2.4 (2016-03-10)
MiKTeX-XeTeX 2.9.4987 (0.9999.3) (MiKTeX 2.9)
yihui commented

Could you run the code below and show me the output?

aux_diro = "_bookdown_files"
aux_dirs = bookdown:::files_cache_dirs(aux_diro)
print(aux_dirs)
file.rename(aux_dirs, basename(aux_dirs))

aux_dirs = bookdown:::files_cache_dirs(".")
print(aux_dirs)
bookdown:::dir_create(aux_diro)
file.rename(aux_dirs, file.path(aux_diro, basename(aux_dirs)))

The output should look like this:

> aux_diro = "_bookdown_files"
> aux_dirs = bookdown:::files_cache_dirs(aux_diro)
> print(aux_dirs)
[1] "_bookdown_files/bookdown-demo_files"
> file.rename(aux_dirs, basename(aux_dirs))
[1] TRUE
> 
> aux_dirs = bookdown:::files_cache_dirs(".")
> print(aux_dirs)
[1] "./bookdown-demo_files"
> bookdown:::dir_create(aux_diro)
[1] TRUE
> file.rename(aux_dirs, file.path(aux_diro, basename(aux_dirs)))
[1] TRUE

Yihui, Thank you for still trying to fix this issue. I just got back from vacation.

I downloaded a clean ZIP'd copy of the bookdown-demo-master from this repository. When I opened the Rproj in a clean R session, the Build interface looked different - it said "Build and Reload" - upon inspection I realized the BuildType was set to Package. I changed this to Website and was able to get the Build Book options back.

I ran the bookdown::gitbook and bookdown::epub_book "Build Book" options. Both of these worked fine. When I ran bookdown::pdf_book "Build Book", I get the following errors:

"C:/Program Files/RStudio/bin/pandoc/pandoc" +RTS -K512m -RTS bookdown-demo.utf8.md --to latex --from markdown+autolink_bare_uris+ascii_identifiers+tex_math_single_backslash --output bookdown-demo.tex --table-of-contents --toc-depth 2 --template "C:\Users\MKHIGGI\Documents\R\win-library\3.3\rmarkdown\rmd\latex\default-1.17.0.2.tex" --number-sections --highlight-style tango --latex-engine xelatex --natbib --include-in-header preamble.tex --variable graphics=yes --variable "geometry:margin=1in" --bibliography book --bibliography packages 
output file: bookdown-demo.knit.md

latexmk.exe: MiKTeX encountered an internal error.
Error: Failed to compile bookdown-demo.tex.
In addition: Warning messages:
1: running command '"C:\PROGRA~1\MIKTEX~1.9\miktex\bin\x64\latexmk.exe" -pdf -latexoption=-halt-on-error -interaction=batchmode -pdflatex="xelatex" "bookdown-demo.tex"' had status 1 
2: running command '"C:\PROGRA~1\MIKTEX~1.9\miktex\bin\x64\latexmk.exe" -v' had status 1 
Execution halted

Exited with status 1.

I also ran the commands you listed above, here is my output.

> aux_diro = "_bookdown_files"
> aux_dirs = bookdown:::files_cache_dirs(aux_diro)
> print(aux_dirs)
character(0)
> file.rename(aux_dirs, basename(aux_dirs))
logical(0)
> aux_dirs = bookdown:::files_cache_dirs(".")
> print(aux_dirs)
character(0)
> bookdown:::dir_create(aux_diro)
[1] TRUE
> file.rename(aux_dirs, file.path(aux_diro, basename(aux_dirs)))
logical(0)

Note: after running through all of the above, here is my directory contents:

C:\MyR\bookdown_demo_build\bookdown-demo-master>tree
Folder PATH listing
Volume serial number is AC7D-A6A5
C:.
├───_book
│   ├───bookdown-demo_files
│   │   └───figure-html
│   └───libs
│       ├───gitbook-2.6.7
│       │   ├───css
│       │   │   └───fontawesome
│       │   └───js
│       └───jquery-2.2.3
└───_bookdown_files

and there are no files in the _bookdown_files directory:

C:\MyR\bookdown_demo_build\bookdown-demo-master\_bookdown_files>dir
 Volume in drive C has no label.
 Volume Serial Number is AC7D-A6A5

 Directory of C:\MyR\bookdown_demo_build\bookdown-demo-master\_bookdown_files

07/11/2016  09:34 AM    <DIR>          .
07/11/2016  09:34 AM    <DIR>          ..
               0 File(s)              0 bytes
               2 Dir(s)  86,342,656,000 bytes free

Thank you again for your time and assistance!

Note: I also opened the bookdown-demo.tex file in TeXworks and "compiled" the TEX document. Here are the error messages I get. It looks like the references are undefined and it cannot find the figure given the path it is expecting. There is also no _bookdown-demo_files directory - it was not created in the root directory. There is one in the _book directory - see tree directory listing in above post.

I opened the bookdown-demo.tex file in TeXWorks and compiled it there - here are the errors:
============================================================
This is pdfTeX, Version 3.14159265-2.6-1.40.16 (MiKTeX 2.9 64-bit)
entering extended mode
(C:/MyR/bookdown_demo_build/bookdown-demo-master/bookdown-demo.tex
LaTeX2e <2016/03/31>
Babel <3.9q> and hyphenation patterns for 70 language(s) loaded.
("C:\Program Files\MiKTeX 2.9\tex\latex\base\book.cls"
Document Class: book 2014/09/29 v1.4h Standard LaTeX document class
("C:\Program Files\MiKTeX 2.9\tex\latex\base\bk10.clo"))
("C:\Program Files\MiKTeX 2.9\tex\latex\lm\lmodern.sty")
("C:\Program Files\MiKTeX 2.9\tex\latex\amsfonts\amssymb.sty"
("C:\Program Files\MiKTeX 2.9\tex\latex\amsfonts\amsfonts.sty"))
("C:\Program Files\MiKTeX 2.9\tex\latex\amsmath\amsmath.sty"
For additional information on amsmath, use the `?' option.
("C:\Program Files\MiKTeX 2.9\tex\latex\amsmath\amstext.sty"
("C:\Program Files\MiKTeX 2.9\tex\latex\amsmath\amsgen.sty"))
("C:\Program Files\MiKTeX 2.9\tex\latex\amsmath\amsbsy.sty")
("C:\Program Files\MiKTeX 2.9\tex\latex\amsmath\amsopn.sty"))
("C:\Program Files\MiKTeX 2.9\tex\generic\ifxetex\ifxetex.sty")
("C:\Program Files\MiKTeX 2.9\tex\generic\oberdiek\ifluatex.sty")
("C:\Program Files\MiKTeX 2.9\tex\latex\base\fixltx2e.sty"

Package fixltx2e Warning: fixltx2e is not required with releases after 2015
(fixltx2e)                All fixes are now in the LaTeX kernel.
(fixltx2e)                See the latexrelease package for details.

) ("C:\Program Files\MiKTeX 2.9\tex\latex\base\fontenc.sty"
("C:\Program Files\MiKTeX 2.9\tex\latex\base\t1enc.def"))
("C:\Program Files\MiKTeX 2.9\tex\latex\base\inputenc.sty"
("C:\Program Files\MiKTeX 2.9\tex\latex\base\utf8.def"
("C:\Program Files\MiKTeX 2.9\tex\latex\base\t1enc.dfu")
("C:\Program Files\MiKTeX 2.9\tex\latex\base\ot1enc.dfu")
("C:\Program Files\MiKTeX 2.9\tex\latex\base\omsenc.dfu")))
("C:\Program Files\MiKTeX 2.9\tex\latex\upquote\upquote.sty"
("C:\Program Files\MiKTeX 2.9\tex\latex\base\textcomp.sty"
("C:\Program Files\MiKTeX 2.9\tex\latex\base\ts1enc.def"
("C:\Program Files\MiKTeX 2.9\tex\latex\base\ts1enc.dfu"))))
("C:\Program Files\MiKTeX 2.9\tex\latex\microtype\microtype.sty"
("C:\Program Files\MiKTeX 2.9\tex\latex\graphics\keyval.sty")
("C:\Program Files\MiKTeX 2.9\tex\latex\microtype\microtype-pdftex.def")
("C:\Program Files\MiKTeX 2.9\tex\latex\microtype\microtype.cfg"))
("C:\Program Files\MiKTeX 2.9\tex\latex\geometry\geometry.sty"
("C:\Program Files\MiKTeX 2.9\tex\generic\oberdiek\ifpdf.sty")
("C:\Program Files\MiKTeX 2.9\tex\generic\oberdiek\ifvtex.sty")
("C:\Program Files\MiKTeX 2.9\tex\latex\geometry\geometry.cfg"))
("C:\Program Files\MiKTeX 2.9\tex\latex\hyperref\hyperref.sty"
("C:\Program Files\MiKTeX 2.9\tex\generic\oberdiek\hobsub-hyperref.sty"
("C:\Program Files\MiKTeX 2.9\tex\generic\oberdiek\hobsub-generic.sty"))
("C:\Program Files\MiKTeX 2.9\tex\latex\oberdiek\auxhook.sty")
("C:\Program Files\MiKTeX 2.9\tex\latex\oberdiek\kvoptions.sty")
("C:\Program Files\MiKTeX 2.9\tex\latex\hyperref\pd1enc.def")
("C:\Program Files\MiKTeX 2.9\tex\latex\00miktex\hyperref.cfg")
("C:\Program Files\MiKTeX 2.9\tex\latex\url\url.sty"))

Package hyperref Message: Driver (autodetected): hpdftex.

("C:\Program Files\MiKTeX 2.9\tex\latex\hyperref\hpdftex.def"
("C:\Program Files\MiKTeX 2.9\tex\latex\oberdiek\rerunfilecheck.sty"))
("C:\Program Files\MiKTeX 2.9\tex\latex\hyperref\puenc.def")
("C:\Program Files\MiKTeX 2.9\tex\latex\natbib\natbib.sty")
("C:\Program Files\MiKTeX 2.9\tex\latex\graphics\color.sty"
("C:\Program Files\MiKTeX 2.9\tex\latex\00miktex\color.cfg")
("C:\Program Files\MiKTeX 2.9\tex\latex\pdftex-def\pdftex.def"))
("C:\Program Files\MiKTeX 2.9\tex\latex\fancyvrb\fancyvrb.sty"
Style option: `fancyvrb' v2.7a, with DG/SPQR fixes, and firstline=lastline fix 
<2008/02/07> (tvz)) ("C:\Program Files\MiKTeX 2.9\tex\latex\framed\framed.sty")
 ("C:\Program Files\MiKTeX 2.9\tex\latex\graphics\graphicx.sty"
("C:\Program Files\MiKTeX 2.9\tex\latex\graphics\graphics.sty"
("C:\Program Files\MiKTeX 2.9\tex\latex\graphics\trig.sty")
("C:\Program Files\MiKTeX 2.9\tex\latex\00miktex\graphics.cfg")))
("C:\Program Files\MiKTeX 2.9\tex\latex\oberdiek\grffile.sty")
("C:\Program Files\MiKTeX 2.9\tex\latex\ltxmisc\parskip.sty")
("C:\Program Files\MiKTeX 2.9\tex\latex\booktabs\booktabs.sty")
("C:\Program Files\MiKTeX 2.9\tex\latex\titling\titling.sty")
No file bookdown-demo.aux.
("C:\Program Files\MiKTeX 2.9\tex\latex\base\ts1cmr.fd")
("C:\Program Files\MiKTeX 2.9\tex\latex\lm\t1lmr.fd")
("C:\Program Files\MiKTeX 2.9\tex\latex\microtype\mt-cmr.cfg")
*geometry* driver: auto-detecting
*geometry* detected driver: pdftex
("C:\Program Files\MiKTeX 2.9\tex\latex\hyperref\nameref.sty"
("C:\Program Files\MiKTeX 2.9\tex\generic\oberdiek\gettitlestring.sty"))
("C:\Program Files\MiKTeX 2.9\tex\context\base\supp-pdf.mkii"
[Loading MPS to PDF converter (version 2006.09.02).]
) ("C:\Program Files\MiKTeX 2.9\tex\latex\oberdiek\epstopdf-base.sty"
("C:\Program Files\MiKTeX 2.9\tex\latex\oberdiek\grfext.sty")) [1{C:/Users/MKHI
GGI/AppData/Local/MiKTeX/2.9/pdftex/config/pdftex.map}] [2] [3] [4]
Chapter 1.
("C:\Program Files\MiKTeX 2.9\tex\latex\lm\ot1lmr.fd")
("C:\Program Files\MiKTeX 2.9\tex\latex\lm\omllmm.fd")
("C:\Program Files\MiKTeX 2.9\tex\latex\lm\omslmsy.fd")
("C:\Program Files\MiKTeX 2.9\tex\latex\lm\omxlmex.fd")
("C:\Program Files\MiKTeX 2.9\tex\latex\amsfonts\umsa.fd")
("C:\Program Files\MiKTeX 2.9\tex\latex\microtype\mt-msa.cfg")
("C:\Program Files\MiKTeX 2.9\tex\latex\amsfonts\umsb.fd")
("C:\Program Files\MiKTeX 2.9\tex\latex\microtype\mt-msb.cfg")
("C:\Program Files\MiKTeX 2.9\tex\latex\lm\t1lmtt.fd") [5] [6]
Chapter 2.

LaTeX Warning: Reference `intro' on page 7 undefined on input line 159.


LaTeX Warning: Reference `methods' on page 7 undefined on input line 161.

("C:\Program Files\MiKTeX 2.9\tex\latex\lm\ts1lmtt.fd")

! LaTeX Error: File `bookdown-demo_files/figure-latex/nice-fig-1' not found.

See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.
 ...                                              

l.175 ...kdown-demo_files/figure-latex/nice-fig-1}

? 

Note: here is the relevant section of the bookdown-demo.tex file that throws the errors for the 'intro' and 'methods' references not found as well as the 'nice-fig-1' not found error.

\chapter{Introduction}\label{intro}

You can label chapter and section titles using \texttt{\{\#label\}}
after them, e.g., we can reference Chapter \ref{intro}. If you do not
manually label them, there will be automatic labels anyway, e.g.,
Chapter \ref{methods}.

Figures and tables with captions will be placed in \texttt{figure} and
\texttt{table} environments, respectively.

\begin{Shaded}
\begin{Highlighting}[]
\KeywordTok{par}\NormalTok{(}\DataTypeTok{mar =} \KeywordTok{c}\NormalTok{(}\DecValTok{4}\NormalTok{, }\DecValTok{4}\NormalTok{, .}\DecValTok{1}\NormalTok{, .}\DecValTok{1}\NormalTok{))}
\KeywordTok{plot}\NormalTok{(pressure, }\DataTypeTok{type =} \StringTok{'b'}\NormalTok{, }\DataTypeTok{pch =} \DecValTok{19}\NormalTok{)}
\end{Highlighting}
\end{Shaded}

\begin{figure}

{\centering \includegraphics[width=0.8\linewidth]{bookdown-demo_files/figure-latex/nice-fig-1} 

}

\caption{Here is a nice figure!}\label{fig:nice-fig}
\end{figure}
yihui commented

Okay, I guess there are two issues here. Can you first run shell('latexmk -v')? I'll think about the second possible issue. And also make sure you have the latest version of bookdown: devtools::install_github('rstudio/bookdown')

Here is the output from `shell('latexmk -v')

> shell('latexmk -v')

Latexmk, John Collins, 24 February 2016. Version 4.44

I'll download the latest version of bookdown and try again... I'll send an update shortly...

yihui commented

How about system2('latexmk', '-v')?

That returned an error...

> system2('latexmk', '-v')
latexmk.exe: MiKTeX encountered an internal error.
Warning message:
running command '"latexmk" -v' had status 1 
yihui commented

Okay, that is one issue I need to figure out. For now, could you test this?

devtools::install_github('yihui/rmarkdown@bugfix/windows-install-latexmk')

Note you may need to restart your R session.

I had to first install the mime package and then the current version of bookdown would install.

I also ran devtools::install_github('yihui/rmarkdown@bugfix/windows-install-latexmk') and it loaded ok.

I then ran "Build Book" using bookdown::pdf_book and the bookdown-demo_files directory was created, but then after about 20 sec, the PDF preview window opened and the directory went away. But the PDF bookdown-demo.pdf was created in the _book directory and the references and figure look good.

Is there a 'bug fix' I need to apply for my LaTeX installation or is this a patch for the rmarkdown package? (just curious).

But this appears to have worked.

yihui commented

bookdown-demo_files will be moved to _bookdown_files after the PDF is created, so what you observed is normal.

Okay, the original problem seems to be due to system2() not being able to execute latexmk. I don't think there is anything to fix on your side. I can probably provide another fix in rmarkdown, but since you are able to create the PDF now, it may not be of high priority.

Sounds good. I'll stay tuned for updates to rmarkdown. I have had good luck running system() commands but often get errors with system2() commands.

For example:

> system('jekyll -v')
jekyll 3.1.6
> system2('jekyll -v')
Warning message:
running command '"jekyll -v"' had status 127 
yihui commented

Actually you should run system2('jekyll', '-v'). Does that work?

I'm following the progress you guys are making.

I've run:
devtools::install_github('yihui/rmarkdown@bugfix/windows-install-latexmk')
Which ran successfully.

When I run system2('latexmk', '-v') I get:

latexmk.exe: The Perl interpreter could not be found.
Warning message:
running command '"latexmk" -v' had status 1 

Looks like I have a slightly different underlying issue.

yihui commented

@mikebirdgeneau Yes, yours is different -- it seems you didn't install Perl. That is actually fine. rmarkdown will just use a fallback method to compile LaTeX. To be clear, are you able to get the PDF now?

yes, that worked:

> system2('jekyll', '-v')
jekyll 3.1.6

but the latexmk command still gives me an error.

> system2('latexmk', '-v')
latexmk.exe: MiKTeX encountered an internal error.
Warning message:
running command '"latexmk" -v' had status 1 

I missed the slight syntax difference between system() and system2() - thank you.

Yes, with the devtools::install_github('yihui/rmarkdown@bugfix/windows-install-latexmk') I am able to produce the PDF file.

yihui commented

@melindahiggins2000 latexmk seems to be a different animal that I don't understand. Anyway, I think you can just ignore this latexmk issue as long as the patched version of rmarkdown gives you the PDF.

No problem. It is a weird issue.

From the RStudio Console if I type:

> system('latexmk -v')
latexmk.exe: MiKTeX encountered an internal error.
Warning message:
running command 'latexmk -v' had status 1 

I get an error. But from my Windows Command window - it works fine.

C:\MyR\bookdown_demo_build\bookdown-demo-master>latexmk -v

Latexmk, John Collins, 24 February 2016. Version 4.44

Oh well. I'll use the rmarkdown workaround for how. Thank you!

yihui commented

Yeah I feel latexmk needs a shell to be executed on Windows. That is quite unusual.

I get a similar error if I try to get my path listing from the RStudio Console window

> system('path')
Warning message:
running command 'path' had status 127

but the path command works fine from the Windows Command line.

What is even weirder is that the jekyll -v command works fine from either the RStudio console window:

> system('jekyll -v')
jekyll 3.1.6

or in the Windows console:

C:\MyR\bookdown_demo_build\bookdown-demo-master>jekyll -v
jekyll 3.1.6

maybe something going on with system() commands? I tried these using shell() and they worked...

FYI - the shell() commands - from my RStudio Console:

> shell('jekyll -v')
jekyll 3.1.6
> shell('latexmk -v')

Latexmk, John Collins, 24 February 2016. Version 4.44
> shell('path')
PATH=C:\Program Files\R\R-3.3.0\bin\x64;C:\ProgramData\Oracle\Java\javapath;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\MATLAB\R2015b\runtime\win64;C:\Program Files\MATLAB\R2015b\bin;C:\Program Files\nodejs\;C:\Program Files (x86)\Skype\Phone\;C:\Strawberry\c\bin;C:\Strawberry\perl\site\bin;C:\Strawberry\perl\bin;C:\Program Files\MiKTeX 2.9\miktex\bin\x64\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Calibre2\;C:\Program Files (x86)\Pandoc\;C:\Ruby22-x64\bin;C:\Users\MKHIGGI\AppData\Roaming\npm
> 

what is the difference between shell() and system()?

yihui commented

As its name indicated, shell() uses a shell to execute the command (e.g. cmd.exe), and system2() executes the command directly.

Thank you for the clarification and all your time and effort tracking down these issues!

@yihui I'm not able to compile the PDF still (on Windows at least):

Output of:

bookdown::render_book("index.Rmd", "bookdown::pdf_book")

is:

Latexmk, John Collins, 22 April 2016. Version 4.45
Error: Failed to compile bookdown-demo.tex.
In addition: Warning messages:
1: running command '"C:\PROGRA~2\MIKTEX~1.9\miktex\bin\latexmk.exe" -v' had status 1 
2: The LaTeX package latexmk was not correctly installed. 
3: running command '"C:\PROGRA~2\MIKTEX~1.9\miktex\bin\latexmk.exe" -v' had status 1 
4: In FUN(...) :
  Perl must be installed and put on PATH for latexmk to work
5: running command '"xelatex" -halt-on-error -interaction=batchmode "bookdown-demo.tex"' had status

It all works great on OSX / Linux.

yihui commented

@mikebirdgeneau Could you run the code below and show its output?

list.files()

aux_diro = "_bookdown_files"
aux_dirs = bookdown:::files_cache_dirs(aux_diro)
print(aux_dirs)
file.rename(aux_dirs, basename(aux_dirs))

aux_dirs = bookdown:::files_cache_dirs(".")
print(aux_dirs)
bookdown:::dir_create(aux_diro)
file.rename(aux_dirs, file.path(aux_diro, basename(aux_dirs)))

library(rmarkdown)
devtools::session_info()
> list.files()
 [1] "_book"               "_bookdown.yml"       "_bookdown_files"     "_output.yml"         "01-intro.Rmd"       
 [6] "02-literature.Rmd"   "03-method.Rmd"       "04-application.Rmd"  "05-summary.Rmd"      "06-references.Rmd"  
[11] "book.bib"            "bookdown-demo.log"   "bookdown-demo.Rproj" "bookdown-demo.tex"   "index.Rmd"          
[16] "LICENSE"             "packages.bib"        "preamble.tex"        "prerequisites.html"  "README.md"          
[21] "style.css"           "toc.css"            
> aux_diro = "_bookdown_files"
> aux_dirs = bookdown:::files_cache_dirs(aux_diro)
> print(aux_dirs)
character(0)
> file.rename(aux_dirs, basename(aux_dirs))
logical(0)
> aux_dirs = bookdown:::files_cache_dirs(".")
> print(aux_dirs)
character(0)
> bookdown:::dir_create(aux_diro)
[1] TRUE
> file.rename(aux_dirs, file.path(aux_diro, basename(aux_dirs)))
logical(0)
> library(rmarkdown)
> devtools::session_info()
Session info --------------------------------------------------------------------------------------------------------
 setting  value                       
 version  R version 3.2.4 (2016-03-10)
 system   x86_64, mingw32             
 ui       RStudio (0.99.484)          
 language (EN)                        
 collate  English_United States.1252  
 tz       America/Denver              
 date     2016-07-11                  

Packages ------------------------------------------------------------------------------------------------------------
 package   * version date       source                           
 bookdown    0.0.79  2016-07-11 Github (rstudio/bookdown@8fd8a8c)
 devtools    1.12.0  2016-06-24 CRAN (R 3.2.5)                   
 digest      0.6.9   2016-01-08 CRAN (R 3.2.3)                   
 evaluate    0.9     2016-04-29 CRAN (R 3.2.5)                   
 formatR     1.4     2016-05-09 CRAN (R 3.2.5)                   
 highr       0.6     2016-05-09 CRAN (R 3.2.5)                   
 htmltools   0.3.5   2016-03-21 CRAN (R 3.2.5)                   
 httpuv      1.3.3   2015-08-04 CRAN (R 3.2.4)                   
 knitr       1.13.2  2016-07-11 Github (yihui/knitr@40d825e)     
 magrittr    1.5     2014-11-22 CRAN (R 3.2.4)                   
 memoise     1.0.0   2016-01-29 CRAN (R 3.2.4)                   
 mime        0.4     2015-09-03 CRAN (R 3.2.3)                   
 miniUI      0.1.1   2016-01-15 CRAN (R 3.2.3)                   
 R6          2.1.2   2016-01-26 CRAN (R 3.2.4)                   
 Rcpp        0.12.5  2016-05-14 CRAN (R 3.2.5)                   
 rmarkdown * 1.0     2016-07-11 Github (yihui/rmarkdown@ce3f4a8) 
 shiny       0.13.2  2016-03-28 CRAN (R 3.2.5)                   
 stringi     1.1.1   2016-05-27 CRAN (R 3.2.5)                   
 stringr     1.0.0   2015-04-30 CRAN (R 3.2.4)                   
 withr       1.0.2   2016-06-20 CRAN (R 3.2.5)                   
 xtable      1.8-2   2016-02-05 CRAN (R 3.2.4)                   
 yaml        2.1.13  2014-06-12 CRAN (R 3.2.4)                   

It looks like my call to print(aux_dirs) isn't returning [1] "./bookdown-demo_files"

Could it be related to my RStudio version?
ui RStudio (0.99.484)

@mikebirdgeneau I also get a similar result where print(aux_dirs) returns character(0). I'm running Windows10 OS.

yihui commented

@mikebirdgeneau I don't think the RStudio version is relevant, but you may try to upgrade anyway: https://www.rstudio.com/products/rstudio/download/preview/

Are there any directories under _bookdown_files?

I'll try upgrading as soon as some stuff I have running finishes. There are no files in that directory it's all empty.

> list.files(path = "_bookdown_files")
character(0)

I added keep_tex: true back into my _output.yml file, and got this:

output file: bookdown-demo.knit.md

"C:/Program Files/RStudio/bin/pandoc/pandoc" +RTS -K512m -RTS bookdown-demo.utf8.md --to latex --from markdown+autolink_bare_uris+ascii_identifiers+tex_math_single_backslash --output bookdown-demo.tex --table-of-contents --toc-depth 2 --template "U:\R\win-library\3.2\rmarkdown\rmd\latex\default.tex" --number-sections --highlight-style tango --latex-engine xelatex --natbib --include-in-header preamble.tex --variable graphics=yes --variable "geometry:margin=1in" --variable tables=yes --standalone --bibliography book --bibliography packages 

Latexmk, John Collins, 22 April 2016. Version 4.45
! LaTeX Error: File `pdftex.def' not found.

! Emergency stop.
<read *> 

Error: Failed to compile bookdown-demo.tex. See bookdown-demo.log for more info.
In addition: Warning messages:
1: running command '"C:\PROGRA~2\MIKTEX~1.9\miktex\bin\latexmk.exe" -v' had status 1 
2: The LaTeX package latexmk was not correctly installed. 
3: running command '"C:\PROGRA~2\MIKTEX~1.9\miktex\bin\latexmk.exe" -v' had status 1 
4: In FUN(...) :
  Perl must be installed and put on PATH for latexmk to work
5: running command '"xelatex" -halt-on-error -interaction=batchmode "bookdown-demo.tex"' had status 1 
> 

And then:

> list.files(path = "_bookdown_files",recursive = TRUE)
[1] "bookdown-demo_files/figure-latex/nice-fig-1.pdf"

I'm going to see if I'm missing pdftex-def from my LaTeX install.

I haven't had a chance to check this out - but I'm wondering if there is a disconnect between my Perl installation and the latexmk package in my MiKTeX installation. I have "Strawberry Perl" installed which places the perl.exe in this directory C:\Strawberry\perl\bin

According to this 2010 post, latexmk expects to find perl.exe in the C:\perl\bin directory. see post at http://www.latex-community.org/forum/viewtopic.php?f=5&t=12566.

I'll check this out tomorrow. I may see if there is a custom option for setting the default directories when Strawberry Perl is installed and/or may try installing ActiveState Perl instead - see https://www.perl.org/get.html#win32

Let me know if you (@mikebirdgeneau) try this and it works...

yihui commented

@melindahiggins2000 I don't think the location of perl.exe matters. I installed ActiveState Perl on Windows, and it works fine for me. It must be a different issue in @mikebirdgeneau's case.

@yihui you are correct. Moving my Perl installation directory had no effect. When I "Build Book" with bookdown::pdf_book I now get the PDF file (thank you), but still get a few LaTeX error messages at the end (see below). But other than it being a nagging issue I haven't solved yet, everything is working ok. Thank you!

Remaining error messages at the end of the "Build Book" to PDF log - something with latexmk and perl.

output file: bookdown-demo.knit.md


Latexmk, John Collins, 24 February 2016. Version 4.44

Output created: _book/bookdown-demo.pdf
Warning messages:
1: running command '"C:\PROGRA~1\MIKTEX~1.9\miktex\bin\x64\latexmk.exe" -v' had status 1 
2: The LaTeX package latexmk was not correctly installed. 
3: running command '"C:\PROGRA~1\MIKTEX~1.9\miktex\bin\x64\latexmk.exe" -v' had status 1 
4: In FUN(...) :
  Perl must be installed and put on PATH for latexmk to work
yihui commented

@melindahiggins2000 It is safe to ignore these warnings.

@mikebirdgeneau I really cannot figure out what was wrong in your case. Here is probably my last blind attempt:

devtools::install_github('yihui/rmarkdown@windows-shell')

If this still does not fix your issue, the only possible way to figure out a solution is to chat with you with screensharing. You may also try to upgrade R/RStudio to the latest versions, and reinstall MikTeX.

@yihui Sounds good. I have updated all of my packages in MiKTeX 2.9 (64bit) and installed the latest version of Perl from ActiveState (after removing Strawberry Perl). I still get the same warning messages when I build the PDF book, but the PDF output looks fine, so I'll ignore the messages. This is along the same lines as the issue thread at rstudio/bookdown#121. I have every faith the latexmk issue will be sorted out for the bookdown::pdf_book build on windows eventually. Thanks again.

Here's the progress I've made:

  1. Installed the latest version of Rstudio Preview
  2. Uninstalled MiKTeX.
  3. Reinstalled MiKTeX in a directory that avoids any ~ expansion for example: C:\PROGRA~1\...\ so I just used C:\miktex\ when installing.
  4. in the MiKTeX package manager, I installed the graphics-def package, because it is needed for xetex.def.
  5. Put the location of ...\perl\bin\ in my windows environment PATH variable.
  6. Installed the latest versions of rmarkdown & bookdown
devtools::install_github('rstudio/rmarkdown')
devtools::install_github('rstudio/bookdown')

Once I do this, I'm able to build the PDF without any issues, when using the command:

bookdown::render_book("index.Rmd", "bookdown::pdf_book",clean = TRUE)

I'm not sure which of these actually resolved my problem, but I can render a PDF now without any moving of *.tex files and separate rendering commands.


The only other thing I've noted through all of this is that I've got code in another bookdown project I'm working on that is as follows (in index.Rmd):

#```{r global_options, include=FALSE}
#knitr::opts_chunk$set(fig.width=8, fig.height=4, out.width = "90%", echo=FALSE, warning=FALSE, #message=FALSE,fig.align = 'center',dev = 'png', fig.ext = "png")
# ```

With all the recent changes, I'm now getting unexpected output showing-up in my PDF -- items that I would have thought are removed by echo=FALSE. It looks like this global opts_chunk isn't working for me. If I wrap the offending code in `invisible({...})``` then it solves it , but I was hoping to avoid having to type this - is there a different argument I should be adding?

I've got the chapter Rmd files, but I also reference sub documents using syntax like:

#```{r child="./subcontent/subdocument01.Rmd"}
#``` 

Great work on this package! It's shaping up nicely. Hope this helps.

yihui commented

@mikebirdgeneau You probably mean results = 'hide' instead of echo = FALSE. The latter means hiding the R source code.

Thanks @yihui - I've tried that, I'm trying to use knitr::kable to output some tables. I'm using the data.table package to manipulate some data, and I believe the := statements are showing up in the output.

Here's an example:

invisible({
  table.data <- subset(dt,select=c(col1,col2,col3))
  table.data[,col4:=round(col1+col2/col3,0),]
knitr::kable(table.data,caption = "Example Table",booktabs = TRUE)

So I don't want to hide results, but I don't want the intermediate output from data.table showing up either. Wrapping the code in invisible seems to solve the problem. It's just not elegant.

I'm really happy the compilation is working now! This package is great. 👍

yihui commented

Okay, this issue is specific to data.table then. I have seen this issue come and go in the past. I don't understand the magic in data.table, and you need to seek help from Matt.

znmeb commented

I'm coming in late, but I've got the "Perl must be installed and put on PATH for latexmk to work" issue. I installed the whole MikTeX 64-bit package; I assumed it had a copy of Perl if it needed it. I've got two versions of Perl on my machine - LyX carries one and Git for Windows carries one. Both seem to be 5.22. So I think it's just a matter of setting the Windows PATH variable. But if MikTeX needs Perl its installer should set that up ... this certainly isn't a Bookdown issue.

yihui commented

MikTeX does not require Perl or bundle Perl with it. It is latexmk that requires Perl.

znmeb commented

How does latexmk get installed? Via the MikTeX installer?

yihui commented

Yes, but I don't think it is unreasonable for MikTeX not to install Perl for latexmk. It is just like when an R package depends on an external program, and install.packages() won't install the external system dependency. latexmk is essentially a Perl script, so you have to make sure Perl is accessible. Anyway, it is only a warning message, and you can safely ignore it. rmarkdown has a fallback method to compile LaTeX documents when latexmk cannot be used.

znmeb commented

Ah ... OK ... as long as the PDF gets created somehow.

Hi all,

I have been following this thread as well... get the following error while trying to Build Book from build options.

Sorry, but C:\PROGRA1\MIKTEX1.9\miktex\bin\x64\xelatex.exe did not succeed.

The log file hopefully contains the information to get MiKTeX going again:

C:/Users/Sreekumar/AppData/Local/MiKTeX/2.9/miktex/log/xelatex.log``

And the log says:

2016-08-04 12:20:16,802+0530 FATAL xelatex - GUI framework cannot be initialized. 2016-08-04 12:20:16,803+0530 FATAL xelatex - Info: 2016-08-04 12:20:16,803+0530 FATAL xelatex - Source: Libraries\MiKTeX\UI\Qt\mikuiqt.cpp 2016-08-04 12:20:16,803+0530 FATAL xelatex - Line: 45

Would really appreciate your assistance. I have been on this for the last couple of days.

yihui commented

@sreejimalayil In this case you can try to change the option for automatically installing missing LaTeX packages: http://docs.miktex.org/manual/autoinstall.html I think the default is to ask you whether to install them. Change the option to either never ask or don't automatically install from Start menu -> MikTeX -> a certain menu for MikTeX options.

Thanks to all in this thread. I have been following along. I am having the same issue with creating the pdf from an rmarkdown Tufte handout template. I am on a Windows platform and have followed the the steps outlined by @mikebirdgeneau to reinstall MikTeX and the graphics-def package.

The rMarkdonw error reads:
Sorry, but C:\PROGRA1\MIKTEX1.9\miktex\bin\x64\xelatex.exe did not succeed.

The log file hopefully contains the information to get MiKTeX going again:

C:/Users/aduncan/AppData/Local/MiKTeX/2.9/miktex/log/xelatex.log

You may want to visit the MiKTeX project page, if you need help.

Output created: factor_model_markdown.pdf
Error in tools::file_path_as_absolute(output_file) :
file 'factor_model_markdown.pdf' does not exist
Calls: ->
In addition: There were 14 warnings (use warnings() to see them)
Execution halted

The xelatex.log file contains similar messages to @sreejimalayil shown here:

2016-08-07 07:47:45,484-0400 INFO xelatex - going to create file: xelatex.fmt
2016-08-07 07:47:47,255-0400 FATAL xelatex - GUI framework cannot be initialized.
2016-08-07 07:47:47,256-0400 FATAL xelatex - Info:
2016-08-07 07:47:47,256-0400 FATAL xelatex - Source: Libraries\MiKTeX\UI\Qt\mikuiqt.cpp
2016-08-07 07:47:47,256-0400 FATAL xelatex - Line: 45
2016-08-07 07:47:47,828-0400 FATAL xelatex - GUI framework cannot be initialized.
2016-08-07 07:47:47,828-0400 FATAL xelatex - Info:
2016-08-07 07:47:47,828-0400 FATAL xelatex - Source: Libraries\MiKTeX\UI\Qt\mikuiqt.cpp
2016-08-07 07:47:47,828-0400 FATAL xelatex - Line: 45
...

Not really sure where to go

Session Info:
R version 3.3.1 (2016-06-21)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 7 x64 (build 7601) Service Pack 1

locale:
[1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252
[3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C
[5] LC_TIME=English_United States.1252

attached base packages:
[1] stats graphics grDevices utils datasets methods base

loaded via a namespace (and not attached):
[1] Rcpp_0.12.5 tufte_0.2 lattice_0.20-33 tidyr_0.5.1 digest_0.6.9
[6] psych_1.6.6 dplyr_0.5.0 assertthat_0.1 grid_3.3.1 R6_2.1.2
[11] plyr_1.8.4 nlme_3.1-128 DBI_0.4-1 magrittr_1.5 evaluate_0.9
[16] stringi_1.1.1 reshape2_1.4.1 rmarkdown_1.0.9002 tools_3.3.1 stringr_1.0.0
[21] broom_0.4.1 yaml_2.1.13 parallel_3.3.1 rsconnect_0.4.3 mnormt_1.5-4
[26] htmltools_0.3.5 knitr_1.13 tibble_1.1

Sorry, accidentally posted before i could say thanks, Yihui, and before I could style the comment. Any guidance is super appreciated.

yihui commented

@gtog The message GUI framework cannot be initialized indicates that your current setting is to make MikTeX ask whether to install the missing packages, and you need to change this setting (either automatically install, or just do not install and fail).

I figured as much from your earlier comments above. I'll turn that off and manually note and install all the latex packages it cries about and see if that works to compile the pdf. If that resolves the issue, I'll comment here. Thanks, Yihui.

Yihui,

I finally managed to get this running.
My version of Miktek wouldn't update packages automatically; so had to go through the painful process of updating one by one manually.
Much thanks to all respondents in this thread.

znmeb commented

@sreejimalayil You can change the "Update-on-the-fly" setting:

  1. In the Windows Start menu, start "MiKTeX 2.9 → Maintenance (Admin) → Settings (Admin)"
  2. You'll see drop-downs for on-the-fly packages and paper size. Change the on-the-fly setting to "Yes".

Thanks to everybody for their work so far!

Today I still encountered the following warnings after creating a pdf_book.
error

BUT -- I have MikTex 2.9 (two.nine, NOT 1.9) installed. So - perhaps someone tries to find latexmk.exe in MikTex 1.9 and doesn't find it there?

Unfortunately I can't help any further - I have no idea, what -- or if at all -- this means...

yihui commented

@tinu-schneider Don't be confused by 1.9 -- it is just part of the short path name in the 8.3 format https://support.microsoft.com/en-us/kb/142982 The actual path, I believe, is 2.9.

It is safe to ignore these warnings, and actually I have removed these warnings in rmarkdown.
You can install the development version via

devtools::install_github('rstudio/rmarkdown')

Thank you. This cleans up my Build output using bookdown::pdf_output.

Thank you @yihui. So I ignore the warnings as the generated book is OK.

Problem:
I had the GUI framework cannot be initialized problem even though my MiKTeX option was
Install missing packages on-the-fly: Yes.

Soln:
I had to open the Windows command prompt to bookdown-demo-master\_book and run the following:
%PATH_TO_XELATEX_EXE%\xelatex.exe bookdown-demo.tex

Cause of problem:
And found that I need to authenticate for the http proxy even though that has been explictly updated in my MiKTeX Package Manager earlier. weird...

I fixed this by deleting knitr::opts_chunk$set(dev = "svg") in my Rmd file

I fixed this by deleting knitr::opts_chunk$set(dev = "svg") in my Rmd file

me too, thanks guy