• Stars
    star
    124
  • Rank 288,302 (Top 6 %)
  • Language
    TeX
  • License
    Other
  • Created over 4 years ago
  • Updated over 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

My lecture notes Rmd template

An R Markdown template for writing lecture notes and academic papers

Motivation

lecturenotes is a personalised .Rmd template that I use for writing my lecture notes and academic papers. It is intended for documents that are going to be exported (i.e. “knitted”) to both HTML and PDF formats. In so doing, it tries to take care of various annoyances and inconsistencies that arise between these two formats. For example:

  • Recognizing the author “affiliation” field in PDF documents.
  • Support for consistent multi-column environments in both HTML and PDF.
  • Consistent regression table output (e.g. threeparttables).
  • Support for non-standard fonts when knitting to PDF.
  • Sensible handling of interactive content depending on the output format.
  • Etc.

You can view samples of the resulting output here:

  1. HTML

  2. PDF

Installation and use

I don’t foresee submitting this bespoke package to CRAN. However, you can easily install it from GitHub:

# install.packages("remotes")
remotes::install_github("grantmcdermott/lecturenotes")

Note that I use several external packages in the template to demonstrate functionality. See the “Suggests” list at the bottom of the DESCRIPTION file. If you want to have these installed automatically, then you can simply amend the above installation command to:

# install.packages("remotes")
remotes::install_github("grantmcdermott/lecturenotes", dependencies = TRUE)

Once the package is installed, open up the lecturenotes template in RStudio by navigating to:

File > New File > R Markdown > From Template > Lecture Notes (lecturenotes)

(You can also select a “lean” template version that just provides the scaffolding without any explanatory text or examples.)

Clicking on the “Knit” button in RStudio will automatically output to both HTML and PDF.

Limitations

This R Markdown template was mostly designed for my own use. As such, it comes with no guarantees; although, please do let me know if you run into problems. Some potential limitations and requirements perhaps worth highlighting:

  • The PDF output has only been tested on a TexLive distribution using XeLaTeX. I cannot guarantee that other LaTeX distributions or engines will work without some tinkering.
  • Similarly, I have adopted some opinionated takes on optimal LaTeX fonts. I use Cochineal as the main font and Fira for the sans and mono fonts. You may need to change or comment out these lines of the template, depending on your own system and/or preferences.
  • The template generally does a good job of automatically handling interactive content depending on the output format. For example, it tries to ignore interactive content when exporting to PDF. One notable exception is rendering of GIFs. I provide an example of how to handle this manually in the template itself.

Acknowledgements

This template essentially pulls together a bunch of tips, tricks, and ideas that I’ve accumulated over time to fit my own idiosyncratic writing and formatting needs. Some of these I stumbled upon on myself, most of them I found the old-fashioned way (i.e. searching on the Internet). Here is a non-exhaustive list of helpful sources that I’ve drawn upon.

License

The material in this repository is made available under the MIT license.

More Repositories

1

quarto-revealjs-clean

A minimalist and elegant presentation theme for Quarto Reveal.js
SCSS
235
star
2

tinyplot

Lightweight extension of the base R graphics system
R
234
star
3

parttree

R package for plotting simple decision tree partitions
R
92
star
4

etwfe

Extended two-way fixed effects
R
50
star
5

ggfixest

Dedicated ggplot2 methods for fixest model objects
R
43
star
6

rstudio-compute-engine

RStudio Server on Google Compute Engine
33
star
7

R-intro

Introduction to R
HTML
33
star
8

renv-rspm

Testing renv and RStudio Package Manager
R
31
star
9

ds4e

Data Science for Economists and Other Animals
R
29
star
10

arch-tips

Customization log for my Arch setup
20
star
11

skeptic-priors

Code and data for "Skeptic priors and climate consensus" (McDermott, 2021)
TeX
19
star
12

duckdb-polars

Introduction to DuckDB and Polars
JavaScript
17
star
13

codespaces-r2u

Minimal(ish) R codespaces environment
R
16
star
14

two-col-test

Trying sectioned two column format for both PDF and HTML output
HTML
15
star
15

tikzexamples

Some TikZ and PGFPlots examples
TeX
13
star
16

quarto-revealjs-clean-demo

Demo slides for the clean Quarto revealjs theme
HTML
11
star
17

example

HTML
11
star
18

grantmcdermott.github.io

Repo used for my website.
HTML
9
star
19

ritest

Randomization Inference on R model objects
R
8
star
20

covote2020

Comparing the (county-level) 2020 US election results with COVID-19 outcomes
8
star
21

ec510

Course material for Big Data in Economics (EC 510)
TeX
7
star
22

bycatch

Data and R code for reproducing "Protecting marine mammals, turtles, and birds by rebuilding global fisheries".
R
6
star
23

blueparadox

Code and data for "The blue paradox: Preemptive overfishing in marine reserves" (McDermott, Meng, et al., 2018; PNAS)
Stata
6
star
24

lfe2fixest

Convert lfe scripts to their fixest equivalents.
R
5
star
25

sfg-bayes-intro

A very high-level introduction to Bayesian data analysis (using R)
HTML
4
star
26

covgit

Analysis of COVID-19's effect on GitHub activity
R
3
star
27

containerit-demo

Simple demo that builds a Docker image from a repo's contents using the containerit package
R
3
star
28

assa2020

Presentation at the ASSA 2020 meetings
HTML
2
star
29

dotfiles

Dotfiles, configs, etc.
Lua
2
star
30

hydro-slides

Slides for "Hydro power. Market might."
HTML
1
star
31

SAIL

CSS
1
star
32

grantmcdermott.r-universe.dev

R-universe subdomain
1
star
33

tree2020

Presentation at TREE
HTML
1
star
34

testpkg

Experimental repo for offloading an R package's test suite to a Git submodule
R
1
star
35

vita

My CV
TeX
1
star
36

presentations

Repo containing my public presentations
HTML
1
star