The Unfun Cat
The Unfun Cat

Reputation: 31908

Include css in bookdown book?

I want to include the following .css to make my book wider:

.book .book-body .page-wrapper .page-inner {
    max-width: 1200px !important;
}

This is my .yml:

delete_merged_file: true
rmd_files: ["index.Rmd", "creating.Rmd", "subset.Rmd", "manipulation.Rmd",
"single_range_methods.Rmd", "intersection.Rmd", "overlap.Rmd", "join.Rmd",
"nearest.Rmd", "coverage.Rmd", "runlengths.Rmd", "runlength_dict.Rmd"]
output_dir: "."

bookdown::gitbook:
  css: css.css

This is the R code I use to produce the book:

mpl = reticulate::import("matplotlib")
mpl$use('TkAgg')

library(reticulate)

use_python("/mnt/work/me/software/anaconda/bin/python")

library(bookdown)

render_book("bookdown::gitbook")

Why isn't my book becoming wider? What am I doing wrong?

Upvotes: 0

Views: 147

Answers (1)

Samuel Crane
Samuel Crane

Reputation: 46

Remove the indent in front of css: and make sure that the file css.css is in the same location as your index.Rmd file.

YML should look like this:

delete_merged_file: true
rmd_files: ["index.Rmd", "creating.Rmd", "subset.Rmd", "manipulation.Rmd",
"single_range_methods.Rmd", "intersection.Rmd", "overlap.Rmd", "join.Rmd",
"nearest.Rmd", "coverage.Rmd", "runlengths.Rmd", "runlength_dict.Rmd"]
output_dir: "."

output: 
  bookdown::gitbook:
css: css.css

Upvotes: 3

Related Questions