前言

建议采用TinyTeX (which includes XeLaTeX): https://yihui.org/tinytex/编译本书的pdf版本。

你好,世界。我写了一本书。这本书是这样的,第 4 章介绍了啥啥,然后是啥啥……

我用了两个 R 包编译这本书,分别是 knitr (Xie 2015)bookdown (Xie 2021)。以下是我的 R 进程信息:

sessionInfo()
## R version 4.1.0 (2021-05-18)
## Platform: x86_64-w64-mingw32/x64 (64-bit)
## Running under: Windows 10 x64 (build 19042)
## 
## Matrix products: default
## 
## locale:
## [1] LC_COLLATE=Chinese (Simplified)_China.936 
## [2] LC_CTYPE=Chinese (Simplified)_China.936   
## [3] LC_MONETARY=Chinese (Simplified)_China.936
## [4] LC_NUMERIC=C                              
## [5] LC_TIME=Chinese (Simplified)_China.936    
## 
## attached base packages:
## [1] stats     graphics  grDevices utils     datasets  methods   base     
## 
## other attached packages:
##  [1] devtools_2.4.1        usethis_2.0.1         rcolors_0.1.0        
##  [4] latticeMap_0.1.1.9000 sf_0.9-8              rgdal_1.5-23         
##  [7] sp_1.4-5              Ipaper_0.1.6          magrittr_2.0.1       
## [10] bookdown_0.22        
## 
## loaded via a namespace (and not attached):
##   [1] matrixStats_0.58.0       fs_1.5.0                 lubridate_1.7.10        
##   [4] doParallel_1.0.16        RColorBrewer_1.1-2       rprojroot_2.0.2         
##   [7] tools_4.1.0              bslib_0.2.5.1            utf8_1.2.1              
##  [10] R6_2.5.0                 KernSmooth_2.23-20       DBI_1.1.1               
##  [13] colorspace_2.0-1         raster_3.4-10            withr_2.4.2             
##  [16] tidyselect_1.1.1         prettyunits_1.1.1        processx_3.5.2          
##  [19] curl_4.3.1               compiler_4.1.0           cli_2.5.0               
##  [22] xml2_1.3.2               desc_1.3.0               sass_0.4.0              
##  [25] scales_1.1.1             classInt_0.4-3           askpass_1.1             
##  [28] callr_3.7.0              proxy_0.4-25             stringr_1.4.0           
##  [31] digest_0.6.27            rmarkdown_2.8            jpeg_0.1-8.1            
##  [34] pkgconfig_2.0.3          htmltools_0.5.1.1        sessioninfo_1.1.1       
##  [37] highr_0.9                collapse_1.5.3           fastmap_1.1.0           
##  [40] rlang_0.4.11             readxl_1.3.1             rstudioapi_0.13         
##  [43] farver_2.1.0             gridGraphics_0.5-1       jquerylib_0.1.4         
##  [46] generics_0.1.0           jsonlite_1.7.2           dplyr_1.0.6             
##  [49] zip_2.1.1                ggplotify_0.0.7          Rcpp_1.0.6              
##  [52] munsell_0.5.0            fansi_0.5.0              abind_1.4-5             
##  [55] clipr_0.7.1              lifecycle_1.0.0          stringi_1.6.2           
##  [58] yaml_2.2.1               pkgbuild_1.2.0           plyr_1.8.6              
##  [61] grid_4.1.0               parallel_4.1.0           crayon_1.4.1            
##  [64] lattice_0.20-44          stars_0.5-2              knitr_1.33              
##  [67] ps_1.6.0                 pillar_1.6.1             codetools_0.2-18        
##  [70] pkgload_1.2.1            glue_1.4.2               evaluate_0.14           
##  [73] RcppArmadillo_0.10.5.0.0 latticeExtra_0.6-29      data.table_1.14.0       
##  [76] remotes_2.3.0            BiocManager_1.30.15      png_0.1-7               
##  [79] vctrs_0.3.8              foreach_1.5.1            testthat_3.0.2          
##  [82] cellranger_1.1.0         openssl_1.4.4            gtable_0.3.0            
##  [85] purrr_0.3.4              assertthat_0.2.1         cachem_1.0.5            
##  [88] ggplot2_3.3.3            xfun_0.23                openxlsx_4.2.3          
##  [91] lwgeom_0.2-6             e1071_1.7-7              rsconnect_0.8.18        
##  [94] class_7.3-19             tibble_3.1.2             iterators_1.0.13        
##  [97] rvcheck_0.1.8            memoise_2.0.0            units_0.7-1             
## [100] ellipsis_0.3.2

致谢

非常感谢谁谁以及谁谁对我的帮助。艾玛,要不是他们神一样的队友,我两年前就写完这本书了。

张三
于 A 村某角落

References

Xie, Yihui. 2015. Dynamic Documents with R and Knitr. 2nd ed. Boca Raton, Florida: Chapman; Hall/CRC. http://yihui.name/knitr/.
———. 2021. Bookdown: Authoring Books and Technical Documents with r Markdown. https://CRAN.R-project.org/package=bookdown.