作者:Yihui Xie
译者:郑宝童
日期:2021.05.14


1. Chapter 1 Introduction

This book is a guide to authoring books and technical documents with R Markdown (Allaire, Xie, McPherson, et al. 2021) and the R package bookdown (Xie 2021a). It focuses on the features specific to writing books, long-form articles, or reports, such as:

  • how to typeset equations, theorems, figures and tables, and cross-reference them;
  • how to generate multiple output formats such as HTML, PDF, and e-books for a single book;
  • how to customize the book templates and style different elements in a book;
  • editor support (in particular, the RStudio IDE); and
  • how to publish a book.

本书是使用R Markdown (Allaire, Xie, McPherson, et al. 2021)和R包bookdown (Xie 2021a)编写书籍和技术文档的指南。它拥有专注于写书籍,长文章或报告特有的特性,例如:

  • 如何排版方程,定理,图表和表格,交叉引用彼此
  • 如何为一本书生成多个输出格式,如HTML, PDF,和电子书格式
  • 如何在一本书中自定义书籍模板和样式不同的元素
  • 编辑器支持(特别是RStudio IDE);和
  • 如何发布一本书

It is not a comprehensive introduction to R Markdown or the knitr package (Xie 2021b), on top of which bookdown was built. To learn more about R Markdown, please check out the online documentation http://rmarkdown.rstudio.com. For knitr, please see Xie (2015). You do not have to be an expert of the R language (R Core Team 2021) to read this book, but you are expected to have some basic knowledge about R Markdown and knitr. For beginners, you may get started with the cheatsheets at https://www.rstudio.com/resources/cheatsheets/. The appendix of this book contains brief introductions to these software packages. To be able to customize the book templates and themes, you should be familiar with LaTeX, HTML and CSS.

它不是对R Markdown或knitr 包(Xie 2021b)的全面介绍(bookdown是在R Markdown和knitr 的基础上开发的) 。要了解更多关于R Markdown的信息,请查看在线文档http://rmarkdown.rstudio.com。对于**knitr,**对于初学者,你可以从https://www.rstudio.com/resources/cheatsheets/上的cheatsheets 开始。本书的附录包含了对这些软件包的简要介绍。若要能够自定义图书模板和主题,您应该熟悉LaTeX、HTML和CSS。

References

Allaire, JJ, Yihui Xie, Jonathan McPherson, Javier Luraschi, Kevin Ushey, Aron Atkins, Hadley Wickham, Joe Cheng, Winston Chang, and Richard Iannone. 2021. Rmarkdown: Dynamic Documents for R. https://CRAN.R-project.org/package=rmarkdown.
R Core Team. 2021. R: A Language and Environment for Statistical Computing. Vienna, Austria: R Foundation for Statistical Computing. https://www.R-project.org/.
Xie, Yihui. 2015. Dynamic Documents with R and Knitr. 2nd ed. Boca Raton, Florida: Chapman; Hall/CRC. http://yihui.org/knitr/.
Xie, Yihui. 2021a. Bookdown: Authoring Books and Technical Documents with R Markdown.
Xie, Yihui. 2021b. Knitr: A General-Purpose Package for Dynamic Report Generation in R. https://yihui.org/knitr/.