tex2docx: Convert tex to docx

Description Usage Arguments Details Examples

View source: R/tex2docx.R

Description

Use http://johnmacfarlane.net/pandoc/ to convert tex to docx for those colleagues who use docx.

Usage

1
2
3
  tex2docx(in.file = NULL, out.file = NULL,
    path = paste0(getwd(), "/REPORT"),
    bib.loc = getOption("bib.loc"))

Arguments

in.file

A character vector of the md file.

out.file

A character vector of the outfile. If "replace" over writes the original HTML file. Default, NULL, uses the root name of the in.file plus a number 2.

path

The path to where the documents reside/should be created. Default is the REPORT directory. This conveniently allows for non paths to be supplied to in.file and out.file. Paths can be supplied to in.file and out.file by setting path to NULL.

bib.loc

Optional path to a .bib resource.

Details

The user must have pandoc installed and on their path. pandoc can be installed from:
http://johnmacfarlane.net/pandoc/installing.html

Examples

1
2
3
4
5
6
7
## Not run: 
DOC <- system.file("extdata/doc_library/apa6.qual_tex/doc.tex",
   package = "reports")
BIB <- system.file("extdata/docs/example.bib", package = "reports")
tex2docx(DOC, file.path(getwd(), "test.docx"), path = NULL, bib.loc = BIB)

## End(Not run)

Example output

sh: 1: cannot create /dev/null: Permission denied
sh: 1: cannot create /dev/null: Permission denied
sh: 1: cannot create /dev/null: Permission denied
sh: 1: cannot create /dev/null: Permission denied
Pandoc not installed in one of the typical locations.
 
            Do you know where Pandoc is installed? (y/n) 
sh: 1: -s: not found
docx file generated!

reports documentation built on May 2, 2019, 8:29 a.m.