6

I'm writing an .rmd file in RStudio, and using the Knit button to create a slide deck. I have two options, it appears, ioslides and slidy. I don't really like the default look-and-feel of either. (I think ioslides uses screen real estate inefficiently, and slidy feels like a graphic designer wasn't involved.)

I did a web search for alternative templates/styles/themes, and came upon pages like this gallery, but the tools there seem to be for use outside RStudio, as completely independent projects. In other words, they're not just themes for what I've got, but entirely other solutions that would change my workflow.

Is there a simple way to tell RStudio to use a different template/theme with either ioslides or slidy? For example, can I download a CSS file from somewhere, and point RStudio to it with the css: option in the yaml header of my .rmd file? If so, is there a gallery of such CSS templates?

Nathan
  • 1,451
  • 1
  • 15
  • 28
  • 1
    ..? those links you posted show you how to change the css – rawr Apr 13 '16 at 17:51
  • 1
    They do. I'm hoping to not have to invent an entire stylesheet myself. I'm hoping there are some pre-invented themes I can browse and choose from. – Nathan Apr 13 '16 at 21:51

2 Answers2

4

Here's what I ended up doing. It's not as smooth as I'd like it to be, but it's decent. I'm glad to entertain better answers.

  1. Download any of the style files linked to from this knitrBootstrap code into the same folder as your R Markdown file.
  2. Edit it so that the URL at the start of the file begins with http: so that knitr knows not to look on your filesystem for the additional resources (fonts), but on the Web.
  3. Edit it further to remove any pipes (|) in that URL, because knitr can't handle them (as far as I can tell). (Remove everything after the pipe, too.)
  4. Edit it further to change everything of the form url('../fonts/***.eot'); to now instead be of the form url('https://netdna.boostrapcdn.com/bootswatch/3.0.0/fonts/***.eot');.
  5. Link to it from your R Markdown file with the css: attribute in the YAML header.
Nathan
  • 1,451
  • 1
  • 15
  • 28
  • `https://netdna.boostrapcdn.com/bootswatch/3.0.0/fonts/` does not work anymore and returns the following error `pandoc.exe: Could not fetch https://netdna.boostrapcdn.com/bootswatch/3.0.0/fonts/glyphicons-halflings-regular.eot FailedConnectionException2 "netdna.boostrapcdn.com" 443 True Network.Socket.sendBuf: failed (Unknown error) Error: pandoc document conversion failed with error 67` – Joanne Demmler Aug 17 '18 at 09:22
  • Bootstrap is spelled incorrectly in your error message. You have boostrap instead of bootstrap. – Nathan Aug 18 '18 at 10:51
  • @Nathan can you please provide an example of an edited text file? I am not sure if I am following your instructions correctly. – Maral Dorri Feb 12 '21 at 16:30
1

Have you tried using the built in Bootswatch themes? They're fairly limited, but in doing so you can quickly customise many elements.

e.g

title: "Test"
author: "John"
date: "5 June 2017"
output: 
  slidy_presentation: 
    fig_width: 12.5
    font_adjustment: -1
    theme: readable        

Other themes may be found here Bootswatch.

edit: removed a typo

JohnL_10
  • 549
  • 5
  • 15