Ram
March 21, 2018, 1:40pm
1
Hi,
I am learning to build a gitbook and I am following the instructions as in section 1.2 of bookdown book here : https://bookdown.org/yihui/bookdown/get-started.html
I have installed pandoc and also latex. But , When I build the book , I am getting the following error
Output created: _book/bookdown-demo.pdf
Error in tools::file_path_as_absolute(output_file) :
file '_book/bookdown-demo.pdf' does not exist
Calls: <Anonymous> ... render_book -> render_cur_session -> <Anonymous> -> <Anonymous>
In addition: Warning messages:
1: running command '"xelatex" -halt-on-error -interaction=batchmode "bookdown-demo.tex"' had status 1
2: In readLines(logfile) :
incomplete final line found on 'bookdown-demo.log'
Execution halted
Exited with status 1.
How do I resolve this? I also made just one page dummy book of my own, but also there I cannot build any pdf. Could someone guide me please?
thank you
Ram
mara
March 21, 2018, 2:14pm
2
Can you knit a normal R Markdown file to pdf?
see here:
The first official book authored by the core R Markdown developers that provides a comprehensive and accurate reference to the R Markdown ecosystem. With R Markdown, you can easily create reproducible data analysis reports, presentations, dashboards,...
Also, while I'm not sure you'll be able to put this in a reprex, if you could surround the output with backticks (to make it a code chunk) that will be much more readable.
```r
Code or whatever goes in here
```
Thanks
Ram
March 21, 2018, 3:28pm
3
Hi,
It asked me to install some style files, after which I was able to produce a pdf from the default new Markdown file in RStudio.
I have put code ticks in my question. Is that what you mean?
Coming back to my gitbook, Now when I build pdf_book, I get this error
==> rmarkdown::render_site(output_format = 'bookdown::pdf_book', encoding = 'UTF-8')
|.................................................................| 100%
inline R code fragments
processing file: index.Rmd
output file: index.knit.md
"C:/Users/bhami001/AppData/Local/Pandoc/pandoc" +RTS -K512m -RTS GAMAModelDoc.utf8.md --to latex --from markdown+autolink_bare_uris+ascii_identifiers+tex_math_single_backslash --output GAMAModelDoc.tex --table-of-contents --toc-depth 2 --template "D:\R\R-3.4.3\library\rmarkdown\rmd\latex\default-1.17.0.2.tex" --number-sections --highlight-style tango --pdf-engine xelatex --natbib --include-in-header preamble.tex --variable graphics=yes --variable "geometry:margin=1in" --variable tables=yes --standalone
pandoc.exe: preamble.tex: openBinaryFile: does not exist (No such file or directory)
Error: pandoc document conversion failed with error 1
In addition: Warning message:
running command '"C:/Users/bhami001/AppData/Local/Pandoc/pandoc" +RTS -K512m -RTS GAMAModelDoc.utf8.md --to latex --from markdown+autolink_bare_uris+ascii_identifiers+tex_math_single_backslash --output GAMAModelDoc.tex --table-of-contents --toc-depth 2 --template "D:\R\R-3.4.3\library\rmarkdown\rmd\latex\default-1.17.0.2.tex" --number-sections --highlight-style tango --pdf-engine xelatex --natbib --include-in-header preamble.tex --variable graphics=yes --variable "geometry:margin=1in" --variable tables=yes --standalone' had status 1
Please delete GAMAModelDoc.md after you finish debugging the error.
Execution halted
Exited with status 1.
Ram
Ram
March 21, 2018, 3:33pm
4
And with the bookdown-demo, I get this error:
==> rmarkdown::render_site(encoding = 'UTF-8')
processing file: bookdown-demo.Rmd
|.... | 7%
inline R code fragments
|......... | 13%
label: unnamed-chunk-1 (with options)
List of 1
$ eval: logi FALSE
|............. | 20%
ordinary text without R code
|................. | 27%
label: unnamed-chunk-2 (with options)
List of 1
$ include: logi FALSE
|...................... | 33%
ordinary text without R code
|.......................... | 40%
label: nice-fig (with options)
List of 4
$ fig.cap : chr "Here is a nice figure!"
$ out.width: chr "80%"
$ fig.asp : num 0.75
$ fig.align: chr "center"
|.............................. | 47%
ordinary text without R code
|................................... | 53%
label: nice-tab (with options)
List of 1
$ tidy: logi FALSE
|....................................... | 60%
inline R code fragments
|........................................... | 67%
label: setup (with options)
List of 1
$ include: logi FALSE
|................................................ | 73%
ordinary text without R code
|.................................................... | 80%
label: cars
|........................................................ | 87%
ordinary text without R code
|............................................................. | 93%
label: pressure (with options)
List of 1
$ echo: logi FALSE
|.................................................................| 100%
ordinary text without R code
output file: bookdown-demo.knit.md
"C:/Users/bhami001/AppData/Local/Pandoc/pandoc" +RTS -K512m -RTS bookdown-demo.utf8.md --to html4 --from markdown+autolink_bare_uris+ascii_identifiers+tex_math_single_backslash+smart --output bookdown-demo.html --email-obfuscation none --wrap preserve --standalone --section-divs --table-of-contents --toc-depth 3 --template "D:\R\R-3.4.3\library\bookdown\templates\gitbook.html" --highlight-style pygments --number-sections --css style.css --include-in-header "C:\Users\bhami001\AppData\Local\Temp\RtmpyKJ93d\rmarkdown-str3e04562e2f81.html" --mathjax --filter pandoc-citeproc
Output created: _book/index.html
processing file: bookdown-demo.Rmd
|.... | 7%
inline R code fragments
|......... | 13%
label: unnamed-chunk-1 (with options)
List of 1
$ eval: logi FALSE
|............. | 20%
ordinary text without R code
|................. | 27%
label: unnamed-chunk-2 (with options)
List of 1
$ include: logi FALSE
|...................... | 33%
ordinary text without R code
|.......................... | 40%
label: nice-fig (with options)
List of 4
$ fig.cap : chr "Here is a nice figure!"
$ out.width: chr "80%"
$ fig.asp : num 0.75
$ fig.align: chr "center"
|.............................. | 47%
ordinary text without R code
|................................... | 53%
label: nice-tab (with options)
List of 1
$ tidy: logi FALSE
|....................................... | 60%
inline R code fragments
|........................................... | 67%
label: setup (with options)
List of 1
$ include: logi FALSE
|................................................ | 73%
ordinary text without R code
|.................................................... | 80%
label: cars
|........................................................ | 87%
ordinary text without R code
|............................................................. | 93%
label: pressure (with options)
List of 1
$ echo: logi FALSE
|.................................................................| 100%
ordinary text without R code
output file: bookdown-demo.knit.md
"C:/Users/bhami001/AppData/Local/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 "D:\R\R-3.4.3\library\rmarkdown\rmd\latex\default-1.17.0.2.tex" --number-sections --highlight-style tango --pdf-engine xelatex --natbib --include-in-header preamble.tex --variable graphics=yes --variable "geometry:margin=1in" --variable tables=yes --standalone
Output created: _book/bookdown-demo.pdf
Error in tools::file_path_as_absolute(output_file) :
file '_book/bookdown-demo.pdf' does not exist
Calls: <Anonymous> ... render_book -> render_cur_session -> <Anonymous> -> <Anonymous>
In addition: Warning messages:
1: In split_chapters(output, gitbook_page, number_sections, split_by, :
You have 8 Rmd input file(s) but only 7 first-level heading(s). Did you forget first-level headings in certain Rmd files?
2: running command '"xelatex" -halt-on-error -interaction=batchmode "bookdown-demo.tex"' had status 1
3: In readLines(logfile) :
incomplete final line found on 'bookdown-demo.log'
Execution halted
Exited with status 1.
Ram
March 21, 2018, 6:54pm
5
No Solution or suggestion ?
rensa
March 22, 2018, 11:21am
6
To clarify, is the output file actually getting created in spite of the error? These lines seem odd:
Output created: _book/bookdown-demo.pdf
Error in tools::file_path_as_absolute(output_file) :
file '_book/bookdown-demo.pdf' does not exist
rensa
March 22, 2018, 11:28am
7
Actually, it looks like quite a few people have been having this problem , @Ram . @yihui appears to be suggesting that you update the Rmarkdown package to at least version 1.9 and use the latest version of the tinytex package, if I'm understanding their comments correctly.
2 Likes
yihui
March 22, 2018, 2:10pm
8
Your understanding is correct. Thanks!
3 Likes
Ram
March 24, 2018, 9:51am
9
Hi rensa and yihui
There is not pdf in _book nor anywhere in the project. I still have the same problem. I have tintytex 0.4 and rmarkdown 1.9. . I am using Rstudio 1.1.442 , r 3.4.3 on windows 7. (see attachment)
I am selecting build all formats in the build dropdown menu.
Thank you
Ram
Output created: _book/bookdown-demo.pdf
Error in tools::file_path_as_absolute(output_file) :
file '_book/bookdown-demo.pdf' does not exist
Calls: <Anonymous> ... render_book -> render_cur_session -> <Anonymous> -> <Anonymous>
In addition: Warning messages:
1: In split_chapters(output, gitbook_page, number_sections, split_by, :
You have 8 Rmd input file(s) but only 7 first-level heading(s). Did you forget first-level headings in certain Rmd files?
2: running command '"xelatex" -halt-on-error -interaction=batchmode "bookdown-demo.tex"' had status 1
3: In readLines(logfile) :
incomplete final line found on 'bookdown-demo.log'
Execution halted
Exited with status 1.
rensa
March 25, 2018, 1:55am
10
@Ram , have you run tinytex::install_tinytex()
? It's a bit different to other R packages in that you need to run that command after installing the package to actually get Tinytex going.
Ram
March 25, 2018, 7:52am
11
@rensa , thank you. I followed your suggestion and after installation it asked me to try the below command and now it appears to be installed.
> tinytex:::is_tinytex()
[1] TRUE
but the error still exists when I build the book of yihui. It is the exact same error as before, so I do not copy it again.
Thank you for patience.
Ram
rensa
March 25, 2018, 11:54pm
12
@Ram No worries! Going by the GitHub thread, it seems like there's still some weird stuff happening
yihui
March 26, 2018, 9:14pm
13
tinytex::install_tinytex()
is not required. It is one of the two possible solutions I mentioned in https://github.com/rstudio/rmarkdown/issues/1285#issuecomment-374340175 .
Note that you should use either MiKTeX or TinyTeX, but not both. If you have both installed, I recommend that you remove one, and I recommend that you remove MiKTeX in this case. Please let me know if you still have problems after you uninstall MiKTeX and restart RStudio (please provide the output of Sys.which('xelatex')
in this case).
3 Likes
Ram
March 27, 2018, 10:35am
14
hi @yihui
Thank you for your suggestions. I uninstalled MikTeX and now it seems to be working on bookdown-demo and I get a pdf. However, I do not get it for my book May be you can give some suggestions?
> Sys.which('xelatex')
xelatex
"C:\\Users\\bhami001\\AppData\\Roaming\\TinyTeX\\bin\\win32\\xelatex.exe"
>
The error I get is
pandoc.exe: preamble.tex: openBinaryFile: does not exist (No such file or directory)
Error: pandoc document conversion failed with error 1
In addition: Warning message:
running command '"C:/Users/bhami001/AppData/Local/Pandoc/pandoc" +RTS -K512m -RTS GAMAModelDoc.utf8.md --to latex --from markdown+autolink_bare_uris+ascii_identifiers+tex_math_single_backslash --output GAMAModelDoc.tex --table-of-contents --toc-depth 2 --template "D:\R\R-3.4.3\library\rmarkdown\rmd\latex\default-1.17.0.2.tex" --number-sections --highlight-style tango --pdf-engine xelatex --natbib --include-in-header preamble.tex --variable graphics=yes --variable "geometry:margin=1in" --variable tables=yes --standalone' had status 1
Execution halted
Exited with status 1.
Can you suggest how I may resolve this? This error does not come for your book.
my _output.yml is as follows
bookdown::gitbook:
css: style.css
config:
download: ["pdf", "epub"]
bookdown::pdf_book:
includes:
in_header: preamble.tex
latex_engine: xelatex
citation_package: natbib
keep_tex: yes
bookdown::epub_book: default
and my _bookdown.yml is
book_filename: "GAMAModelDoc"
language:
ui:
chapter_name: "Chapter "
output_dir: docs
delete_merged_file: true
and the yaml in my index.Rmd is
---
title: "GAMA Model Documentation"
author: "SS"
date: "`r Sys.Date()`"
cover-image: cover.png
output:
bookdown::gitbook:
lib_dir: "book_assets"
css: style.css
config:
sharing: null
toc:
collapse: section
scroll_highlight: false
download: ["book.pdf", "book.epub"]
site: bookdown::bookdown_site
documentclass: book
description: "Document describing the GAMA model and its functions."
---
Thank you
Ram
Ram
March 27, 2018, 10:49am
15
I corrected the indent of download in index.Rmd and it now seems to work (i get a pdf). I will just keep it open in case someone can correct any mistakes I have.
yihui
March 27, 2018, 2:14pm
16
The error message says you don't have a file named preamble.tex
, so you should not specify it in the includes
option under bookdown::pdf_book
.
1 Like
Arturo
September 11, 2018, 11:47pm
18
My solution to this error:
1.- After compiling the bookdown-demo.tex
in my tex editor (textStudio), I discovered that certain packages had not installed
in my Latext distribution (MikTex). I installed that packages. (Aditionally, the compilation fails because the path of the figure 'nice-fig-1' ("bookdown-demo_files/figure-latex/nice-fig-1") does not exists, instead, you should set the valid path).
2.- I changed the line 'latex_engine: xelatex to latex_engine: pdflatex' in the
_output.yml file.
The compilation executed normally, without errors.
I hope this solution help you.
Thanks for this. After multiple attempts implementing MikTex removal, tinytex installation, package updates, removal of underscores from variable and label names, and others, without success in bookdown PDF generation, I simply changed to latex_engine: pdflatex
as you mentioned and it worked. No more 'Exited with status 1.' or log file errors.
system
Closed
May 2, 2019, 12:57am
20
This topic was automatically closed 21 days after the last reply. New replies are no longer allowed. If you have a query related to it or one of the replies, start a new topic and refer back with a link.