Knitting my *.Rmd
file into a PowerPoint presentation still worked perfectly last year, but now throws warnings like:
Powerpoint template warning: Couldn't find layout named "Section Header" in provided reference doc.
This is helpful and nicely indicates why the result does not have the style I set and expected.
I assume this issue to be due to PowerPoint not consistently using the same names in style templates.
Indeed, I can partially fix this by renaming the style templates to match the ones RMarkdown/Bookdown/knitr are expecting. However, the renaming is laborious and error-prone.
Did anyone of you experience a similar problem with newer versions of PowerPoint? I read some description saying that this could also be due to the language settings PowerPoint is using, but chaning them to US-English didn't help: The names of the templates were actually English before, they were just slightly different than the ones expected by RMarkdown.
For anyone arriving here by web-search for the same error message, there are some useful information on https://stackoverflow.com/questions/57715758/modifying-existing-corporate-powerpoint-template-for-use-in-rmarkdown-could-not?rq=3, which mentions 4 layouts named ppt/slideLayouts/slideLayout[1-4].xml
, which need to be included in a PPTX template:
ppt/slideLayouts/slideLayout1.xml
is a title slide, and must have:
- have a p:ph element with type="ctrTitle"
- have a p:ph element with type="subTitle"
- have a p:ph element with type="dt"
ppt/slideLayouts/slideLayout2.xml
is a title + content slide, and must have:
- have a p:ph element with type="title"
- have a p:ph element without a type attribute
ppt/slideLayouts/slideLayout3.xml
is a section header slide, and must have:
- have a p:ph element with either type="title" or type="ctrTitle"
ppt/slideLayouts/slideLayout2.xml
is a title + two-content slide, and must have:
- have a p:ph element with type="title"
- have at least two p:ph elements without a type attribute
Pandoc's PPTX supports only a very limited set of features and PowerPoint is often changing.
Therefore, fine-tuned control of PPTX output via Pandoc (and thus also RMarkdown) is currently difficult.