Skip to content

Commit

Permalink
Add Rmd template for PDF report
Browse files Browse the repository at this point in the history
  • Loading branch information
milanmlft committed Jun 9, 2021
1 parent 2d91317 commit 4584e45
Show file tree
Hide file tree
Showing 5 changed files with 87 additions and 1 deletion.
3 changes: 2 additions & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,5 @@ Suggests:
covr,
tibble,
xaringan,
xaringanthemer
xaringanthemer,
bookdown
1 change: 1 addition & 0 deletions inst/rmarkdown/templates/latex-report-template/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.pdf
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
\usepackage{geometry}
\usepackage{fontspec}
\usepackage{fancyhdr}
\usepackage{amsmath}
\usepackage{graphicx}
\usepackage{booktabs} % For prettier tables
\usepackage{hyperref}
\hypersetup{
colorlinks=true,
linkcolor=black,
urlcolor=blue
}
\urlstyle{same}

\setmainfont{Times New Roman}

% set page format
\geometry{a4paper, bmargin=20mm, tmargin=20mm}

% disable section numbering
\setcounter{secnumdepth}{0}

% paragraph formatting
\setlength{\parindent}{0pt} % no indentation of paragraph
\setlength{\parskip}{6pt} % add blank space before paragraph

% format page numbering and header and footer space
\pagestyle{fancy}
\fancyhf{}
\rhead{Milan Malfait}
\lhead{Left header}
\rfoot{\thepage}
\setlength{\headheight}{15pt}

% ------------------------------ End of preamble ------------------------------
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
---
title: "Title"
subtitle: "Subtitle"
author: "Milan Malfait"
date: '`r format(Sys.Date(), "%B %d, %Y")`'
output:
bookdown::pdf_document2:
toc: false
keep_tex: false
latex_engine: xelatex
includes:
in_header: "preamble.tex"
documentclass: report
fontsize: 12pt
editor_options:
markdown:
wrap: 100
---

```{r setup, include=FALSE, cache=FALSE}
knitr::opts_chunk$set(
echo = FALSE,
fig.width = 8,
fig.asp = 0.618
)
```

## R Markdown

This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see <http://rmarkdown.rstudio.com>.

When you click the **Knit** button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:

```{r cars}
summary(cars)
```

## Including Plots

You can also embed plots, for example:

```{r pressure, echo=FALSE}
plot(pressure)
```

Note that the `echo = FALSE` parameter was added to the code chunk to prevent printing of the R code that generated the plot.
3 changes: 3 additions & 0 deletions inst/rmarkdown/templates/latex-report-template/template.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
name: LaTeX report template
description: My template to create LaTeX PDF reports
create_dir: FALSE

0 comments on commit 4584e45

Please sign in to comment.