Template Edits Breaking Powerpoint Created in RMarkdown

I'm having problems extremely similar to this thread; using template file to generate powerpoint slides via R Markdown - R Markdown - Posit Forum (formerly RStudio Community)

Essentially, I would like to use RMarkdown to create a PowerPoint presentation with a custom template. However, every time I add a reference_doc: rmarkdown produces a PowerPoint that is unreadable (and unrepairable). I have made sure that the template slides are named correctly; this does not help.

The only time this does not occur is when I use the alison_template from apreshill's rmd2ppt templates on GitHub ( rmd2ppt/templates at main · apreshill/rmd2ppt · GitHub, but any edit I make to the template (e.g. changing font colors) results in an unreadable PowerPoint again.

My code looks like this:

date: "`r Sys.Date()`"
author: "Your Name"
title: "Untitled"
    reference_doc: alison-template.pptx

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = FALSE, fig.cap = TRUE)

## Table

```{r layout='Two Content', ph=officer::ph_location_left()}

```{r layout='Two Content', ph=officer::ph_location_right()}

## Slide with Plot

```{r plot1}

The same issue occurs when I use powerpoint_presentation: instead of officedown::rpptx_document:.

Could anyone give me an idea of what the issue could be or how to continue troubleshooting?

My R Markdown version is 2.20, and all files are local.

Is this an old reference doc ? How was it built ? In short, Pandoc expect the reference doc to be a certain doc and best is to use one produced by Pandoc already.

What version of Pandoc are you using ? rmarkdown::pandoc_version() ?

I wonder if their could be an upgrade in Pandoc and somehow it requires a new template file.

Possibly template in rmd2ppt are outdated (they are two years old) or they are not used with a correct Pandoc version.

I would try to regenerate a good template for your Pandoc version. Best way to build a template that works with R Markdown and Pandoc:

  • Either by build a PPTX with Rmardown and using that file as a template after
  • Either export default reference doc from Pandoc and use that file. pandoc has new help for this (pandoc::pandoc_export_reference_doc("pptx") - use version = argument that match the pandoc version you are using with rmarkdown (or use version = "rstudio" if this is the bundled version you are using ) - see doc Manage and Run Universal Converter Pandoc from R • pandoc

Hope it helps