在书本中加入CSS?

时间:2018-11-15 15:16:54

标签: bookdown

我想添加以下.css来使我的书更宽:

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

这是我的.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

这是我用来制作这本书的R代码:

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

library(reticulate)

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

library(bookdown)

render_book("bookdown::gitbook")

为什么我的书没有扩大?我在做什么错了?

1 个答案:

答案 0 :(得分:3)

删除css:前面的缩进,并确保文件css.cssindex.Rmd文件位于同一位置。

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: "."

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