forked from rstudio/rmarkdown-cookbook
-
Notifications
You must be signed in to change notification settings - Fork 0
/
18-references.Rmd
107 lines (101 loc) · 2.12 KB
/
18-references.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
```{r, child=if(knitr::is_latex_output()) '_knitr-options.Rmd'}
```
\backmatter
`r if (knitr::is_html_output()) '
# References {-}
'`
```{r include=FALSE, tidy=FALSE, warning = FALSE}
# list cited packages
pkgs <- c(
.packages(),
'animation',
'blastula',
'blogdown',
'bookdown',
'broom',
'Cairo',
'cairoDevice',
'condformat',
'dagitty',
'diagram',
'DiagrammeR',
'distill',
'downloadthis',
'DT',
'equatiomatic',
'ezknitr',
'flair',
'flexdashboard',
'flextable',
'formatR',
'formattable',
'gganimate',
'ggdag',
'ggplot2',
'gifski',
'googledrive',
'govdown',
'gt',
'gtsummary',
'here',
'huxtable',
'kableExtra',
'knitcitations',
'knitr',
'learnr',
'magick',
'nomnoml',
'officedown',
'officer',
'pagedown',
'pander',
'pixiedust',
'pkgdown',
'printr',
'r2d3',
'reactable',
'reticulate',
'revealjs',
'rgl',
'rhandsontable',
'rmarkdown',
'rmdformats',
'roxygen2',
'rsconnect',
'rticles',
'sass',
'spelling',
'stargazer',
'styler',
'svglite',
'tables',
'tangram',
'tikzDevice',
'tinytex',
'trackdown',
'tufte',
'usethis',
'webshot',
'workflowr',
'xaringan',
'xfun',
'xtable',
'yaml',
'ztable'
# GH Only: 'MonashEBSTemplates', 'plantuml', 'redoc', 'Statamarkdown', 'rmdrive'
# LaTeX: 'float', 'framed', 'tscolorbox', 'booktabs', 'longtable', 'flafter', 'subfig', 'fancyhdr', 'xcolor', 'listings', 'titling', 'animate'
# Bios only: 'shiny', 'leaflet', 'rolldown', 'crrri', 'projmgr', 'Rd2roxyen', 'servr', 'highr', 'mime', 'testit', 'fun', 'tufte'
# JavaScript: 'DataTables'
)
# Warn to add new deps in DESCRIPTION
pkg2 <- setdiff(pkgs, knitr:::.base.pkgs)
in_desc <- pkg2 %in% desc::desc_get_deps()$package
if (any(!in_desc)) warning("To add to DESCRIPTION: ", paste0(pkg2[!in_desc], collapse = ", "))
# automatically create a bib database for R packages
knitr::write_bib(pkgs, file = 'packages.bib', lib.loc = c(.libPaths(), '~/R-tmp'))
# embed fonts
if (knitr::is_latex_output()) {
pdfs = list.files(knitr::opts_chunk$get('fig.path'), '[.]pdf$', full.names = TRUE)
invisible(lapply(pdfs, embedFonts))
}
```