Customise Beamer templates for RMarkdown - r

I'm writing a beamer presentation using RMarkdown. I have selected a template from this website. I really love the functionality of the template, however, I'd like to change the base colour closer to something matching my college. Is it possible to edit the yaml or style file somehow to do this?
I have the following yaml information for my Rmd file.
---
title: "My title"
author: "My name"
date: "06/03/2020"
output:
beamer_presentation:
slide_level: 2
toc: true
theme: "Berkeley"
colortheme: "seagull"
fonttheme: "structurebold"
---
I'd like to make changes to the colour theme "seagull", which I assume must be included in RMarkdown files structure somewhere. Or can this be change using a style sheet?
Thanks

If you remove the seagull color theme, you can simply change most colours with \setbeamercolor{structure}{fg=yourcolourname}
---
title: "My title"
author: "My name"
date: "06/03/2020"
output:
beamer_presentation:
slide_level: 2
toc: true
theme: "Berkeley"
fonttheme: "structurebold"
keep_tex: true
header-includes:
- \definecolor{yourcolourname}{rgb}{1,0.5,0}
- \setbeamercolor{structure}{fg=yourcolourname}
---
test
https://rstudio.cloud/project/1016900

Related

Bookdown: Produce only PDF, no HTML

I have a large bookdown project. My YAML header below.
My only desired output is a PDF. However, bookdown by default produces a HTML as well. This makes compilation take more time, and also uses more caching space on my disk. Any chance I can disable producing HTML output? I have tried to play around with the site parameter in the YAML heading, but no luck.
title: "Title"
subtitle: "Subtitle"
author:
- "Name"
- "Institution"
date: "September 2020"
output:
bookdown::pdf_book:
toc: false
includes:
in_header: preamble.tex
keep_tex: yes
latex_engine: xelatex
citation_package: natbib
fontsize: 12pt
linestretch: 1.5
site: bookdown::bookdown_site
documentclass: book
bibliography: [references.bib]
biblio-style: "apalike"
geometry: "left=2.5cm, right=2.5cm, top=2.5cm, bottom=2.5cm"
bookdown doesn't really have a "default" output format. If it produces HTML, the output format must have been provided somewhere. Check if you have a _output.yml under the root directory of your book project. If you do, you may delete it. Then bookdown will use the output field that you specified in the YAML frontmatter of your Rmd document.

How to set position of list of figure (lof) in R bookdown YAML

I have a R bookdown whose YAML looks like this:
---
title: "My title"
toc: False
lof: True
author: "the author"
output:
bookdown::pdf_document2:
keep_tex: yes
---
By default it generates a pdf file with the list of figures at the beginning just after the title.
Is there a way to have this list at the end, after the references?
Remove lof: True and add \listoffigures after your references.

How to reference sections in rmarkdown with pdf output

How do I use \label and \ref to link sections in rmarkdown when outputting to pdf please. I have tried various permutations from https://bookdown.org/yihui/bookdown/cross-references.html and https://bookdown.org/yihui/rmarkdown-cookbook/cross-ref.html with no success.
One attempt
---
title: "Untitled"
output: pdf_document
---
See Section \#ref(sec:label).
# Section One (\#sec:label)
which gives
You can modify your document as follows:
---
title: "Untitled 1"
date: "28 de junio de 2020"
link-citations: yes
output:
pdf_document:
includes:
keep_tex: yes
number_sections: yes
toc_depth: 2
---
\section{This is the first section} \label{section1}
You will be some in \ref{section1}
Then you can see how numbers appear, just add \label{} to your sections and use \ref{} to call. Also, I suggest using \section{}, and modify YAML as I included. Hoping this can help.

How to make R Markdown links with boxes like LaTeX documents?

First, I have a .Rmd file using knitr to generate a pdf, it only contains a link:
---
title: "My Title"
author: "my name"
date: "2020/2/6"
output: pdf_document
linkcolor: blue
urlcolor: blue
citecolor: blue
---
[Stack Overflow](https://stackoverflow.com/)
and output is :
How can I change its pattern to default LaTeX style like:
Whatever it is a link, url or a cite, how to change it to LaTeX style with red or green boxes above?
Thanks!
Normally these boxes are shown by default. Unfortunately rmarkdown disables them, but you can undo the the changes made by rmarkdown:
---
title: "My Title"
author: "my name"
date: "2020/2/6"
output:
pdf_document:
keep_tex: true
header-includes:
- \hypersetup{colorlinks = false,pdfborder={1 1 1}}
---
[Stack Overflow](https://stackoverflow.com/)

YAML front matter in R markdown version 2: add an institution and logo

Is it possible to add an institution and logo to the YAML front matter in R markdown version 2?
I'm looking for something like this
---
title: "My report"
author: "me"
institution: "Swansea University"
logo: "logo.png"
output:
pdf_document:
toc: yes
---
The answer is to use a template file, but it needs a bit of tweaking for the logo bit:
---
title: "My report"
author: "me"
output:
pdf_document:
toc: yes
includes:
in_header: style.tex
---
Prepare the document "style.tex" in the same folder as your markdown file and make sure you have changed you working directory in R to this folder.
Add the following lines to your "style.tex" file:
\institute{My institute}
\pgfdeclareimage[width=2cm]{logo}{logo.png}
\usebackgroundtemplate{\pgfuseimage{logo}}
Thanks to:
Inserting logo into beamer presentation using R Markdown

Resources