rstudio / rmarkdown

Dynamic Documents for R
https://rmarkdown.rstudio.com
GNU General Public License v3.0
2.87k stars 975 forks source link

Add support for color table & font table manipulation in rtf_document #1455

Closed hughjonesd closed 6 years ago

hughjonesd commented 6 years ago

I'm adding RTF support to the huxtable package, which prints out formatted tables. RTF documents have a per-document font table and color table; fonts and colors in the table itself are indexes into these.

I'd like to be able to manipulate the font and color tables, so that e.g. if someone has a purple table background with Comic Sans text, that data can be put into them. There's some infrastructure for this in rtf_fc_tables at https://github.com/hughjonesd/huxtable/blob/master/R/rtf.R .

Would you guys be open to this? If so, I could try to submit a pull request.

yihui commented 6 years ago

I don't know what we need to do to support this feature, but will knitr::raw_output() do the job? https://bookdown.org/yihui/rmarkdown/rich-text-format-document.html I'd prefer RTF-specifc features to remain in other packages instead of rmarkdown, but if there is anything you need to support those packages, please feel free to let us know. Thanks!

hughjonesd commented 6 years ago

I don't think raw_output will help here. The issue is that if you add content with special colours or fonts, you need to change the fonttbl or colortbl element in the document header. It is a parallel problem to what latex_dependencies() deals with for LaTeX. (Which suggests there might be room for a general solution for adding non-local information to document headers.)

David

yihui commented 6 years ago

I see. Then a pull request makes perfect sense to me!

hughjonesd commented 6 years ago

OK. I guess this requires figuring out how pandoc does its conversion from markdown to rtf.

hughjonesd commented 6 years ago

Heh, OK, that was naive. Sounds like pandoc isn't really interested in handling fonts and colours - that's out of scope for it. I'm dubious they'll change policy....

yihui commented 6 years ago

Then I'm afraid we cannot do anything about it in rmarkdown...

github-actions[bot] commented 3 years ago

This old thread has been automatically locked. If you think you have found something related to this, please open a new issue by following the issue guide (https://yihui.org/issue/), and link to this old issue if necessary.