Knitting to word

Hi,
when knitting to word, it shows the .docx file and displays all content in a specific deafult set of colours. Is it possible to have the same colours as I have in my .Rmd file, I mean the same set as chosen in Tools > Global options > Appearance ?
This colour set in word is a bit strange.

Hi @Andrzej,

Does this https://rmarkdown.rstudio.com/articles_docx.html gets you where you want?

JW

1 Like

When knitting to Word, it will use a default template. You can change this template but you would need to recreate style that you want as the source Rmd style in IDE won't be the one by default in word.

Also, it could help having some example to really understand which part of the output document you would like the appearance to be styled differently.

thanks

Thank you for your help @cderv ,
basically these are my colours in RStudio, I would like to have it the same after knitting to word. Is it possible ?
obraz

You would need to create a Pandoc highlighting them with the same color.

You could try

output: 
  word_document:
    highlight: rstudio

But I don't know if this is still up to date with the default RStudio theme, or the one you are using.

A custom theme can be defined and passed to this argument, but I don't know the colors you are using and how to retrieve.

RStudio IDE and Pandoc does not use the same highlighting system, so themes are a bit different.
And the parsing of the code can be different, meaning you won't be able to have the exact same code chunk in IDE and in DOC if the highlighter used is not exactly the same.

Hope it helps

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.