rstudio / bookdown

Authoring Books and Technical Documents with R Markdown
https://pkgs.rstudio.com/bookdown/
GNU General Public License v3.0
3.71k stars 1.27k forks source link

Cannot generate pdf via "server" but only html despite I tried probably all suggestions. #1449

Closed quran2019 closed 6 months ago

quran2019 commented 6 months ago

Hi, my Bookdown file can generate html via building bookdown::gitbookbuild locally. But it cannot generate also pdf via bookdown::pdf_book build option. It keeps giving errors. I therefore tried to compile on the Bookdown server side with bookdown::publish_book(render = "server") but it still does not generate pdf but only html. Because when I try to download via Bookdown.org page, it starts showing pfd document but than says "Failed to load PDF document." and cannot provide a pdf, which suggest the Bookdown server also could not generate the pdf of my book. Here is the book link: https://bookdown.org/gokmenaltay19/Quran19/

When I look at the logs from my account on https://bookdown.org/connect/... then I see a similar error that I come accross locally while generating the pdf file. Any idea? Let's say my system is not ok but why the serve side gives the similar error and cannot generate the pdf of my book?

2023/12/11 12:11:48 PM: 573/573                                             
2023/12/11 12:11:48 PM: output file: Quran19.knit.md
2023/12/11 12:11:48 PM:
2023/12/11 12:11:49 PM: /opt/rstudio-connect/ext/pandoc/2.16/pandoc +RTS -K512m -RTS Quran19.knit.md --to latex --from markdown+autolink_bare_uris+tex_math_single_backslash --output Quran19.tex --lua-filter /opt/rstudio-connect/mnt/packrat/3.6.2/v2/library/bookdown/c7a65071bf6f9f16f079f6225c5336a4/bookdown/rmarkdown/lua/custom-environment.lua --lua-filter /opt/rstudio-connect/mnt/packrat/3.6.2/v2/library/rmarkdown/d68d0eb4181863ea7da515a735d259e1/rmarkdown/rmarkdown/lua/pagebreak.lua --lua-filter /opt/rstudio-connect/mnt/packrat/3.6.2/v2/library/rmarkdown/d68d0eb4181863ea7da515a735d259e1/rmarkdown/rmarkdown/lua/latex-div.lua --metadata-file /opt/rstudio-connect/mnt/tmp/Rtmpethl8g/file354364bb4913 --self-contained --table-of-contents --toc-depth 2 --number-sections --highlight-style tango --pdf-engine xelatex --natbib --include-in-header preamble.tex --variable graphics --wrap preserve --variable tables=yes --standalone -Mhas-frontmatter=false 
2023/12/11 12:12:09 PM: This is XeTeX, Version 3.14159265-2.6-0.99998 (TeX Live 2017/Debian) (preloaded format=xelatex)
2023/12/11 12:12:09 PM:  restricted \write18 enabled.
2023/12/11 12:12:09 PM: entering extended mode
2023/12/11 12:12:12 PM: ! Unable to read an entire line---bufsize=200000.
2023/12/11 12:12:12 PM: Please increase buf_size in texmf.cnf.
2023/12/11 12:12:12 PM:
2023/12/11 12:12:12 PM: xdvipdfmx:fatal: File ended prematurely
2023/12/11 12:12:12 PM:
2023/12/11 12:12:12 PM:
2023/12/11 12:12:12 PM: Output file removed.
2023/12/11 12:12:15 PM: This is XeTeX, Version 3.14159265-2.6-0.99998 (TeX Live 2017/Debian) (preloaded format=xelatex)
2023/12/11 12:12:15 PM:  restricted \write18 enabled.
2023/12/11 12:12:15 PM: entering extended mode
2023/12/11 12:12:17 PM: ! Unable to read an entire line---bufsize=200000.
2023/12/11 12:12:17 PM: Please increase buf_size in texmf.cnf.
2023/12/11 12:12:17 PM:
2023/12/11 12:12:17 PM: Output created: _book/Quran19.pdf
2023/12/11 12:12:17 PM:
2023/12/11 12:12:17 PM: xdvipdfmx:fatal: File ended prematurely
2023/12/11 12:12:17 PM:
2023/12/11 12:12:17 PM:
2023/12/11 12:12:17 PM: Output file removed.
2023/12/11 12:12:18 PM:
2023/12/11 12:12:18 PM:
2023/12/11 12:12:18 PM: processing file: Quran19.Rmd
2023/12/11 12:12:19 PM: 1/573 
cderv commented 6 months ago

I therefore tried to compile on the Bookdown server side with bookdown::publish_book(render = "server") but it still does not generate pdf but only html.

bookdown.org does not have the necessary tool to build book, especially PDF book. See about page: https://bookdown.org/home/about/ bookdown::publish_book(render = 'local') is the way to go.

If you want to build PDF book, you need LaTeX distribution, and build locally your PDF.

But it cannot generate also pdf via bookdown::pdf_book build option. It keeps giving errors.

You need to deal with those errors. It is probably some missing LaTeX package, or something with your TeX distribution. Are you using TinyTeX with tinytex R package ?

quran2019 commented 6 months ago

Thanks for the information. I am sorry to hear that. Actually, there were many similar pdf related posts and answers and I think I tried all. Reinstalled many packages but still the same. As the last chance, since there was "server" side build option, I had thought the packages I might be missing would have been available in the server side.

cderv commented 6 months ago

Actually, there were many similar pdf related posts and answers and I think I tried all. Reinstalled many packages but still the same.

You can share on https://community.rstudio.com or here you problem to render locally.

Best thing to try is to render a demo pdf document to check your install is ok, and then try your more complex project.

quran2019 commented 6 months ago

Thanks for the suggestions. I will try a bit more.

github-actions[bot] commented 3 weeks ago

This old thread has been automatically locked. If you think you have found something related to this, please open a new issue by following the issue guide (https://yihui.org/issue/), and link to this old issue if necessary.