Creates a temporary directory for compiling the latex file with latex commands for a csasdown type

create_tempdir_for_latex(
  type = NULL,
  where = "r",
  tmp_dir = NULL,
  root_dir = here::here()
)

Arguments

type

The csasdown document type. See draft()

where

Where to look for the tex file. If "r", look in root directory, if "b", look in the _book subdirectory. Any other value will cause an error

tmp_dir

A temporary directory. If NULL, once will be created in the filesystem using tempdir()

root_dir

A directory where everything will be copied from

Value

The temporary directory's full path

Details

The compiled tex file will be copied from either the root directory or the _book directory, depending on the value of where. The necessary directories knitr-figs-pdf, knitr-figs-word, knitr-cache-pdf, and knitr-cache-word will be copied recursively into the temporary directory, preserving the directory structure necessary for the build.

Examples

if (FALSE) { # \dontrun{
root_dir <- getwd()
tmp_dir <- create_tempdir_for_latex("resdoc", "b")
setwd(tmp_dir)
tinytex::latexmk("resdoc.tex")
setwd(root_dir)
} # }