Unnumbered headings word_document

I am preparing a markdown file for output as a word document. I am using the officedown and bookdown packages
The documentation suggests to generate a unnumbered section heading, the following should work

# Heading 1 {-}


# Heading 1 {unnumbered}

However my docx document continues to number the heading.

Is this a pdf-only feature or have I missed something?


Can you share an example with code ?
What Rmd file do you use ? Can you share an example ?

This would help because this could be mainly a matter of configuration of the different tools.

Also check last versions of packages maybe, in case there is a potential fixed issue.

I have reverted back to the advanced word template and included a company word template and it fails to compile.
I don't want to upload the company template (docx file) but here is the changed yaml code and the compile error

date: "`r Sys.Date()`"
author: "Your Name"
title: "officedown template"
      reference_docx: formal_technical_report_template.docx
        Normal: ['First Paragraph']

Quitting from lines 92-93 (Standard_Advanced_Word_Template.Rmd)
Error: could not match any style named 'Table' in c('Normal Table', 'Table Grid', 'Table 3D effects 1', 'Table 3D effects 2', 'Table 3D effects 3', 'Table Classic 1', 'Table Classic 2', 'Table Classic 3', 'Table Classic 4', 'Table Colorful 1', 'Table Colorful 2', 'Table Colorful 3', 'Table Columns 1', 'Table Columns 2', 'Table Columns 3', 'Table Columns 4', 'Table Columns 5', 'Table Contemporary', 'Table Elegant', 'Table Grid 1', 'Table Grid 2', 'Table Grid 3', 'Table Grid 4', 'Table Grid 5', 'Table Grid 6', 'Table Grid 7', 'Table Grid 8', 'Table List 1', 'Table List 2', 'Table List 3', 'Table List 4', 'Table List 5', 'Table List 6', 'Table List 7', 'Table List 8', 'Table Professional', 'Table Simple 1', 'Table Simple 2', 'Table Simple 3', 'Table Subtle 1', 'Table Subtle 2', 'Table Theme', 'Table Web 1', 'Table Web 2', 'Table Web 3', 'Light Shading1', 'Table_My_Company')
In addition: Warning message:
paragraph style for plots "Figure" has not been found in the reference_docx document. Style 'Normal' will be used instead.
Execution halted

I stripped out all other yaml to this

base_format: "bookdown::word_document2"
reference_docx: formal_technical_report_template.docx

and was able to get TOC TOF and TOT with

 # Tables of content {#toc -}
 # Figures {-}

block_toc(seq_id = 'fig')

# Tables {-}

 block_toc(seq_id = "tab")

However, I still haven''t been able to remove the heading numbering.
I thought this {-} should work.


I believe this this is an officedown issue. It is possible the officedown does not respect the {-} or {.unnumbered} on headers.

Does it works with bookdown only ?

        reference_docx: formal_technical_report_template.docx

By "work" I mean the unnumbering of sections (obviouly TOC TOF and TOT won't work as this is officedown features)

About this error, it seems the reference document does not contain the expected styles for it to work with officedown

Well I can get bookdown to remove the heading numbers as you suggested.
And yes the TOC TOF and TOT fail.

Now the toc: true works as well but puts the toc in front of the title page which doesn't comply to the word template .
I have had success using the officer functions at least with the table of contents, still trying to work out what the correct 'style' is for the TOT and TOF since it tells me there No table of contents entries found.

:::{custom-style="Heading 1 no TOC"}
Table of contents

officer::block_toc(level = 2)

:::{custom-style="Heading 1 no TOC"}

officer::block_toc(style = "Figure")

:::{custom-style="Heading 1 no TOC"}

officer::block_toc(style = 'Table')

Also had to change table and figure references to work when references in inline text \@ref(). e.g. tab.id option chunks are ignored.

So somethings work with officedown and some work without officedown :slight_smile: Not sure where I go from here.
mapstyles, which I think might be useful and I would like to understand more, are officedown features.

I can try to organise an example Rmd file if you think it useful.

If you want to use officedown features and they are not working as you think it should or you think it could be better, I would go open an issue or feature request in the officer repo.

rmarkdown::word_document does not have the added feature from officedown, it can only do what is decribed in the books and what Pandoc allows.

This would indeed be useful for us and for officedown developers.

OK. Give me a couple of days.
I am hoping to show to my colleagues most of us work using latex (some of us for several decades) how they can use markdown to create reports in word using the company report template. The driver for this is the familiar need to work with non-latex user colleagues.
Heading into the bookdown, officedown, officer way seems tricky where it seems some features break using one package or another and trying to find the best single approach seems difficult.
I appreciate the help provided and I realise the developers don't have time or any real reason to address specific issues with specific Word templates . At the end of all this I will write a Rmd file that gives detals about what they can achieve using one (or more) of these packages.

That is a really good use case. Using R Markdown instead to Latex directly will still allow to produce LaTeX document and good users will be able to use there knowledge. But it will also allow others to contribute and produce other type of document from the same source.

If you manage to build a good example, I can look into. Our aim is to make things easier so we are welcoming any new ideas and feedbacks! Happy to help further.

I see that docx files are not allowed to be uploaded. Any other way of getting this to you?


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.