R package containing {xaringan} presentation theme and template in the style of the UK's Government Digital Services. See:
This package provides an unofficial, unbranded theme and slide template that mimics the style of slides at Government Digital Service (GDS), part of the UK's Cabinet Office.
You can use it to integrate easily the outputs of R code with your slides to help make them more reproducible. Otherwise, you have to generate outputs separately and source them in.
I, and this project, are no longer affiliated with GDS.
The template requires the {xaringan} package by Yihui Xie, which provides an implementation of remark.js through R Markdown. It will be installed when you download {gdstheme}
# install.packages("remotes")
remotes::install_github("matt-dray/gdstheme")
To open the {gdstheme} template in RStudio, go to File
> New File
> RMarkdown...
> From Template
> Slide template for GDS
You can also use the draft()
function from the {rmarkdown} package:
rmarkdown::draft(
file = "doc_name.Rmd",
template = "gdstheme",
package = "gdstheme"
)
These classes should be specified at the top of each slide.
Code | Class description | Example |
---|---|---|
class: title-slide, bottom |
Title slide class (text at bottom) | Title slide |
class: inverse, middle |
Text heading slide class (text in the middle) | Heading slide |
class: inverse, middle background-image: url("path/to/image.jpg") background-size: cover |
Text heading slide class (text in the middle) with background image | Image heading slide with text and without |
[blank] | The regular text slide class is the default and doesn't need to be declared | A text slide |
So this would be rendered into a heading slide:
---
class: heading-slide, middle
This is a heading slide
These are useful snippets that can help transform elements on the page.
Code | Purpose | Example |
---|---|---|
.bold[Text] |
Makes text bold | 'Firstname Lastname' on title slide |
.black[Text] |
Makes text black (use for contrast on heading slides) | Text on heading slide |
.pull-left[Content] |
Content in left half of slide only | Text on this slide |
.pull-right[Content] |
Content in right half of slide only | Image on this slide |
So you could have a slide with an annotated image like this:
---
.pull-left[This is how to annotate an image]
.pull-right[![](img/gds-blog-bold.jpg)]
Please feel free leave an issue. Please follow the code of conduct.