r - Start with highlight mode enabled in ioslides


Question: 

In ioslides presentation with Rmarkdown, there is an option to enable highlight mode in each slide by pressing h. Is there some way to make the highlight mode enabled by default and disable it by pressing h.




1 Answer: 

There is no built-in option to enable highlight mode by default.
This comes from these lines of JavaScript: here and here.
Highlight mode is removed when the speaker changes the slide.

However, there is a hacky way to highlight each slide by default.
In your project, create a new file (named for instance highlight.html).
In this file, copy the following content:

<script type="text/javascript">
  SlideDeck.prototype.prevSlide = function(opt_dontPush) {
    if (this.curSlide_ > 0) {
      var bodyClassList = document.body.classList;
      bodyClassList.add('highlight-code');

      // Toggle off speaker notes if they're showing when we move backwards on the
      // main slides. If we're the speaker notes popup, leave them up.
      if (this.controller && !this.controller.isPopup) {
        bodyClassList.remove('with-notes');
      } else if (!this.controller) {
        bodyClassList.remove('with-notes');
      }

      this.prevSlide_ = this.curSlide_--;

      this.updateSlides_(opt_dontPush);
    }
  };

  SlideDeck.prototype.nextSlide = function(opt_dontPush) {
    if (!document.body.classList.contains('overview') && this.buildNextItem_()) {
      return;
    }

    if (this.curSlide_ < this.slides.length - 1) {
      var bodyClassList = document.body.classList;
      bodyClassList.add('highlight-code');

      // Toggle off speaker notes if they're showing when we advanced on the main
      // slides. If we're the speaker notes popup, leave them up.
      if (this.controller && !this.controller.isPopup) {
        bodyClassList.remove('with-notes');
      } else if (!this.controller) {
        bodyClassList.remove('with-notes');
      }

      this.prevSlide_ = this.curSlide_++;

      this.updateSlides_(opt_dontPush);
    }
  };
</script>

Now, modify the YAML header of the ioslides presentation:

---
title: "Highlighted"
author: "Romain Lesur"
date: "26/06/2018"
output: 
  ioslides_presentation:
    includes:
      after_body: highlight.html
---

It should do the trick.

 

More Articles


.net - PowerPoint Interop - Start presentation with slide index (not fullscreen) with C#

I'm using the code below to start a presentation in C#: var app = new Microsoft.Office.Interop.PowerPoint.Application(); var pres = app.Presentations; Presentation objPres = pres.Open(@"C:\test.pptx", MsoTriState.msoTrue, MsoTriState.msoTrue); objPres.SlideShowSettings.Run();

charts - How to adjust a GraphViz cluster's margin?

I find graphviz cannot independently adjust a cluster's width margin and height margin.As shown below, the cluster's height margin is obviously less than its width margin.GraphViz provides a parameter margin to adjust a cluster's margin. However, it cannot adjust a cluster's width margin only and ke

presentation - Perspective Video inside image

I want to insert a video file (screen recording of an iPhone) inside the image of an actual iPhone but in a perspective view.I found many video-tutorial but all of them are for corner pinning, which doesn't for the images.So my point is to find a way to make corner pinning for the image and then cli


c# - Data presentation in WPF

At the moment, I´m writing a C# - WPF - application, where I often need to show a few Data out of the database. Now, my "problem" is, that I don´t want to use a datagrid, because it is already used very often in my app. Is there any control to show data to the user "beautiful" instead of a datagrid?

r - force column break in RMarkdown ioslides {.columns-2} layout

When preparing a presentation with RMarkdown's ioslides, I encountered a problem which I have not been able to find a solution for. This answer did also not solve this specific problem. Sometimes, two-column layouts are best to explain something with an image on one side and text on the other. Howe

android - MediaRouter connect second time

I am using Android's MediaRouter / Presentation API (the support.v7 version).Everything works fine so far. The only thing that doesn't is:When I quit my activity (e.g.teardown & remove the callbacks), everything still works fine. However, when starting this activity (the previous mediarouter-act


r - select certain elements to build incrementally ioslides

I'm building a presentation using ioslides in RStudio. I have a following slide:```{r, echo=FALSE}logo<-"logo.jpg"```## Playing with R<IMG style="position:absolute;top:5.5%;right:5%;width:140px;"SRC="`r logo`">Type in the interactive console:```{r, eval=FALSE}x <- 1:10 # "name <- valu

How to run a Video Presentation on Android in loop?

I have a group of Android Tablets and I need them to only run a Video Presentation as Company Gift Card.The idea of this project is the same of usually Company's Gift PENs, where the Company give to their presentation audience the information in the PEN, but this case we will have on an Android Tabl

r - Line by line analysis and plotting on multiple monitors during presentation

I am preparing a presentation on data analysis and I am provided with a 2-3 monitor and projector head-up. I would like to use one monitor(+projector) for code, one monitor(+projector) for console display and one monitor(+projector) for plots. Monitors are for me, projectors for the audience. I woul

Draw on second Screen using OnGestureDetection and Presentation API in Android?

Currently I have a setup which consists of a Smartphone and a pico-projector connected via MHL. I can send Images to the projector via the Presentation API with no problems. But now I came to the point, where I have to actively manipulate the second screen. I found hardly any information.Basically I