anderwyang
anderwyang

Reputation: 2431

In R Bookdown, how to set font family and size for different level text?

In R Bookdown, how to set font family and size for different level text ? (I want apply this setting for the whole book)

Here is the wished setting parameter as attached image .Thanks! (Additional, i want to change the code font also as 'family:Arial size=9')

--- 
title: "A Minimal Book Example"
author: "John Doe"
date: "`r Sys.Date()`"
site: bookdown::bookdown_site
documentclass: book
bibliography: [book.bib, packages.bib]
link-citations: yes
github-repo: rstudio/bookdown-demo
---

# About

## Usage 

1. Find the **Build** pane in the RStudio IDE, and
Or build the book from the R console:

```{r, eval=FALSE}
bookdown::render_book()
```

enter image description here

Upvotes: 0

Views: 823

Answers (1)

manro
manro

Reputation: 3677

Then don't think twice and use CSS.

If you will have more rules, make a separate CSS-file for the clarity of your .Rmd-file.

Your example:

<style>
   h1 {
    font-family: 'Arial';
    font-size: 20pt; 
   }
   h2 {
    font-family: 'Arial Black';
    font-size: 15pt; 
   } 
   pg {
    font-family: 'MS UI Gothic'; 
    font-size: 6pt; 
   }
</style>  

# About

## Usage 

<pg> 1. Find the **Build** pane in the RStudio IDE, and
Or build the book from the R console: </pg>

enter image description here

Upvotes: 1

Related Questions