Skip to content
/ gdstheme Public template

📃📦 R package: {xaringan} theme and template, (unofficial) Government Digital Service style

License

Unknown, MIT licenses found

Licenses found

Unknown
LICENSE
MIT
LICENSE.md
Notifications You must be signed in to change notification settings

matt-dray/gdstheme

Repository files navigation

{gdstheme}

Lifecycle: experimental Blog post

tl;dr

R package containing {xaringan} presentation theme and template in the style of the UK's Government Digital Services. See:

Purpose

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.

Install

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")

Begin a slideshow

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"
)

Styling

Classes

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

Helpers

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)]

Contribute

Please feel free leave an issue. Please follow the code of conduct.

About

📃📦 R package: {xaringan} theme and template, (unofficial) Government Digital Service style

Topics

Resources

License

Unknown, MIT licenses found

Licenses found

Unknown
LICENSE
MIT
LICENSE.md

Code of conduct

Stars

Watchers

Forks

Languages