Skip to content

Instantly share code, notes, and snippets.

@embruna
Created April 17, 2023 18:57
Show Gist options
  • Save embruna/dae2ff1f1c4b56ab0193fd29d22ba8af to your computer and use it in GitHub Desktop.
Save embruna/dae2ff1f1c4b56ab0193fd29d22ba8af to your computer and use it in GitHub Desktop.
Some TAML extensions for rendering Rmd to PDF
---
title: "title text"
date: "updated: `r Sys.Date()`" # using `r Sys.Date()` updates the exact date that you save as the update
header-includes:
- \usepackage[default]{sourcesanspro} # font choice: https://tug.org/FontCatalogue/sourcesanspro/
- \AtBeginDocument{\let\maketitle\relax} # this removes default title section
- \usepackage{fancyhdr} # modify header into left, center, right
- \pagestyle{fancy} # cues the use of fancy header
# to modify the Left Header [L]:
- \fancyhead[L]{LAS 6292 Spring `r format(Sys.time(), '%Y')`, EM Bruna}
# to modify the Right Header [R]:
- \fancyhead[R]{Efficient Data Collection, p. \thepage}
- \fancyfoot{} # cues the use of fancy footer
# to modify the Right Footer [R]:
- \fancyfoot[R]{Last update `r format(Sys.time(), '%d %B %Y')`}
# - \usepackage{setspace}{singlespace} # manipulate line spacing
- \usepackage{parskip} # manipulate indents and spacing before/after paragra phs
- \usepackage{xcolor} # changes colors of text
# http://latexcolor.com/ to choose colors
# define the colors used above with rgb codes
- \definecolor{darkcerulean}{rgb}{0.03, 0.27, 0.49}
- \definecolor{darkmidnightblue}{rgb}{0.0, 0.2, 0.4}
# to center to top level (#) headings (my name) and change color of font
# more info # https://www.ctan.org/pkg/sectsty
- \usepackage{sectsty} \sectionfont{\centering\color{darkmidnightblue}}
# to center to sub-sub-headings (###) and change color of font
- \usepackage{sectsty} \subsectionfont{\color{darkmidnightblue}}
# For ragged margins
# - \usepackage{ragged2e}
# - \setlength\RaggedRightParindent{15pt} # sets the paragraph indent
# - \RaggedRight - # make the right margin ragged
# https://tex.stackexchange.com/questions/258714/prevent-hyphenation-across-lines-enforce-right-margin
# - \hyphenpenalty=10000 #to suppress ordinary hyphenation
# - \exhyphenpenalty=10000 #to prohibit line breaks at explicit hyphens.
# - \setstretch{1.0} # line spacing
# https://babichmorrowc.github.io/post/changing-fonts-in-rmarkdown-pdfs/
mainfont: SourceSansPro
geometry: margin=1in
fontsize: 12pt
linkcolor: blue
urlcolor: blue
output: pdf_document
---
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment