Skip to contents

This function produces a new driver which matches the old one in most respects, but adds an argument sourcepos (and possibly others). If that argument is TRUE (the default) then concordances are handled by the new driver.

This is used to produce pdf_documentC in this package, and should also work on other drivers that produce PDF output using Pandoc.

Usage

pdf_with_patches(driver)

Arguments

driver

An R Markdown driver that produces HTML, LaTeX or PDF using Pandoc.

Value

A new driver function.

Details

This function makes use of the RmdConcord::pdf_with_concordance function. That function adds concordances to the output of the original driver; this function patches the PDF file so that source references in it refer to the original source file.

Examples

pdf_with_patches(rmarkdown::latex_fragment)
#> Loading required namespace: RmdConcord
#> function (latex_engine = "pdflatex", sourcepos = TRUE, defineSconcordance = TRUE, 
#>     run_latex = TRUE, ...) 
#> {
#>     force(run_latex)
#>     res <- driver(latex_engine = latex_engine, sourcepos = sourcepos, 
#>         ...)
#>     res <- apply_patches(res, sourcepos, defineSconcordance, 
#>         run_latex)
#> }
#> <bytecode: 0x5618f7bf2288>
#> <environment: 0x5618f7bf18e8>