papaja icon indicating copy to clipboard operation
papaja copied to clipboard

Revision Letter to Word

Open jgeller112 opened this issue 3 years ago • 3 comments

Is there anything in the works that will allow knitting to a Word document?

jgeller112 avatar Mar 02 '21 00:03 jgeller112

Hi there, I'm afraid, at this point, it's not a priority for me. I'd be more than happy to review a pull request, however, which proposes such an extension. The first thing, that would be required, is a Word-template file with appropriate styles that mirror those that TeX currently produces. Should you be interested in working on this, I'd gladly provide further guidance.

crsh avatar Mar 02 '21 09:03 crsh

I did docx and txt versions outputs for a spin-off package.

This is the docx template I used: response_letter_template.docx

One thing I found challenging was replacing the latex \RC tags using lua. So instead I modified the asis markdown engine to produce the needed markdown outputs for all three formats.

https://github.com/conig/revise/blob/main/R/process_chunks.r

E.g.

```{asis} Reviewer comment ```

becomes \RC{Reviewer comment} for pdf. becomes -\nRC:\nReviewer comment for txt; and, **RC: Reviewer comment** for docx.

Examples outputs from that package: docx output.docx text example.txt pdf example.pdf

Feel free to use the docx template. I'm also happy to do a pull request if you want my hacking the asis engine solution (which I'm guessing you don't!). But there is the advantage that using a code engine to tag reviewer comments results in less latex and shades the reviewer's question in rstudio making it stand out:

E.g.:

image

conig avatar Mar 18 '22 04:03 conig

That looks really promising. I think using fenced div or block syntax would be a very pandoc and more versatile evolution for the current LaTeX approach. I've used this to create multi-language documents in the past and it was quite convenient to work with in Lua. I'm sorry I never got around to responding to your e-mail. I'll try to take a closer look at your package as soon as I can. I'm still interested in joining forces on this (either within papaja or a separate package).

crsh avatar Mar 18 '22 15:03 crsh