What is the syntax for using pandoc with RStudio Markdown to convert to MS Word? How can it be used to include bibliography and inline references?

RStudio now supports direct knitting of .Rmd files in docx format - pure gold for those who are the technical side of most interactions, where the final changes to the article will be made in Word.

However, I just figured out how to get R, knitr and pandoc to play with each other, and so I'm looking for some help in making the transition while the documentation is still in its infancy.

My file converts without problems using the yaml code block as follows:

--- title: "Testing" output: word_document: fig_width: 5 fig_height: 5 fig_caption: true --- 

and the documentation says that, assuming I have the file 'myLibrary.bib' in the same directory as my .Rmd file, I should be able to add something like this:

  pandoc_args: [ bibliography: "myLibrary.bib" ] 

or

 pandoc_args: [ --bibliography "myLibrary.bib" ] 

but I cannot find examples of how to format this in obvious places: here or here

Bonus points for code that also links the bibliography to the myJournalFormat.csl file are also in the same folder.

+6
source share
2 answers

You need to enclose your arguments in quotation marks ( "" ) and separated by commas

If I have a bibliographic file named biblio.bib and the csl file is chicago-author-date.csl ,

the next front will work

 --- title: "Example Doc" output: word_document: pandoc_args: [ "--csl", "chicago-author-date.csl", "--bibliography", "biblio.bib" ] --- 
+6
source

I had the same problem as you. This may not be the real answer to your question, but you can take a look at the David Gohel r ReporteRs report package http://davidgohel.imtqy.com/ReporteRs/gettingstarted.html . It simplified let r generate .docx files. I already had amazing results!

+1
source

Source: https://habr.com/ru/post/969606/


All Articles