Questions tagged [bookdown]

bookdown is an R package for authors to write books and long-form articles using R Markdown

The bookdown package is an R package for authors to write books and long-form articles using R Markdown. For more information, see https://bookdown.org.

1019 questions
121
votes
1 answer

Relationship between R Markdown, Knitr, Pandoc, and Bookdown

What is the relationship between the functionality of R Markdown, Knitr, Pandoc, and Bookdown? Specifically what is the 'division of labour' between these packages in converting markup documents with embedded R code (e.g. .Rnw or .Rmd) into final…
RobinL
  • 11,009
  • 8
  • 48
  • 68
54
votes
3 answers

Code folding in bookdown

The Code folding option in RMarkdown for html documents is awesome. That option makes the programmatic methodology transparent for those who are interested, without forcing the audience to scroll through miles of code. The tight placement of code…
Alex P
  • 1,574
  • 13
  • 28
48
votes
3 answers

Space after every five rows in kable output (with booktabs option) in R Markdown document

I am using knitr::kable() to render tables as part of an R Markdown document (that itself is part of a bookdown project). In particular, the booktabs option (through setting the booktabs argument to equal TRUE) renders the table in a nice-looking…
Joshua Rosenberg
  • 4,014
  • 9
  • 34
  • 73
34
votes
3 answers

How to reference two times to a single footnote in rmarkdown?

I try to reference to a single footnote in a few places in the text. However, with the code below, I've got two footnotes with the same content. --- title: "My document" output: html_document --- One part of the text [^1]. Two pages later…
Jot eN
  • 6,120
  • 4
  • 40
  • 59
29
votes
2 answers

Is there a way to add chapter bibliographies using bookdown?

I am trying to write my PhD Thesis with bookdown and am mainly using pdf output. I have easily added a bibliography at the end of the document but would rather have a bibliography at the end of each chapter. I have tried adjusting the .tex output…
davidhen
  • 579
  • 6
  • 10
26
votes
6 answers

How to change the figure caption format in bookdown

When using bookdown (single document), figures are numbered automatically as: Figure 1 Text of figure caption. In chemistry, the convention is to label main Figures as: Figure 1. Text of figure caption. and for the supporting information…
Outlander
  • 533
  • 7
  • 12
21
votes
3 answers

Referencing a 'hand-made' table using bookdown package

I'm trying to reference a table using the bookdown package. In the documentation for tables, the author only shows how to create tables using knitr::kable. ```{r table1} knitr::kable( head(iris, 20), caption = 'Here is a nice table!', booktabs…
nhoeft
  • 535
  • 6
  • 17
20
votes
3 answers

How to format kable table when knit from .rmd to Word (with bookdown)

I have read the bookdown book and still cannot figure this out. I am trying to create a Word report through bookdown. I want to use kableExtra to add striping to my tables and also to bold my last table row. Can kableExtra be used when knitting to…
JHawkins
  • 243
  • 1
  • 2
  • 10
20
votes
2 answers

How to stop bookdown tables from floating to bottom of the page in pdf?

I am using bookdown to create pdf reports, but my tables are all floating down to the bottom of the page, regardless of how much space there is. See this example: --- title: "test_doc" author: "Jake Thompson" date: "6/30/2017" output: …
Jake Thompson
  • 2,591
  • 1
  • 16
  • 32
18
votes
3 answers

Rmarkdown space without line break ~

In Latex, it is possible to insert a space that does not end a line by a ~ character. So writing Fig.~\ref{fig:f1} will write as Fig. 1 and it makes sure that text wrapping never breaks a line between Fig. and the number 1. However, in Rmarkdown…
highBandWidth
  • 16,751
  • 20
  • 84
  • 131
16
votes
2 answers

Rmarkdown/Bookdown: Separate figure numbering for Supplemental Section

Certain kinds of documents, such as journal articles, often have a Supplemental Section, where the numbering of figures is different from the main body. For example, in the main body, you might have Fig 1-5. But then, for the Supplemental section,…
Alex
  • 779
  • 2
  • 7
  • 20
15
votes
1 answer

How can I use the new bs4() theme in bookdown?

How can I use the bs4 theme in bookdown, such as the one used for the R4DS book In the _output.yaml I see the following code, but it doesn't work with my project. bookdown::bs4_book: theme: primary: "#637238" repo:…
max
  • 4,141
  • 5
  • 26
  • 55
15
votes
1 answer

How to change caption label names in a single document with Bookdown?

I have created a single document with the Bookdown-package of R-Markdown that allows both html- and pdf-output. I would like to change the caption labels Figure, Table and Table of Contents into another language. Here's a minimal example: --- title:…
frkbr
  • 167
  • 1
  • 8
15
votes
1 answer

Bookdown: Fix extra space before Chinese string inside R code chunk

When Chinese string inside R code chunk, the compiled PDF will get a redundancy space before the string, how to avoid this extra space? Please refer the minimum case in github - bookdown-chinese .
Andrew.T
  • 420
  • 2
  • 12
15
votes
1 answer

Close and open all chunks feature in a RMarkdown script in Rstudio

My Rmarkdown scripts are getting quite large lately. Especially the code inside the R-chunk which makes over-viewing the whole script more and more tricky. Luckily in RStudio there's the functionality to close resp. minimize the code chunk to one…
andschar
  • 3,504
  • 2
  • 27
  • 35
1
2 3
67 68