Hao Zhu | e0a36a8 | 2015-11-23 15:35:20 -0500 | [diff] [blame] | 1 | #' Rmarkdown Format |
| 2 | #' |
| 3 | #' @description If the export format of the Rmarkdown document exist, |
| 4 | #' |
| 5 | #' @importFrom rmarkdown metadata |
| 6 | #' |
| 7 | #' @export |
| 8 | |
| 9 | rmd_format <- function(){ |
| 10 | rmd_output_metadata <- metadata$output |
Hao Zhu | c1f3841 | 2017-02-23 12:13:48 -0500 | [diff] [blame] | 11 | # rmd_fmt <- ifelse( |
| 12 | # is.null(rmd_output_metadata), |
| 13 | # "markdown", ifelse( |
| 14 | # rmd_output_metadata %in% c("html_document", "rmarkdown::html_vignette"), |
| 15 | # "html",ifelse( |
| 16 | # rmd_output_metadata %in% c("pdf_document", "rmarkdown::tufte_handout"), |
| 17 | # "latex", "markdown" |
| 18 | # ))) |
| 19 | return(names(rmd_output_metadata)) |
| 20 | } |
| 21 | |
| 22 | #' Load a LaTeX package |
| 23 | #' |
| 24 | #' @description Load a LaTeX package using R code. Just like `\\usepackage{}` |
| 25 | #' in LaTeX |
| 26 | #' |
| 27 | #' @param name The LaTeX package name |
| 28 | #' @param options The LaTeX options for the package |
| 29 | #' @export |
| 30 | usepackage_latex <- function(name, options = NULL) { |
| 31 | invisible(knit_meta_add(list(latex_dependency(name, options)))) |
Hao Zhu | e0a36a8 | 2015-11-23 15:35:20 -0500 | [diff] [blame] | 32 | } |