I have just published my first document with bookdown and I am feeling euphoric at the moment. Somehow this gives me a very different satisfaction as compared to creating just a google document. Yes, they serve almost the same function, but the presentation of a bookdown document is much better. It also provides more functionalities and flexibilities than a google doc.
Here are the minimal steps needed to customize a document from Yihui’s guide.
- Follow his guide and download a copy of bookdown-demo
- Add you own content
- Here are the few things you need to change so that it is fully customized:
- Yihui kept a chapter in index.rmd. You can delete that chapter (i.e. including the # mark but it may still persist). This is because bookdown detects a discrepency between the number of rmarkdown files and number of chapters that it used to generate and decided to go with the last rendered version of the first chapter (which has been deleted in rmd). To remove that chapter, simply move the content from 01-introduction.rmd to index.rmd and delete 01-introduction
- customize the header of index.rmd, including
- github repo
- it seems if you change
sitethen it cannot be published with RStudio
- then, edit _output.yml to change the
editurl to your book’s name and github’s repo
- if you would like people to download your book, use the following command to generate the books.
# pdf bookdown::render_book("index.Rmd", "bookdown::pdf_book") # epub bookdown::render_book("index.Rmd", "bookdown::epub_book") # docx (remember to add this as an option in the output.yaml) bookdown::render_book("index.Rmd", "bookdown::word2_document2")
- follow the instruction here to publish on RStudio. As of Oct 2020, the default option of RStudio is to publish it privately first and you can change the access later in the panel.
- when using
bookdown::publish_book(), change the argument
name = ""so that it publishes according to your book’s name (the website title)
- when using
That’s it! Have fun :D.