Home > Back-end >  R Officedown does not apply the mapped style to "Normal" in first paragraphs [officedown]
R Officedown does not apply the mapped style to "Normal" in first paragraphs [officedown]

Time:06-15

Good day

We are using R officedown in R Markdown (.rmd) to create a MSWord document. Our default MSWord style template uses a style called "Body Text" for all paragraphs in the document. MSWord normally defaults to the "Normal" style for all paragraphs.

We use

mapstyles: 
      Normal: ['Body Text']

in the YML header to map "Normal" to "Body Text".

When we knit the .rmd file, the "Body Text" style is applied to all paragraphs, except the first paragraph after each header.

Given that we use R Markdown with the officedown package, paragraphs are written as unformatted text in R Markdown. Headers are created using # for Header 1, ## for Header 2 etc.

Any suggestions on how to get the first paragraph to use the "Body Text" style will be appreciated.

CodePudding user response:

The fisrt paragraph is not associated with style 'Normal' but a style named 'First Paragraph'. So it needs to be handled as the normal style.

mapstyles: 
      Normal: ['Body Text']
      'First Paragraph': ['Body Text']
  • Related