# Error: Failed to compile test-bookdown.tex. #474

Closed
opened this issue Oct 11, 2017 · 14 comments

### petzi53 commented Oct 11, 2017

 I am using the bookdown minimal example by installing it via RStudio "New project…" -> "New directory" -> "Book Project using bookdown". I called this new project "test-bookdown" Immediately after the installation I tried to push the files to my account at bookdown.org and got the error message Error: Failed to compile test-bookdown.tex. I reported the full transcript of the error message in the second half of my post at StackOverflow My Session info data are:  Session info ------------------------------------------------------------------------------------------------ setting value version R version 3.4.2 (2017-09-28) system x86_64, darwin15.6.0 ui RStudio (1.1.383) language (EN) collate en_US.UTF-8 tz Europe/Vienna date 2017-10-11 Packages ---------------------------------------------------------------------------------------------------- package * version date source backports 1.1.1 2017-09-25 CRAN (R 3.4.2) base64enc 0.1-3 2015-07-28 CRAN (R 3.4.0) bitops 1.0-6 2013-08-17 CRAN (R 3.4.0) bookdown 0.5.4 2017-10-07 Github (6436e5e) caTools 1.17.1 2014-09-10 CRAN (R 3.4.0) digest 0.6.12 2017-01-27 CRAN (R 3.4.0) evaluate 0.10.1 2017-06-24 CRAN (R 3.4.1) graphics * 3.4.2 2017-10-04 local grDevices * 3.4.2 2017-10-04 local highr 0.6 2016-05-09 CRAN (R 3.4.0) htmltools 0.3.6 2017-04-28 CRAN (R 3.4.0) jsonlite 1.5 2017-06-01 CRAN (R 3.4.0) knitr 1.17 2017-08-10 CRAN (R 3.4.1) magrittr 1.5 2014-11-22 CRAN (R 3.4.0) markdown 0.8 2017-04-20 CRAN (R 3.4.0) methods * 3.4.2 2017-10-04 local mime 0.5 2016-07-07 CRAN (R 3.4.0) Rcpp 0.12.13 2017-09-28 CRAN (R 3.4.2) rmarkdown 1.6.0.9004 2017-10-07 Github (rstudio/rmarkdown@d31ec87) rprojroot 1.2 2017-01-16 CRAN (R 3.4.0) stats * 3.4.2 2017-10-04 local stringi 1.1.5 2017-04-07 CRAN (R 3.4.0) stringr 1.2.0 2017-02-18 CRAN (R 3.4.0) tools 3.4.2 2017-10-04 local utils * 3.4.2 2017-10-04 local yaml 2.1.14 2016-11-12 CRAN (R 3.4.0) [1] ‘1.19.2.1’ pdfTeX 3.14159265-2.6-1.40.18 (TeX Live 2017) kpathsea version 6.2.3 Copyright 2017 Han The Thanh (pdfTeX) et al. There is NO warranty. Redistribution of this software is covered by the terms of both the pdfTeX copyright and the Lesser GNU General Public License. For more information about these matters, see the file named COPYING and the pdfTeX source. Primary author of pdfTeX: Han The Thanh (pdfTeX) et al. Compiled with libpng 1.6.29; using libpng 1.6.29 Compiled with zlib 1.2.11; using zlib 1.2.11 Compiled with xpdf version 3.04 From another post, I got the impression that the warning message about latexmk is not essential.But I have installed the latest versions… Help would be very much appreciated. Where should I look, what should I try?

Member

### yihui commented Oct 13, 2017

 Could you make gitbook the first output format in _output.yml as I did in 892839b and retry? bookdown.org does not support building PDF on the server side at the moment; I recommend you to use bookdown::publish_book() if it still fails to publish using the Publish button in RStudio.
Author

### petzi53 commented Oct 13, 2017 • edited

 Thanks for your answer. I did as you recommended but still, I got the same error message with the exception of the first line Failed to compile test-bookdown.tex. I add this error message in context, starting with the last line which seems ok: 2017/10/13 08:31:42.444885853 output file: test-bookdown.knit.md 2017/10/13 08:31:42.444891505 2017/10/13 08:31:43.363030179 Latexmk: -latexoption=-halt-on-error bad option 2017/10/13 08:31:43.363093482 Latexmk: -interaction=batchmode bad option 2017/10/13 08:31:43.363262181 2017/10/13 08:31:43.363266822 Latexmk: Bad options specified 2017/10/13 08:31:43.363306067 Use 2017/10/13 08:31:43.363308805 latexmk -help 2017/10/13 08:31:43.363325101 to get usage information GET /api/tasks/hcFiaGGooXEEfvRR?first_status=184 603ms 2017/10/13 08:31:43.811798795 2017/10/13 08:31:43.811812697 Latexmk, John Collins, 7 May 2011. Version 4.24 2017/10/13 08:31:43.823738440 Error: Failed to compile test-bookdown.tex. 2017/10/13 08:31:43.823812552 In addition: Warning message: 2017/10/13 08:31:43.823901945 Your latexmk version seems to be too low. You may need to update the latexmk package or your LaTeX distribution. 2017/10/13 08:31:43.826658891 Please delete test-bookdown.Rmd after you finish debugging the error. 2017/10/13 08:31:43.826732130 Execution halted GET /api/tasks/hcFiaGGooXEEfvRR?first_status=191 506ms GET /api/applications/853/config 599ms ----- Deployment log finished at 2017-10-13 10:31:47 ----- Deployment completed: https://bookdown.org/connect/#/apps/853 using bookdown::publish_book() I got the same error message and the additional line in R: Site deployment failed with error: Rendering exited abnormally: exit status 1
Member

### yihui commented Oct 13, 2017

 That is so weird... Basically the error log shows that your book was compiled on the server side, which should not happen, because bookdown::publish_book(render = "none") is the default (meaning that the book should not be compiled on the server side). Could you compress the whole folder as a zip file and upload it here? BTW, I just re-read your original post: Immediately after the installation I tried to push the files to my account at bookdown.org Could you clarify how you "pushed" the files to your account?
Author

### petzi53 commented Oct 13, 2017 • edited

 Ah I see. I have tried bookdown::publish_book() but I got the error message Error: Please specify the account name (there is more than one account registered on this system). When I specified the account name as parameter in publish_book() I got another error message to specify the server. Then I provided all parameters but I used render = "server". (And sorry: I didn't mention my whole input of publish_book() because I thought it was obvious that I should say render = "server") Just specifying account name and server the upload worked!
Member

### yihui commented Oct 13, 2017

 Okay, that explains the mystery in my mind. Please never assume anything is obvious. Just clearly state what you did exactly. Too much information is always better than too little. In reality, users often provide too little.
Author

### petzi53 commented Oct 13, 2017 • edited

 Yes, sure I will try! To add the other information you have asked: I have used for "pushing" the files the blue circle on the right-hand side in the Rstudio upper left pane (the source pane). I think this was maybe another misunderstanding …
Member

### yihui commented Oct 13, 2017

 Got you. Thanks!

### hrishikeshshanbhogue commented Jun 1, 2018 • edited

 Hi I am trying to run an rmarkdown file, i am able to view the output in word and HTML format but when I try in PDF version it throws me the below error Have even installed the MiKTeX from https://miktex.org/download |......... | 14% ordinary text without R code |................... | 29% label: setup (with options) List of 1 $include: logi FALSE processing file: it.Rmd |............................ | 43% ordinary text without R code |..................................... | 57% label: cars |.............................................. | 71% ordinary text without R code |........................................................ | 86% label: pressure (with options) List of 1$ echo: logi FALSE |.................................................................| 100% ordinary text without R code "C:/Program Files/RStudio/bin/pandoc/pandoc" +RTS -K512m -RTS it.utf8.md --to latex --from markdown+autolink_bare_uris+ascii_identifiers+tex_math_single_backslash --output it.tex --template "C:\Users\hrishikesh.shanbhogu\Documents\R\win-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" output file: it.knit.md Error: Failed to compile it.tex. In addition: Warning message: In system2(..., stdout = FALSE, stderr = FALSE) : '"pdflatex"' not found Execution halted No TeX installation detected (TeX is required to create PDF output). You should install a recommended TeX distribution for your platform: Windows: MiKTeX (Complete) - http://miktex.org/2.9/setup (NOTE: Be sure to download the Complete rather than Basic installation) Mac OS X: TexLive 2013 (Full) - http://tug.org/mactex/ (NOTE: Download with Safari rather than Chrome strongly recommended) Linux: Use system package manager @yihui if you can have a look at this Thanks
Member

### yihui commented Jun 1, 2018

 @hrishikeshshanbhogue I don't have an idea. You may try to uninstall MiKTeX and install TinyTeX: https://yihui.name/tinytex/

### freyreeste commented Aug 9, 2018

 In my case when trying to knit a pdf file there is an error only shown when a code is inserted in text. The error is the following: ! Missing $inserted.$ l.410 ...lso what residuals sum to 2.6645353\times 10^{}{-15}. Here is how much of TeX's memory you used: 12668 strings out of 493301 186484 string characters out of 3128319 293292 words of memory out of 3000000 16057 multiletter control sequences out of 15000+200000 20130 words of font info for 39 fonts, out of 3000000 for 9000 1141 hyphenation exceptions out of 8191 32i,5n,38p,325b,455s stack positions out of 5000i,500n,10000p,200000b,50000s Error: Failed to compile Freyre_Regression_Models_Course_Project_v2.tex. See Freyre_Regression_Models_Course_Project_v2.log for more info. Además: Warning message: comando ejecutado '"pdflatex" -halt-on-error -interaction=batchmode "Freyre_Regression_Models_Course_Project_v2.tex"' tiene estatus 1 Ejecución interrumpida

### freyreeste commented Aug 10, 2018

 Eventually managed to solve the issue by bracketing with \$ the r script.

### abiyug commented Nov 8, 2018 • edited

 I am getting the following error when trying to build "pdf_book" from Build Book tab on RStudio IDE Version 1.2.1086. I can build both gitbook and epub_book output file: bookdown-demo.knit.md Error: Failed to compile bookdown-demo.tex. In addition: Warning message: In system2(..., stdout = FALSE, stderr = FALSE) : error in running command Execution halted Exited with status 1. 

### abiyug commented Nov 8, 2018 • edited

 Ok, found the solution that fixed the problem of unable to build a pdf book, from buildbook tab. It is installing tinytex. Once that is installed. pdf compiled with out a problem. Here is the command line syntax to install tintex: tinytex::install_tinytex() My scenario is as follows: a fresh rmardown/bookdown install (First ever 'kniting' on the IDE). The solution for this problem was: Installing tinytex from R console. Didn't even need to restart Rstudio or restart R. suggestion: the tinytex install should be included in the steps prior to attempting to build a book.

### poldham commented Jul 7, 2019

 I just had exactly the same issue as @abiyug and found my way here through the error message. The tinytex::install_tinytex() solution worked for me as described. If not already adopted (and I missed it somehow), could I support the proposal to include tinytex_install as the error message led to quite a bit of head scratching while hunting in the .yml for errors. Many thanks!