rstudio / revealjs

R Markdown Format for reveal.js Presentations
Other
327 stars 85 forks source link

Reveal.js incremental option doesn't apply to Latex formulas #99

Closed rleyvasal closed 3 years ago

rleyvasal commented 3 years ago

Issue

Latex in slide static when using incremental option - bullets still appear incremental.

## Slide 1 - fraction

$$\frac{a}{b}$$

Expected

Latex should be incremental same as bullet points

cderv commented 3 years ago

What is exactly the behavior you expect ? Is it the equation inside the first bullet point and to appear with the bullet point ?

For that, you need to make sure that the equation is indented correctly to be part of the bullet point.

Try this

---
title: "Untitled"
output: 
  revealjs::revealjs_presentation:
    incremental: true
---

## Slide 1

- fraction

  $$\frac{a}{b}$$

reveal-increment

rleyvasal commented 3 years ago

Expected output: same as an R presentation (code below), bullet first, then the Latex)

Rpresentation
========================================================
author: 
date: 
autosize: true
incremental: true

Slide 1
========================================================

- fraction

  $$\frac{a}{b}$$   
cderv commented 3 years ago

I believe this is not supported by Pandoc directly. The feature is called incremental list: https://pandoc.org/MANUAL.html#incremental-lists So I believe that unless you also use a list item for the math element, it won't work. You cannot make any paragraph line incremental with this feature.

It is powered by Pandoc directly and it is unlikely we will change that in revealjs directly.

rleyvasal commented 3 years ago

Just as a side note, I was able to override the behavior in slidy_presentation with <ul> and <li> tags as shown below; however, this code does not work in revealjs_presentation

# Slide with Bullets

<ul class="incremental">

<li>
fraction
</li>

<li>
  $$\frac{a}{b}$$ 
</li>

</ul>
rleyvasal commented 3 years ago

Adding - infront of the Latex formula makes Latex incremental with a bullet point - It would be better if it appeared without bullet point, like R presentation, but this works for now.

# Slide with Bullets

- fraction
- $$\frac{a}{b}$$ 

slide

cderv commented 3 years ago

Yes I said if you use a list item for the math element it works. So adding the dash is the easy solution. Thanks for sharing that it works ok.

You could try custom css to remove (hide) the marker maybe.

If you want to use HTML directly this is a solution. You just need to use the syntax compatible with revealjs, which is probably different from slidy. You can inspect the resulting HTML code to see what it looks like to set the correct classes on the node.

cderv commented 3 years ago

Now looking closer on how reveal.js is working and knowing better Pandoc feature, here is the way to do incremental revealing of content on a slide: Use pausing !

---
title: Incremental reveal
output: 
  revealjs::revealjs_presentation: default
---

# Pausing in slide content

fraction will come next 

. . .

$$\frac{a}{b}$$ 

# Next slide

Conclusion

. . . is a special Pandoc syntax (https://pandoc.org/MANUAL.html#inserting-pauses) that will transform into reveal fragment features. See #120 for more experiment on supported syntax using reveal.js fragment class.

I'll close this now because it seems like a suitable answer that does not rely on Incremental List where list are not desired here.