6

This is a similar question that one that is older and yet to be answered. I am using ioslides (rmarkdown) and I would like to include a logo on all slides except for slides that overflow (and thus require scrollbars).

I know how to suppress the logo on all slides except the title slide (https://stackoverflow.com/questions/32458089/add-logo-only-on-first-main-slide-in-ioslides-rstudio?noredirect=1&lq=1).

I also know how to change the size of the logo on main body slides (https://github.com/rstudio/rmarkdown/pull/567/commits/78cd4b7638416e30de0c9784cbe678f882bf4897). Then, from taking the information from the older post (https://stackoverflow.com/questions/38338469/hide-logo-and-page-number-only-for-scrolling-slides-in-rmarkdown) and the information about creating a custom option as discussed here where it says:

"You can also target specific slides or classes of slice with custom CSS by adding ids or classes to the slides headers within your document. For example the following slide header:"

## Next Steps {#nextsteps .emphasized}

"Would enable you to apply CSS to all of it’s content using either of the following CSS selectors:"

#nextsteps {
   color: blue;
}

.emphasized {
   font-size: 1.2em;
}

I tried doing both of these in the .Rmd file:

## A long slide {#nologo}

And this in the .css file (I copied the default.css (https://github.com/rstudio/rmarkdown/blob/3d46213d750fd4ebb83e73d0df357f081c73f49f/inst/rmd/ioslides/ioslides-13.5.1/theme/css/default.css) file into my working directory):

#nologo {
    slides > slide { overflow: scroll; } !important;
    slides > slide:not(.nobackground):after {content: '';} !important;
    slides > slide:not(.nobackground):before {background: none;} !important;
}

That didn't work. Neither did this:

slides > slide #nologo {
    slide { overflow: scroll; } !important;
    slide:not(.nobackground):after {content: '';} !important;
    slide:not(.nobackground):before {background: none;} !important;
}

Here is a MWE:

.Rmd file:

---
title: "Slideshow"
author: "me"
date: "`r format(Sys.time(), '%d %B %Y')`"
css: css/default.css
logo: images/logo.png
output:
  ioslides_presentation:
    incremental: true
    keep_md: true
---
# First Section
## Normal slide
Text here, blahblahblah

## Scrolling slide
```{r}
df <- iris
head(df, 25)
```

And the css file is the default.css file with these exceptions:

/* Change size of logo on regular slides */
/* https://github.com/rstudio/rmarkdown/pull/567/commits/78cd4b7638416e30de0c9784cbe678f882bf4897 */
slides > slide:not(.nobackground):before {
    width: 75px;
    height: 75px;
    background-size: 75px 75px;
}

/* overflow changed from hidden to auto */
/* line 98, ../scss/_base.scss */
slides > slide {
  display: block;
  position: absolute;
  /* overflow: hidden; */
  overflow: auto;
  left: 50%;
  top: 50%;
  -webkit-box-sizing: border-box;
  -moz-box-sizing: border-box;
  box-sizing: border-box;
}

I am wondering if, during the build process, there is a way to "check" if a slide will overflow and automatically suppress the logo and/or page number or if I can pass an option on a per slide basis to suppress the logo and/or page number?

Community
  • 1
  • 1
Brent
  • 61
  • 3

0 Answers0