R/latexmk.R

Defines functions latexmk

Documented in latexmk

#' @title Call latexmk
#'
#' @param fname Latex file
#' Detects if the references.bib file contains entries and calls
#' bibtex appropriately.
#' @export
latexmk = function(fname) {
  if (!file.exists(fname)) return(invisible(NULL))

  refs = readLines("references.bib")
  if (length(refs) > 2) {
    system2("latexmk", args = c("--xelatex", fname))
  } else {
    system2("latexmk", args = c("--xelatex", "-bibtex-", fname))

  }
  return(invisible(TRUE))
}
jr-packages/jrNotes documentation built on Dec. 18, 2020, 11:07 p.m.