I've been tasked with finding a way to have several markdown files output to the same html document. Bookdown seems like an amazing way to do this and offers all the functionality required. One of the steps in order for it to work is to build the book. Like it says in here: https://bookdown.org/yihui/bookdown/get-started.html While experimenting with the demo provided by this package's creator, the build book option is present exactly where it is expected to be, but while trying to make it work for a sample project I had laying around, there is no such button and I can't figure out why. How do I make this work? Thanks
Welcome to RStudio Community!
To help troubleshoot, here are a few questions I have:
- What version of RStudio are you using? You can run
RStudio.Version()$versionin the R console to find out.
- You don't see "Build Book" in the RStudio Build pane. What do you see instead? Do you see the Build pane at all? Could you send a screenshot?
- Did you configure the build tools? Click on the menu button "Build" and then select "Configure build tools". You want to select "Website". This is why the bookdown-demo has the "Build book" button. If you delete this line and then open the RStudio project, it won't have the Build pane.
In complement to the previous answer, to you have this line in you index.Rmd
I think it is necessary so that RStudio offer the build book option in build pane.
I also suspected that, but interestingly, RStudio still displayed "Build Book" after I deleted that required line from the bookdown-demo.
I'm not sure what all the criteria are for it to display "Build Book". If I delete
index.Rmd entirely, then it switches to "Build Website".
Have you restarted RStudio? If you open up your
.Rproj file with a plain text editor without restarting, you'll probably see this:
Version: 1.0 RestoreWorkspace: Default SaveWorkspace: Default AlwaysSaveHistory: Default EnableCodeIndexing: Yes UseSpacesForTab: Yes NumSpacesForTab: 2 Encoding: UTF-8 RnwWeave: Sweave LaTeX: XeLaTeX AutoAppendNewline: Yes
After restarting, and ensuring that this line appears in your
index.Rmd file YAML:
You can reopen the
.Rproj file in a text editor and see the below, which activates the build pane.
Version: 1.0 RestoreWorkspace: Default SaveWorkspace: Default AlwaysSaveHistory: Default EnableCodeIndexing: Yes UseSpacesForTab: Yes NumSpacesForTab: 2 Encoding: UTF-8 RnwWeave: Sweave LaTeX: XeLaTeX AutoAppendNewline: Yes BuildType: Website # the critical bit!