Skip to contents

[Experimental]

Usage

find_ref_to_word_bibliography(
  input,
  output_file = NULL,
  csl = NULL,
  layout = TRUE,
  overwrite = FALSE
)

parse_ref_to_word_bibliography(
  input,
  output_file = NULL,
  csl = NULL,
  overwrite = FALSE
)

Arguments

input

For find_ref_to_word_bibliography(), the path of one PDF or text document. For parse_ref_to_word_bibliography(), a character vector of references or the path of one text file with one reference per line.

output_file

Path of the Word document to write (.docx). By default, the name of the input with the .docx extension (bibliography.docx for a vector of references), in the working directory.

csl

Optional path to a Citation Style Language file (.csl, see https://www.zotero.org/styles) giving the style of the bibliography. By default, pandoc's style (Chicago author-date).

layout

Logical. If TRUE (the default), the text of PDFs is extracted with its layout (pdftotext -layout). Set it to FALSE for documents in several columns, whose lines are otherwise interleaved.

overwrite

Logical. Replace output_file if it exists? Default FALSE.

Value

Invisibly, the path of the Word document.

Details

Finds the references of a document (find_ref_to_word_bibliography()) or parses references you already have (parse_ref_to_word_bibliography()), and writes them as a formatted bibliography in a Word document, in the citation style of your choice. Useful to recover the bibliography of an old text, or to restyle a list of references for a manuscript.

anystyle writes the references as BibTeX in a temporary file; pandoc (shipped with RStudio and Positron, or installed separately) formats them with citeproc (nocite: '@*' puts every reference in the bibliography). The quality of the result depends on anystyle's parsing: check it, for instance with find_ref_to_df(), before using it in a manuscript.

Examples

if (FALSE) { # \dontrun{
pdf <- system.file("extdata", "example_doc_1.pdf", package = "anystyleR")
find_ref_to_word_bibliography(pdf, output_file = file.path(tempdir(), "biblio.docx"))

# In APA style
find_ref_to_word_bibliography(pdf, csl = "apa.csl")
} # }