latexdiff: Produce a diff of two files using latexdiff

Description Usage Arguments Details Value Examples

Description

latexdiff() uses the external utility latexdiff to create a PDF file showing differences between two Rmd, Rnw or TeX files.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
latexdiff(
  path1,
  path2,
  output = "diff",
  open = interactive(),
  clean = TRUE,
  quiet = TRUE,
  output_format = NULL,
  ld_opts = "--replace-context2cmd=\"none\""
)

Arguments

path1

Path to the first file.

path2

Path to the second file.

output

File name of the output, without the .tex extension.

open

Logical. Automatically open the resulting PDF?

clean

Logical. Clean up intermediate TeX files?

quiet

Logical. Suppress printing? Passed to render and knit, and hides standard error of latexdiff itself.

output_format

An rmarkdown output format for Rmd files, probably rmarkdown::latex_document(). The default uses the options defined in the Rmd files. YAML front matter.

ld_opts

Character vector of options to pass to latexdiff. The default avoids some problems with Rmd files.

Details

File types are determined by extension,which should be one of .tex, .Rmd or .rnw. Rmd files are processed by rmarkdown::render(). Rnw files are processed by knitr::knit().

You will need the latexdiff utility installed on your system:

1
2
3
4
5
# on MacOS:
brew install latexdiff

# on Linux:
sudo apt install latexdiff

latexdiff is not perfect. Some changes will confuse it. In particular:

Value

Invisible NULL.

Examples

1
2
3
4
## Not run: 
latexdiff("file1.Rmd", "file2.Rmd")

## End(Not run)

latexdiffr documentation built on May 3, 2021, 9:07 a.m.