This function processes a list of LaTeX files, creates corresponding handout files using a specified template, compiles them into PDFs, and removes the intermediate handout files after successful compilation.

compile_handouts(file_list, template_path = "handout_tex/handout.tex")

Arguments

file_list

A list of TeX filenames to be processed and compiled into handouts.

template_path

A string specifying the path to the template LaTeX file (default is "handout_tex/handout.tex").

Value

This function does not return a value but compiles PDFs and deletes the temporary handout TeX files after compilation.

Details

The function reads a template LaTeX file and loops over a user-provided list of TeX files. For each TeX file, the function generates a corresponding handout file by replacing a placeholder in the template, compiles the file into a PDF using tinytex::latexmk, and then deletes the handout TeX file once the PDF is generated. If an error occurs during compilation, it skips to the next file.

Examples

if (FALSE) { # \dontrun{
  tex_files <- list.files(pattern = "^Sta.*\\.tex")
  compile_handouts(tex_files)
} # }