@ -0,0 +1,13 @@ |
|||||
|
#' ipsum R markdown template for PDF output |
||||
|
#' |
||||
|
#' Template for creating an R markdown documents with an emphasis on typography |
||||
|
#' |
||||
|
#' @inheritParams rmarkdown::pdf_document |
||||
|
#' @param ... Arguments to \code{rmarkdown::pdf_document} |
||||
|
#' |
||||
|
#' @return R Markdown output format to pass to \code{\link[rmarkdown:render]{render}} |
||||
|
#' |
||||
|
#' @export |
||||
|
ipsum_pdf <- function(...) { |
||||
|
rmarkdown::pdf_document(...) |
||||
|
} |
Before Width: | Height: | Size: 132 KiB After Width: | Height: | Size: 132 KiB |
Before Width: | Height: | Size: 94 KiB After Width: | Height: | Size: 94 KiB |
Before Width: | Height: | Size: 63 KiB After Width: | Height: | Size: 63 KiB |
Before Width: | Height: | Size: 80 KiB After Width: | Height: | Size: 80 KiB |
Before Width: | Height: | Size: 76 KiB After Width: | Height: | Size: 76 KiB |
Before Width: | Height: | Size: 214 KiB After Width: | Height: | Size: 214 KiB |
Before Width: | Height: | Size: 85 KiB After Width: | Height: | Size: 85 KiB |
Before Width: | Height: | Size: 82 KiB After Width: | Height: | Size: 82 KiB |
@ -0,0 +1,48 @@ |
|||||
|
--- |
||||
|
title: "Using hrbrthemes in PDFs" |
||||
|
output: hrbrthemes::ipsum_pdf |
||||
|
--- |
||||
|
|
||||
|
```{r setup, include=FALSE} |
||||
|
knitr::opts_chunk$set(echo = TRUE, dev = "cairo_pdf") |
||||
|
``` |
||||
|
|
||||
|
# Purpose |
||||
|
|
||||
|
The purpose of this template is to show what you need to do in order to use |
||||
|
Arial Narrow or Roboto Condensed in PDF output documents. |
||||
|
|
||||
|
The main consideration is the use of `Cairo` and --- specifically -- the `cairo_pdf` |
||||
|
output device. It is best to set that in the `knit` chunk defaults (as seen in |
||||
|
the `setup` block) but you can also do that in the individual chunks as has also been |
||||
|
demonstrated in the "Roboto Condensed" chunk. |
||||
|
|
||||
|
Make sure to include the library calls as they are here. |
||||
|
|
||||
|
```{r message = FALSE} |
||||
|
library(hrbrthemes) |
||||
|
library(ggplot2) |
||||
|
library(Cairo) |
||||
|
library(extrafont) |
||||
|
|
||||
|
extrafont::loadfonts() |
||||
|
``` |
||||
|
|
||||
|
### Arial Narrow |
||||
|
|
||||
|
```{r} |
||||
|
ggplot(mtcars, aes(wt, mpg)) + |
||||
|
geom_point() + |
||||
|
labs(title="Arial Narrow", subtitle="This is a subtitle") + |
||||
|
theme_ipsum() |
||||
|
``` |
||||
|
|
||||
|
|
||||
|
### Roboto Condensed |
||||
|
|
||||
|
```{r dev = "cairo_pdf"} |
||||
|
ggplot(mtcars, aes(wt, mpg)) + |
||||
|
geom_point() + |
||||
|
labs(title="Roboto Condensed", subtitle="This is a subtitle") + |
||||
|
theme_ipsum_rc() |
||||
|
``` |
@ -0,0 +1,4 @@ |
|||||
|
name: ipsum PDF Template |
||||
|
description: > |
||||
|
R Markdown template with an emphasis on typography, targeting PDF output |
||||
|
create_dir: false |
@ -0,0 +1,17 @@ |
|||||
|
% Generated by roxygen2: do not edit by hand |
||||
|
% Please edit documentation in R/ipsum-pdf.R |
||||
|
\name{ipsum_pdf} |
||||
|
\alias{ipsum_pdf} |
||||
|
\title{ipsum R markdown template for PDF output} |
||||
|
\usage{ |
||||
|
ipsum_pdf(...) |
||||
|
} |
||||
|
\arguments{ |
||||
|
\item{...}{Arguments to \code{rmarkdown::pdf_document}} |
||||
|
} |
||||
|
\value{ |
||||
|
R Markdown output format to pass to \code{\link[rmarkdown:render]{render}} |
||||
|
} |
||||
|
\description{ |
||||
|
Template for creating an R markdown documents with an emphasis on typography |
||||
|
} |