Pagedown: chrome_print(output = "*.pdf") can't render `--` and `count: false`

Created on 21 Jun 2019  路  6Comments  路  Source: rstudio/pagedown

I have an issue about how xaringan pauses are rendered by chrome_print() in .pdf.

Reprex:

title: "Reprex"
author: "AB"
date: "`r Sys.Date()`"
output:
  xaringan::moon_reader:
    lib_dir: libs
    nature:
      highlightStyle: github
      highlightLines: true
      countIncrementalSlides: false
---

 ```{r setup, include=FALSE}
options(htmltools.dir.version = FALSE)
 ``` # Remove the #


# Slide one

Hello 

--

First pause

--

Second pause


---
# Slide two

---
count: false
# Slide three


---
class: center, middle

# Thanks!

In .html, there is 7 slides. Three are numbered 2/4 (with --) and two 3/4 (with `count: false).

However, when I used pagedown::chrome_print(input = "reprex.Rmd", output = "reprex.pdf") (or direclty from chrome), the .pdf has only 4 slides : only the last one is kept per page number.

These slides have the class has-continuation, and it renders correctly when I remove it manually and print from chrome.

Thanks :)

Most helpful comment

In order to include this solution in a CSS file, you need to tweak the CSS declaration:

@media print {
  .has-continuation {
    display: block !important;
  }
}

All 6 comments

Hi,

Does it work as expected when opening your html xaringan presentation in chrome and printing to pdf from there ?

I suspect it is not and I think this is not an issue with pagedown. I stumble upon the same thing and the class trick I shared already.

I think It could be related to discussion in yihui/xaringan#192

Have you tried with last xaringan cran version including the fix for #192 ?
It is the same with last xaringan dev version ?

I could come from remark.js directly. I need to test further and see how to adapt the solution if it does not work.

Just an idea: if the rendering is ok after removing the has-continuation class, maybe we could remove this class with JS before generating the pdf with chrome_print().
I'll give it a try.

It still don't work _as I expected_ with xaringan 0.10.1.

But as you pointed out with the discussion, my issue is actually a desired feature :

When printing slides to PDF, only the last slide of a series of incremental slides will be printed.

(from xaringan 0.9 NEWS file.)

@RLesur, removing this class was just a workaround as a result of an investigation of mine when it happened.

I think it needs to be looked into thoroughly to understand what is the real issue here.

I鈥檒l try to find time for that.

As @brshallo mentioned it in his issue, adding this chunk

```{css, echo = FALSE}
@media print {
  .has-continuation {
    display: block;
  }
}
`` `

in the .Rmd solves the problem.

However, adding

@media print {
  .has-continuation {
    display: block;
  }
}

in the CSS file (inside, before, after or instead of the default @media print argument of default.css) does not work.

P.S.: I know it's a xaringan issue but as I began to ask here, if someone found this issue, the workaround is here.

In order to include this solution in a CSS file, you need to tweak the CSS declaration:

@media print {
  .has-continuation {
    display: block !important;
  }
}
Was this page helpful?
0 / 5 - 0 ratings

Related issues

mr-illington picture mr-illington  路  3Comments

atusy picture atusy  路  4Comments

paulcbauer picture paulcbauer  路  4Comments

yihui picture yihui  路  5Comments

beatrizmilz picture beatrizmilz  路  4Comments