避免通过几何设置边距

avoid setting margin via geometry

使用时

render_book("index.Rmd", "bookdown::pdf_book")

看起来像在 tex 文件中插入了一行设置边距

\usepackage[margin=1in]{geometry}

bookdown-demo repro 可以用来重现这个。

index.Rmd 中,我正在使用

--- 
date: "`r Sys.Date()`"
knit: "bookdown::render_book"
documentclass: krantz
classoption: numberinsequence,krantz1
bibliography: [book.bib]
biblio-style: apalike
link-citations: yes
colorlinks: yes
---

这会破坏该样式文件设置的边距。我知道我可以 modify the geometry options 但我可以避免生成这一行吗?

谢谢

> sessionInfo()
R version 3.3.3 (2017-03-06)
Platform: x86_64-apple-darwin13.4.0 (64-bit)
Running under: macOS Sierra 10.12.4

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] bookdown_0.4

loaded via a namespace (and not attached):
[1] backports_1.0.5 magrittr_1.5    rprojroot_1.2   htmltools_0.3.6
[5] tools_3.3.3     rstudioapi_0.6  yaml_2.1.14     Rcpp_0.12.11   
[9] stringi_1.1.5   rmarkdown_1.5   knitr_1.16      stringr_1.2.0  
[13] digest_0.6.12   evaluate_0.10  

documentclass: krantz表示您正在为Chapman & Hall写书,我提供了a starter repo bookdown-crc for such authors who use bookdown (the bookdown-demo repo is not the best option for you). Your issue does not exist in this repo because I set template: null for pdf_book in _output.yml。这样做的原因是我想使用 Pandoc 的默认模板,它不会将默认的 margin=1in 添加到 YAML 中的 geometry 选项(而 rmarkdown 会 - - 那是罪魁祸首)。

如果你确实想使用rmarkdown的LaTeX模板(基于Pandoc的修改),你可以设置

geometry: false

在您 index.Rmd 的 YAML 元数据中。

供您参考,我在 bookdown 书中有专门针对 Chapman & Hall 作者的部分:https://bookdown.org/yihui/bookdown/publishers.html