Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to force rstudio/knitr/rmarkdown to use alternative pandoc binary (scholdoc)

scholdoc (see scholarlymarkdown.com) is a fork of pandoc that has !FINALLY! easy referencing of figures/code blocks etc. build in - a central missing piece in pandoc.

Is there any straight forward way to force usage of scholdoc instead of the shipped pandoc binary when using knitr/rmarkdown in rstudio?

When I set in .Rprofile

options(
  rstudio.markdownToHTML = function(inputFile, outputFile) {
    system(
      paste(
        "~/.cabal/bin/scholdoc",
        shQuote(inputFile),
        "-o", shQuote(outputFile)))
  })

as indicated here, this seems to work, but, as it is missing all manner of command line options used by the internal pandoc, produces HTML out of the box and will lead me down a painful way of getting all the CLI options right.

After studying some rmarkdown code, I have also tried to set the environment variable RSTUDIO_PANDOC to contain the path of scholdoc - to no avail.

Can anyone point out an easy way to do this with up-to-date rstudio/scholdoc installations?

like image 267
balin Avatar asked Oct 31 '22 23:10

balin


1 Answers

I asked this long ago an thought that for completeness sake, I'd point out, that bookdown has stepped into the arena to provide cross referencing of figures etc. within rmarkdown documents.

after issuing install.packages('bookdown'), RStudio may be coerced to use it by adding the following to the YAML header of a document:

output:
  bookdown::pdf_document2:
like image 123
balin Avatar answered Nov 09 '22 09:11

balin