Skip to content

Commit

Permalink
reuse append_in_header() in one more place
Browse files Browse the repository at this point in the history
  • Loading branch information
yihui committed Nov 26, 2019
1 parent cf03816 commit 48e4584
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions R/pdf_document.R
Original file line number Diff line number Diff line change
Expand Up @@ -108,14 +108,18 @@ pdf_document <- function(toc = FALSE,
# table of contents
args <- c(args, pandoc_toc_args(toc, toc_depth))

append_in_header <- function(text, file = as_tmpfile(text)) {
includes_to_pandoc_args(includes(in_header = file))
}

# template path and assets
if (identical(template, "default")) {

pandoc_available(error = TRUE)
# patch pandoc template if necessary
version <- pandoc_version()
if (version <= "2.5") args <- c(
args, "--include-in-header", system_file_arg("rmd/latex/subtitle.tex")
args, append_in_header(file = rmarkdown_system_file("rmd/latex/subtitle.tex"))
)

} else if (!is.null(template)) {
Expand Down Expand Up @@ -158,10 +162,6 @@ pdf_document <- function(toc = FALSE,
pdf_pre_processor <- function(metadata, input_file, runtime, knit_meta, files_dir,
output_dir) {

append_in_header <- function(text) {
includes_to_pandoc_args(includes(in_header = as_tmpfile(text)))
}

# make sure --include-in-header from command line will not completely
# override header-includes in metadata but give the latter lower precedence:
# https://github.com/rstudio/rmarkdown/issues/1359
Expand Down

0 comments on commit 48e4584

Please sign in to comment.