Bookdown PDF generation

I'm having a problem getting my bookdown to output a pdf file. I've followed this thread and installed tinytex and most everything else.

My YML files are:

index.Rmd

--- 
title: "Qualifying exam"
author: "Niklas Lollo"
date: "`r Sys.Date()`"
description: ''
documentclass: book
github-repo: niklaslollo/quals
bibliography: [quals.bib, packages.bib]
biblio-style: apalike
link-citations: true
colorlinks: true
knit: "bookdown::render_book"
site: bookdown::bookdown_site
subtitle: Literature Review & Prospectus
cover-image: images/mushroom.jpg
---

_output.yml

bookdown::gitbook:
  split_by: rmd
  split_bib: TRUE
  highlight: tango
  config:
    download: [pdf]
    edit: 
        link: https://github.com/niklaslollo/quals/edit/master/%s
    sharing:
      facebook: no
      github: yes
    toc:
      collapse: section
      scroll_highlight: yes
      before: |
             <p>Niklas Lollo's Qualifying Exam </p>
      after: |
              <li><a href="https://github.com/rstudio/bookdown" target="blank">Published with bookdown</a></li>
    toolbar:
      position: static
      search: yes
      fontsettings:
        theme: white
        family: sans
        size: 2
bookdown::pdf_book:
  latex_engine: xelatex
  citation_package: natbib
  keep_tex: yes

_bookdown.yml

book_filename: quals
output_dir: docs
delete_merged_file: true
repo: https://github.com/niklaslollo/quals/
language:
  ui:
    chapter_name: "Chapter "
rmd_files: ["index.Rmd",
            "01-introduction.Rmd",
           "02-prospectus.Rmd",
           "03-sts.Rmd",
           "04-governance.Rmd",
           "05-business.Rmd",
           "06-methods.Rmd",
           "07-references.Rmd"]

When I click on the download PDF link of the bookdown site I receive this error:
Error - The requested URL was not found on this server. http://..../rmd_output/2/quals.pdf

This means (to me) there is no pdf generated when I render the book, which is confirmed when I look through my output directory. What do I need to change?

Thanks!

Have you checked the RMarkdown window in RStudio? When I tried rendering index.Rmd, I got

Error in rawToChar(out) : 
  embedded nul in string: 'https://oskicat.berkeley.edu/search{~}S1?/.b15152566/.b15152566/1{\\\0C1{\\\0C1{\\\0CB/frameset{~}b15152566'
Calls: <Anonymous> ... <Anonymous> -> move_files_html -> vapply -> FUN -> rawToChar
In addition: Warning messages:
1: In FUN(X[[i]], ...) :
  out-of-range values treated as 0 in coercion to raw
2: In FUN(X[[i]], ...) :
  out-of-range values treated as 0 in coercion to raw
3: In FUN(X[[i]], ...) :
  out-of-range values treated as 0 in coercion to raw
Execution halted

and, of course, no output. The repo is public (you might want to change that). And I'll delete it from my laptop if there are no further questions

Thanks for looking into this. That makes me think it is an encoding issue with some text. I got it to work somehow last year... The repo is now private once more; feel free to delete!

Thanks!

How did you build your book ? Did you explicitly build the pdf_book ?

See here for explanation on how it works

You build all format one after the other using the IDE build pane
image

bookdown::render_book() will build only the first format found in _output.yaml. So it will render only html book and there is no pdf to download then.

1 Like

Yes, I believe I did that... thanks for your help!

This topic was automatically closed 7 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.