5

I have been working with Quarto in RStudio to do some presentations.

I like to do the presentations with revealjs and than convert the .html output to .pdf to send to my students.

Can I render both formats at the same time?


---
title: "R and RStudio"
author: "RTheodoro"
institute: "USP"
format: 
   revealjs:
     logo: img/usp_logo.png
     slide-number: true
     show-slide-number: all
     preview-links: auto
     width: 1280
     height: 720
     theme: default
editor: visual
execute:
  echo: true
---

## What is R?

-   R is.....

RxT
  • 486
  • 7
  • 17

3 Answers3

2

I just did this and pressed "Render" in RStudio and it generated the pdf and the html. Is that what you mean?

---
title: "R and RStudio"
author: "RTheodoro"
institute: "USP"
format: 
  revealjs:
     logo: img/usp_logo.png
     slide-number: true
     show-slide-number: all
     preview-links: auto
     width: 1280
     height: 720
     theme: default
  pdf: default
editor: visual
execute:
  echo: true
---

## What is R?

-   R is.....

Render

Will
  • 910
  • 7
  • 17
  • Almost there! In this way I lost the presentation format.. I mean, the "slides". – RxT Aug 23 '22 at 18:44
  • are you referring to the slide number 1/2 on the top right corner of the html? I do have them... – Will Aug 23 '22 at 19:32
  • When I do it, I have just the texts in pages. Like a word document. Not in the presentation format. – RxT Aug 26 '22 at 13:06
2

You may want to try the {renderthis} package to print the html output as pdf of your quarto slides which will preserve the slide format and styles.


quarto_render.qmd

---
title: "R and RStudio"
author: "RTheodoro"
institute: "USP"
format: 
   revealjs:
     # logo: img/usp_logo.png
     slide-number: true
     show-slide-number: all
     preview-links: auto
     width: 1280
     height: 720
     theme: default
execute:
  echo: true
---

## What is R?

-   R is.....

## Quarto

Quarto enables you to weave together content and executable code into a 
finished presentation. To learn more about Quarto presentations 
see <https://quarto.org/docs/presentations/>.

Then simply render this quarto_render.qmd file as you do, by clicking the render button in Rstudio, which will create an html file quarto_render.html in your working directory. Then from the console, run this command,

renderthis::to_pdf("quarto_render.html")

Which will create a pdf file quarto_render.pdf with slide format in your working directory.

shafee
  • 15,566
  • 3
  • 19
  • 47
0

I got this to work in line with previous answer from shafee, but had to add an empty styles.css file to the working directory for pagedown::chrome_print() to not error on not finding the css file.

schluppeck
  • 11
  • 1