Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
pat-s committed Oct 26, 2017
1 parent f6a117b commit 22c2db4
Show file tree
Hide file tree
Showing 9 changed files with 610 additions and 2 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.Rproj.user
.Rhistory
.RData
.Ruserdata
55 changes: 53 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,53 @@
# xaringan-metropolis
Metropolis theme of R package xaringan
# xaringan

This is a theme for the R package [`xaringan`](https://github.com/yihui/xaringan) which itself relies on [`remark.js`](https://remarkjs.com/#1) to create a markdown based presentation.
You can see an example of the default look of `xaringan` [here](http://slides.yihui.name/xaringan/).

## metropolis theme

The theme of this repository is trying to be a copy of the [`metropolis`](https://github.com/matze/mtheme) theme for the Beamer class in LaTeX.
However, margins may not be correct and font sizes may not reflect the original theme.
Currently, the theme only supports 4:3 ratio.
You can find the demo slides of the theme here.

<img src="figs/example.png" style="width: 100%" />

## Installation

If you want to use this theme, you need to install `R` and the package `xaringan`

```r
remotes::install_github('yihui/xaringan')
```

If you use RStudio, it is easy to get started from the menu `File -> New File -> R Markdown -> From Template -> Ninja Presentation`, and you will see an R Markdown example. Press the `Knit` button to compile it, or use the RStudio Addin `Infinite Moon Reader` to live preview the slides (every time you update and save the Rmd document, the slides will be automatically reloaded; make sure the Rmd document is on focus when you click the addin). Please see the [issue #2](https://github.com/yihui/xaringan/issues/2) if you do not see the template or addin in RStudio.

In the YAML header you need to insert the two css files of this repository:

``` yaml
xaringan::moon_reader:
lib_dir: libs
css: ["mtheme.css", "fonts_mtheme.css"]
```
You can also load it dynamically from the repository:
``` yaml
xaringan::moon_reader:
lib_dir: libs
css: ["https://github.com/pat-s/xaringan-mtheme.css",
"https://github.com/pat-s/xaringan-fonts_mtheme.css"]
```
## Additional tweaks
`remark.js` allows to have custom macros defined at startup that simplify your life with `xaringan`.
See this [xaringan demo slide](https://slides.yihui.name/xaringan/#30) for more information.

## Further information

Feel free to fork and modify this theme.
Pull requests are also welcome.
Also have a look at the `xaringan` [wiki](https://github.com/yihui/xaringan/wiki) and `remark` [wiki](https://github.com/gnab/remark/wiki) to know all features of this presentation tool.

The main R Markdown output format in this package is `moon_reader()`. See the R help page `?xaringan::moon_reader` for all possible configurations.
Binary file added figs/example.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
101 changes: 101 additions & 0 deletions fonts_mtheme.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
@import url(https://fonts.googleapis.com/css?family=Yanone+Kaffeesatz);
@import url(https://fonts.googleapis.com/css?family=Droid+Serif:400,700,400italic);
@import url(https://fonts.googleapis.com/css?family=Source+Code+Pro:400,700);
@import url(https://fonts.googleapis.com/css?family=Fira+Sans:300,300i,400,400i,500,500i,700,700i);
@import url(https://cdn.rawgit.com/tonsky/FiraCode/1.204/distr/fira_code.css);

body {
font-family: 'Fira Sans','Droid Serif', 'Palatino Linotype', 'Book Antiqua', Palatino, 'Microsoft YaHei', 'Songti SC', serif;}

.remark-code, .remark-inline-code {
font-family: 'Fira Code', 'Lucida Console', Monaco, monospace;
font-size: 80%;
}

.remark-inline-code {
/* background: #F5F5F5; /* lighter */
background: #e7e8e2; /* darker */
border-radius: 3px;
padding: 4px;
}

.code10 .remark-code {
font-size: 10%;
}

.code20 .remark-code {
font-size: 20%;
}

.code30 .remark-code {
font-size: 30%;
}

.code40 .remark-code {
font-size: 40%;
}

.code50 .remark-code {
font-size: 50%;
}

.code60 .remark-code {
font-size: 60%;
}

.code70 .remark-code {
font-size: 70%;
}

.code80 .remark-code {
font-size: 80%;
}

.code90 .remark-code {
font-size: 90%;
}

.code100 .remark-code {
font-size: 100%;
}

.font10 {
font-size: 10%;
}

.font20 {
font-size: 20%;
}

.font30 {
font-size: 30%;
}

.font40 {
font-size: 40%;
}

.font50 {
font-size: 50%;
}

.font60 {
font-size: 60%;
}

.font70 {
font-size: 70%;
}

.font80 {
font-size: 80%;
}

.font90 {
font-size: 90%;
}

.font100 {
font-size: 100%;
}

4 changes: 4 additions & 0 deletions macros.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
remark.macros.scale = function (percentage) {
var url = this;
return '<img src="' + url + '" style="width: ' + percentage + '" />';
};
176 changes: 176 additions & 0 deletions mtheme.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,176 @@
a, a > code {
color: rgb(249, 38, 114);
text-decoration: none;
}

.footnote {
position: absolute;
bottom: 3em;
padding-right: 4em;
font-size: 90%;
}
.remark-code-line-highlighted { background-color: #ffff88; }

.remark-slide-content {
background-color: #FAFAFA;
border-top: 80px solid #23373B;
font-size: 25px;
font-weight: 300;
line-height: 1.5;
padding: 1em 2em 1em 2em
}

.title-slide .inverse .remark-slide-content {
background-color: #FAFAFA;
}

.inverse {
background-color: #23373B;
text-shadow: none;
}
.inverse h1, .inverse h2, .inverse h3 {
color: #f3f3f3;
}
/* Two-column layout */
.left-column {
color: #777;
width: 20%;
height: 92%;
float: left;
}
.left-column h2:last-of-type, .left-column h3:last-child {
color: #000;
}
.right-column {
width: 75%;
float: right;
padding-top: 1em;
}
.pull-left {
float: left;
width: 47%;
}
.pull-right {
float: right;
width: 47%;
}
.pull-right ~ * {
clear: both;
}
img, video, iframe {
max-width: 100%;
}
blockquote {
border-left: solid 5px lightgray;
padding-left: 1em;
}
table {
margin: auto;
border-top: 1px solid #666;
border-bottom: 1px solid #666;
}
table thead th { border-bottom: 1px solid #ddd; }
th, td { padding: 5px; }
thead, tfoot, tr:nth-child(even) { background: #eee }

@page { margin: 0; }
@media print {
.remark-slide-scaler {
width: 100% !important;
height: 100% !important;
transform: scale(1) !important;
top: 0 !important;
left: 0 !important;
}
}

.remark-slide-content > h1 {
font-family: 'Fira Sans';
font-weight: normal;
font-size: 45px;
margin-top: -95px;
margin-left: -00px;
color: #FAFAFA;
}

.remark-slide-content > inverse {
width: 112px;
height: 47px;
border-bottom: 1px solid black;
position: absolute;
}

.remark-slide-content > h2 {
padding-top: -15px;
padding-bottom: 00px;
color: #1A292C;
text-shadow: none;
font-weight: 400;
font-size: 35px;
text-align: left;
margin-left: 00px;
}

.remark-slide-content > h3 {
padding-top: -15px;
padding-bottom: 10px;
color: #1A292C;
text-shadow: none;
font-weight: 400;
font-size: 30px;
text-align: left;
margin-left: 00px;
}

.title-slide {
background-color: #FAFAFA;
border-top: 80px solid #FAFAFA;
}

.title-slide > h1 {
color: #1A292C;
font-size: 40px;
text-shadow: none;
font-weight: 400;
text-align: left;
margin-left: 15px;
padding-top: 80px;
}
.title-slide > h2 {
margin-top: -25px;
padding-bottom: -20px;
color: #1A292C;
text-shadow: none;
font-weight: 300;
font-size: 35px;
text-align: left;
margin-left: 15px;
}
.title-slide > h3 {
color: #1A292C;
text-shadow: none;
font-weight: 300;
font-size: 25px;
text-align: left;
margin-left: 15px;
margin-bottom: -30px;
}

.remark-slide-number {
font-size: 13pt;
font-family: 'Fira Sans';
color: #272822;
opacity: 1;
}
.inverse .remark-slide-number {
font-size: 13pt;
font-family: 'Fira Sans';
color: #FAFAFA;
opacity: 1;
}

/* turns off slide numbers for title page: https://github.com/gnab/remark/issues/298 */
.title-slide .remark-slide-number {
display: none;
}

Loading

0 comments on commit 22c2db4

Please sign in to comment.