A template for generating a valid EPUB, a KDP-ready PDF and a website for your book

Author

Bruno Rodrigues

Published

June 28, 2023

Welcome!

A template to write books ready for self-publishing

Go to https://github.com/b-rodrigues/kdp_quarto for the source code.

Go to https://b-rodrigues.github.io/kdp_quarto/ to visit the published website.

a very long line of R code that wraps in html, epub and PDF! In a pdf especially this is needed
data(mtcars)
lm(mpg ~ ., data = mtcars)

Call:
lm(formula = mpg ~ ., data = mtcars)

Coefficients:
(Intercept)          cyl         disp           hp         drat           wt  
   12.30337     -0.11144      0.01334     -0.02148      0.78711     -3.71530  
       qsec           vs           am         gear         carb  
    0.82104      0.31776      2.52023      0.65541     -0.19942  

This is how you can show verbatim code chunks in the output. This is using a {verbatim} chunk (check the source index.qmd):

```{r}
a very long line of R code that wraps in html, epub and PDF! In a pdf especially this is needed
```

If you want to show the triple backticks inline, you can also do so, like this: ```{r} to start an R chunk and ``` to end it. Check the source.

Figures

Use knitr::include_graphics() to include images. Check the source for how to add labels and captions:

knitr::include_graphics("images/gosling.jpg")

Figure 1: Ryan Gosling looking angry.

See Figure 1 for a meme.

Conditional content

The block below does not appear in the PDF, only on the website and Epub:

Hello, I won’t appear in the PDF!