My work's standard presentation format is Google Slides in a ratio 16:9, with width set to 10 inches. But I hate having to manually input plots etc so originally mimicked it using Beamer, but am now trying to use xaringan for all the modern html features.
My problem comes in that I cannot easily get any consistency in font sizes between displaying presentations on screen and printing them. To elaborate. Let's say I have some text in Google Slides that is designed at 12pt (16px). When I measure the size of the text when displaying in presentation mode, this is consistent with the size of the same text when downloaded as a pdf (and then put in presentation mode - using Sumatra). Ok I know this is a weird thing to do but it highlights the point that Google Slides must be doing lots of background stuff to make these consistent - and the fact I can't get the same consistency with xaringan is - maybe - highlighting a problem. Maybe - I think actually it's probably more correct as I assume it's adjusting to the size / res of my monitor (14 in, 1920 x 1080).
Anyway. If I do the same in xaringan, using the example code below, then (provided I add in the css @page code to force the pdf printing to be the correct physical size) then the font size in the pdf that results matches the font size in the pdf produced by Google. Great! Everything is consistent here and I can print my xaringan slides the same as my Google Slides - e.g. for sharing with customers who point blank refuse to use Google and just want a pdf emailed. I know.
My problem comes that, the font size when viewing the xaringan html slides in full screen mode is only about 75 % of the "correct" pdf size. This is a problem because - ok I can fudge the font sizes up a bit so displaying on screen looks equivalent to Google Slides - but then the fonts in the pdf are all too big. So there's no easy way to make it so that I can use the same .Rmd file for online presenting and sending as a pdf in a way that all font sizes look the same as if I had used Google all along (unless I only present the pdf, but then might as well revert to Beamer).
I guess the reason for all this is some way font sizes are handled in the background but maybe it's a bug? If not, is there a way to force this consistent font sizing between screen and pdf?
tl;dr Google Slides seems to have consistent font sizes between viewing on a screen and pdf - but xaringan seems not to.
Here's an example Rmd. You can see that the resulting pdf (when viewed in presentation mode) has noticeably bigger font sizes than the html file in presentation mode. In Google Slides, these fonts would all be the same size. I'm using xaringanthemer for ease.
---
title: "Presentation Ninja"
subtitle: "⚔<br/>with xaringan"
author: "Yihui Xie"
institute: "RStudio, PBC"
date: "2016/12/12 (updated: `r Sys.Date()`)"
output:
xaringan::moon_reader:
nature:
ratio: "16:9"
highlightStyle: github
highlightLines: true
countIncrementalSlides: false
seal: false
knit: pagedown::chrome_print
---
```{css, echo = FALSE}
@page {
size: 10in 5.625in; # makes sure pdf comes out same size as Google Slides pdf
}
```
```{r setup, include=FALSE}
options(htmltools.dir.version = FALSE)
library(xaringanthemer)
style_mono_light(
base_font_size = "16px",
header_h1_font_size = "1.5rem"
)
```
# Hello World
Install the **xaringan** package from [Github](https://github.com/yihui/xaringan):
Oh and I tried this CSS as well in a code chunk, but although it does fix the size of the html slides, when put in full screen mode the same issue arises:
.remark-container {
height: 540px!important;
width: 960px!important;
}