rfortherestofus / omni

RMarkdown template, ggplot2 theme, and table function for OMNI Institute
https://rfortherestofus.github.io/omni/
Other
21 stars 5 forks source link

Possible additional features to a Word template #78

Closed OskaratOmni closed 10 months ago

OskaratOmni commented 10 months ago

Hey @tvroylandt and @dgkeyes
I just met with a team member who has to knit a report to Word. There are some formatting requirements for this report that go beyond what is in our current Word template. In this issue I want to discuss if some additional features are worth adding (perhaps to a second Word report template), and if so we can create new issues for each feature if necessary.

The first is a table of contents. If I have this yaml with our current word report template:


title: "Title" subtitle: "Subtitle" author: "Author" date: "r format(Sys.time(), '%d %B, %Y')" output: omni::omni_word_report: toc: TRUE editor_options: chunk_output_type: console always_allow_html: yes

It does make a TOC but right in the middle of the title page and the page numbers overlap with that side grey margin, etc. Could we make that TOC a little bit nicer looking and have it start on the next page? If it is too complex to do so, we can do it manually in Word after knitting but it could be a nice feature.

Similarly, What about adding a list of figures and a list of tables to pages after the TOC? It seems that the 'tags' for figures and tables are there in the knitted output but I don't know if we can easily add those lists or not.

If this really seems like more work than it is worth to add a template with these features just let me know. But if it is not too bad then they wold be nice to have.

dgkeyes commented 10 months ago

I'm going to let @tvroylandt chime in on this, as I'm not sure about the work involved in this.

tvroylandt commented 10 months ago

Ok, I made some changes to the template (moving to officedown) so allow us to have a TOC, LOT and LOF. This doesn't work through the YAML header, you have to set them inside the document like that : https://github.com/rfortherestofus/omni/blob/main/inst/rmarkdown/templates/word_report/skeleton/skeleton.Rmd#L32

May you try and confirm that's ok ?

OskaratOmni commented 10 months ago

Hey @tvroylandt this is awesome thank you.

For me, the TOC and list of tables is working well, but it seems to not read the figure caption the way we expect. For instance, this is what I see on the TOC page:

image

OskaratOmni commented 10 months ago

I tried looking to see if there was another way to specify the style argument, but I didn't see anything.

tvroylandt commented 10 months ago

Oh that's strange, it's working on my side. Maybe we have a different Word version ?

In that case, you can maybe mimic what I did to identify the tables in the list of table (replacing the tab by fig) and see if it works ?

OskaratOmni commented 10 months ago

Great, yes that worked! So I changed: block_toc(style = "Image Caption") to: block_toc(seq_id = "fig")

and it worked just fine.

Can you please make that adjustment to the template and send a note when you have pushed it?

tvroylandt commented 10 months ago

Done

OskaratOmni commented 10 months ago

thanks @tvroylandt !!