1
0
mirror of https://github.com/eddelbuettel/binb synced 2024-12-22 12:39:58 +01:00
binb/README.md

233 lines
7.7 KiB
Markdown
Raw Normal View History

2019-03-26 21:41:57 -05:00
## binb [![Build Status](https://travis-ci.org/eddelbuettel/binb.svg)](https://travis-ci.org/eddelbuettel/binb) [![Package-License](http://img.shields.io/badge/license-GPL--2-brightgreen.svg?style=flat)](http://www.gnu.org/licenses/gpl-2.0.html) [![CRAN](http://www.r-pkg.org/badges/version/binb)](https://cran.r-project.org/package=binb) [![Dependencies](https://tinyverse.netlify.com/badge/binb)](https://cran.r-project.org/package=binb) [![Downloads](http://cranlogs.r-pkg.org/badges/binb?color=brightgreen)](http://www.r-pkg.org/pkg/binb)
2018-09-27 09:26:14 -05:00
Binb is not Beamer: Stylish pdf Presentations from RMarkdown
### Motivation
The [Beamer](https://github.com/josephwright/beamer) package is very popular for making pdf
2018-09-20 06:11:43 -05:00
presentations from LaTeX, and also supported from Markdown and
[RMarkdown](https://github.com/rstudio/rmarkdown). This package (currently)
2018-09-24 19:41:47 -05:00
provides functionality to use the following custom (LaTeX) themes for
2018-10-09 14:50:18 +11:00
[Beamer](https://github.com/josephwright/beamer) directly via RMarkdown:
2018-09-24 19:41:47 -05:00
- [Metropolis](https://github.com/matze/mtheme) (formerly `mtheme`) by Matthias Vogelgesang
2018-09-24 19:41:47 -05:00
([longer demo](https://eddelbuettel.github.io/binb/metropolis_demo.pdf))
- [IQSS](https://github.com/IQSS/iqss-beamer-theme) by Ista Zahn
2018-09-24 19:41:47 -05:00
([longer demo](https://eddelbuettel.github.io/binb/iqss_demo.pdf))
- [Presento](https://github.com/RatulSaha/presento) by Ratul Saha
([longer demo](https://eddelbuettel.github.io/binb/presento_demo.pdf))
2018-10-15 06:59:54 -05:00
- [Monash](https://github.com/robjhyndman/MonashEBSTemplates) by Rob J Hyndman
2018-09-24 19:41:47 -05:00
The original LaTeX styles been converted to be directly useable from
[RMarkdown](https://github.com/rstudio/rmarkdown)
2018-09-24 19:41:47 -05:00
### Examples
#### Metropolis
Consider the following minimal example, adapted from the original minimal example at the bottom of
the [Metropolis](https://github.com/matze/mtheme) page:
````{md}
---
title: A minimal example
author: Matthias Vogelgesang
date: \today
institute: Centre for Modern Beamer Themes
output: binb::metropolis
---
# First Section
## First Frame
Hello, world!
````
2018-09-27 09:26:14 -05:00
It creates a [three-page pdf file](https://eddelbuettel.github.io/binb/metropolis_minimal.pdf) which
we converted into this animated gif
![](https://eddelbuettel.github.io/binb/metropolis_minimal.gif)
#### IQSS
Similarly, for IQSS we use the following input adapting the example above but showing sections and
subsections for the nice headings it generates:
````{md}
---
title: A minimal example
author: Ista Zahn
date: \today
institute: IQSS
output: binb::iqss
---
# First Section
## First Sub-Section
### First Frame
Hello, world!
# Second Section
## Second Subsection
### Second Frame
Another planet!
````
2018-09-27 09:26:14 -05:00
This creates this [pdf file](https://eddelbuettel.github.io/binb/iqss_minimal.pdf) which we
converted into this animated gif:
![](https://eddelbuettel.github.io/binb/iqss_minimal.gif)
2018-09-24 19:41:47 -05:00
#### Presento
The following small example adapted some of the slides from original minimal example from the
[Presento](https://github.com/RatulSaha/presento) repo:
```{md}
---
author: Ratul Saha
address: www.ratulsaha.com
title: PRESENTO
subtitle: clean, simple and extensible
date: \today
output: binb::presento
---
## Presento
- \begin{center}\largetext{The design is \underline{clean}}\end{center} \bigskip
- \begin{center}\largetext{The rules are \underline{simple}}\end{center} \bigskip
- \item \begin{center}\largetext{The code is \underline{extensible}}\end{center}
## Open Source Fonts
- \montserratfont This is \textsc{Montserrat} \bigskip
- \notosansfont This is \textsc{Noto Sans} \bigskip
- \latolightfont This is Lato (light) \bigskip
- \inconsolatafont This is inconsolata \bigskip
- \textsc{This is Alegreya Sans small caps} \bigskip
## Color Palette
\begin{center}
\crule[colordgray] \crule[colorhgray] \crule[colorblue] \crule[colorgreen] \crule[colororange]
\end{center}
____
\begin{center}
2018-10-09 14:50:18 +11:00
\hugetext{BIG BOLD TEXT}
\medskip
2018-09-24 19:41:47 -05:00
\small but background color does not work
\end{center}
____
\tikz[overlay,remember picture] \node[opacity=0.8, at=(current page.center)]{%
\includegraphics[width=\paperwidth]{images/skeleton}};
\begin{textblock}{7}(7,2.5)
{\color{colorblue}\hugetext{\textbf{RUN!}}}
\end{textblock}
```
2018-09-27 09:26:14 -05:00
From this, one can creats this [pdf file](https://eddelbuettel.github.io/binb/presento_minimal.pdf)
which can be converted into this animated gif:
2018-09-24 19:41:47 -05:00
![](https://eddelbuettel.github.io/binb/presento_minimal.gif)
### Monash
Below is an example of the [Monash Business School](https://www.monash.edu/business) theme by
[Rob Hyndman](https://robjhyndman.com/). (The source is a little longer [and included in the
repo](https://github.com/eddelbuettel/binb/blob/master/inst/rmarkdown/templates/monash/skeleton/skeleton.Rmd)
and package so not shown here.)
![](https://eddelbuettel.github.io/binb/monash_minimal.gif)
2018-10-09 14:50:18 +11:00
### Status
2018-09-24 19:41:47 -05:00
The package is fairly new and susceptible to change, but on
2018-09-20 06:11:43 -05:00
[CRAN](https://cran.r-project.org/).
2018-10-09 14:50:18 +11:00
### Usage
2018-09-20 06:11:43 -05:00
The package is on [CRAN](https://cran.r-project.org/) and can be installed
via a standard
```r
2018-09-20 06:11:43 -05:00
install.packages("binb")
```
2018-09-20 06:11:43 -05:00
and can then be used as a Markdown template via RStudio, or via code such as
```r
library(rmarkdown)
draft("myslides.Rmd", template="metropolis", package="binb", edit=FALSE)
setwd("myslides") ## template creates a new subdir
render("myslides.Rmd")
```
2018-09-20 06:11:43 -05:00
to create a first draft of a new `myslides.Rmd`.
Once installed, the above code examples should work as expected.
### Requirements
Beyond the R package dependencies, a working `pandoc` binary is needed. RStudio installs
its own copy, otherwise do what is needed on your OS (_i.e._, something like `sudo apt-get
install pandoc pandoc-citeproc`).
2018-09-24 19:41:47 -05:00
The [Metropolis](https://github.com/matze/mtheme) LaTeX package is used, but we assume
that is is installed via TeXLive, MikTeX or another LaTeX bundle. The LaTeX code for the
[IQSS Beamer Theme](https://github.com/IQSS/iqss-beamer-theme) and the [Presento
Theme](https://github.com/RatulSaha/presento) are included (and adapted for
[RMarkdown](https://github.com/rstudio/rmarkdown) use).
2018-09-24 19:41:47 -05:00
These themes use additional (free) fonts you may need to install:
- [Metropolis](https://github.com/matze/mtheme) wants [Fira Sans](https://github.com/mozilla/Fira)
but can proceed with alternate fonts;
- [IQSS Beamer Theme](https://github.com/IQSS/iqss-beamer-theme) wants
[Libertinus](https://github.com/libertinus-fonts/libertinus), see the
[IQSS Beamer Theme](https://github.com/IQSS/iqss-beamer-theme) page for details.
2018-10-09 14:50:18 +11:00
- [Presento Theme](https://github.com/RatulSaha/presento) wants
[Montserrat](https://github.com/JulietaUla/Montserrat),
[Lato Light](http://www.latofonts.com/)
2018-09-24 19:41:47 -05:00
(also [here](https://github.com/google/fonts/tree/master/ofl/lato)),
[Noto Sans](https://www.google.com/get/noto),
2018-10-09 14:50:18 +11:00
[Algreya Sans](https://github.com/huertatipografica/Alegreya-Sans) as the small caps font and
2018-09-24 19:41:47 -05:00
[Inconsolata](https://github.com/google/fonts/tree/master/ofl/inconsolata) as a monospaced font.
2018-10-15 06:59:54 -05:00
- [Monash](https://github.com/robjhyndman/MonashEBSTemplates) wants [Carlito](https://fontlibrary.org/en/font/carlito) which some systems (such as Ubuntu)
provide.
2018-09-24 19:41:47 -05:00
If you use [Debian](https://www.debian.org) or [Ubuntu](https://www.ubuntu.com), you can
use the informal font packages I created for [Fira and Fira
Sans](https://github.com/eddelbuettel/pkg-fonts-fira),
[Libertinus](https://github.com/eddelbuettel/pkg-fonts-libertinus),
[Montserrat](https://github.com/eddelbuettel/pkg-fonts-montserrat), [Alegreya
Sans](https://github.com/eddelbuettel/pkg-fonts-alegreya-sans), respectively.
Most modern desktop systems make it easy to install additional fonts as a user. However,
instructions vary so please see for your particular system.
### Authors
Dirk Eddelbuettel, Ista Zahn and Rob Hyndman
### License
GPL (>= 2) for this package.