-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy path_global_options.Rmd
44 lines (43 loc) · 1.75 KB
/
_global_options.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
```{r, include=FALSE}
knitr::opts_chunk$set(fig.width=7, fig.height=6, fig.align="center", fig.pos="!htb", out.width = "70%",
cache=TRUE, cache.path='cache/',
echo=TRUE, warning=FALSE, message=FALSE)
fig.path <- "images/"
# fig.path <- ""
# funciones auxiliares
# Rmd, Bookdown
# rmd.lines <- function(l = 1) paste0("<br> \vspace{0.5cm}") #cat(rep("<br>", l)) # 0.5*l
is_latex <- function(...) knitr:::is_latex_output(...)
is_html <- function(...) knitr:::is_html_output(...)
# Rmd code:
inline <- function(x = "") paste0("`` `r ", x, "` ``")
inline2 <- function(x = "") paste0("`r ", x, "`")
# Citas
# Figuras:
# paste0("\\@ref(fig:", "media-dt-conocida", ")")
# labs <- c("fig1", "fig2")
# paste0("\\@ref(fig:", labs, ")")
# list <- c("fig1", "fig2")
# paste0("\\@ref(fig:", list, ")")
# paste0("\\@ref(fig:", list, ")", collapse = ", ")
# citefig("fig1", "fig2")
citefig <- function(..., text = "(ver ") {
x <- list(...)
paste0(text, if(length(x)>1) "figuras: " else "Figura ",
paste0("\\@ref(fig:", x, ")", collapse = ", "),
")")
}
citefig2 <- function(...) {
x <- list(...)
paste0(if(length(x)>1) "[Figuras: " else "[Figura ",
paste0("\\@ref(fig:", x, ")", collapse = ", "),
"]")
}
latexfig <- function(..., output = is_latex()) # output = TRUE)
if (output) citefig2(...) else ""
# Citas Paquetes:
citepkg <- function(x, url = paste0("https://CRAN.R-project.org/package=", x))
paste0("[`", x, "`](", url, ")")
# paste0("[`", x, "`](https://cran.r-project.org/web/packages/", x, "/index.html)")
citepkgs <- function(pkgs) paste(sapply(pkgs, citepkg), collapse = ", ")
```