Skip to content

bookdown: build using pdflatex from source directory

3 messages · Rui Barradas, Rich Shepard

#
I have a dead tree copy of 'R for Data Science' and want a PDF that's more
efficiently accessed when I'm working with R.

Installed here are all the files in r4ds-master/. Reading the online copy of
'bookdown: Authoring Books and Technical Documents with R Markdown' I'm not
seeing how to build the pdf copy from the source located in ~/R/r4ds-master/
and I'm running R in a different virtual terminal.

Would the command (issued in R):
bookdown::render_book("R/r4ds-master/rmarkdown.Rmd")
compile the entire book?

Rich
#
Hello,

Assuming the file index.Rmd is in R/r4ds-master, try

bookdown::render_book("R/r4ds-master/index.Rmd", output_format = 
"bookdown::pdf_book")


Hope this helps,

Rui Barradas

?s 19:28 de 30/08/21, Rich Shepard escreveu:
#
On Mon, 30 Aug 2021, Rui Barradas wrote:

            
Rui,

The build needs to run it from the r4ds-master/ directory. I wondered if
index.rmd was the entry, but didn't try it because the index is at the end
of the book.

The build shows 100% completion, but:
label: unnamed-chunk-67 (with options) 
List of 1
  $ indent: chr "    "

   |......................................................................| 100%
    inline R code fragments

output file: strings.knit.md

Error: Functions that produce HTML output found in document targeting latex output.
Please change the output type of this document to HTML. Alternatively, you can allow
HTML output in non-HTML formats by adding this option to the YAML front-matter of
your rmarkdown file:

   always_allow_html: true

Note however that the HTML output will not be visible in non-HTML formats.

Execution halted
Error in Rscript_render(f, render_args, render_meta, add1, add2) :
   Failed to compile strings.Rmd

And I have no idea how to fix this.

I can try downloading it from github again and see if that makes a
difference.

Many thanks,

Rich