3

I want to be able to create a PowerPoint output in R (using quarto, qmd) but I've been having some difficulties in the actual format of the powerpoint.

When I execute the following code:

---
title: "My presentation"
subtitle: "January 2023"
author: "Me"
format: pptx
reference-doc: template6.pptx
mainfont: Open Sans
sansfont: Open Sans
---
 
# Title 
## Subtitle

I receive a pptx output with two separate slides, as shown:

pptx example1

What I am looking for is something like in the picture bellow:

pptx example2

A title, in a certain color (and larger size) and bellow a subtitle with another color (with a smaller size).

I've tried messing around with the template, but I didn't find anything close to it. I know adding it manually would solve the problem, but I'm really adamant about keeping this process as most "automatic" as possible.

Can anyone help?

Bileobio
  • 121
  • 8

1 Answers1

2

You can use the slide-level option in your document's YAML header.

So in your case, using:

---
title: "My presentation"
subtitle: "January 2023"
author: "Me"
format: pptx
reference-doc: template6.pptx
mainfont: Open Sans
sansfont: Open Sans
slide-level: 1
---

ensures that new slides are created when a heading is level 1 but not for any subheadings. Alternatively, you can turn off new slide creation via headings by using slide-level: 0 and create new slides manually using horizontal rules (e.g. using three dashes ---).

From the documentation:

slide-level

Specifies that headings with the specified level create slides. Headings above this level in the hierarchy are used to divide the slide show into sections; headings below this level create subheads within a slide. Valid values are 0-6. If a slide level of 0 is specified, slides will not be split automatically on headings, and horizontal rules must be used to indicate slide boundaries. If a slide level is not specified explicitly, the slide level will be set automatically based on the contents of the document.

Ritchie Sacramento
  • 29,890
  • 4
  • 48
  • 56
  • Fantastic! And so simple, but I really didn't anyway to solve it. I noticed that the color of the second heading (subtitle) appears black, and I wanted it to be gray. Does this have to do with the pptx template, or is there a way to force a color of a heading via `R` code? – Bileobio Jan 04 '23 at 11:24
  • 1
    Update to my comment: it is possible via formatting pptx-template – Bileobio Jan 04 '23 at 15:48
  • @Bileobio, if this answer solve your problem, I would recommend you to mark this answer accepted and also considering the extent of help you have got from this answer, I would recommend to upvote this (if you haven't already) : ) – shafee Jan 04 '23 at 17:18
  • 1
    @shafee don't worry, I was getting to it ; ) – Bileobio Jan 04 '23 at 17:34