How to add page numbers on rmarkdown beamer slide under theme: "boxes"? - r

Using rmarkdown beamer, I try to add slide number at the bottom of each slide but keep failing. Is there anyway I can add slide number on each page under beamer theme called "boxes"?
---
title: "Big Business"
author: |
| Mr. Bean
| Sunny College
output:
beamer_presentation:
theme: "boxes"
citation_package: natbib
biblio-style: apalike
incremental: TRUE
header-includes:
- \usepackage{makecell}
- \usepackage{booktabs}
- \usepackage{adjustbox}
---
# Motivation
Big business
# Motivation 2
Small business

The boxes theme has a special syntax to add things to the footline:
\addfootbox{normal text}{\hfill\insertframenumber\quad}
(replace <normal text> with any other beamer colour you like)
MWE:
---
title: "Big Business"
author: |
| Mr. Bean
| Sunny College
output:
beamer_presentation:
theme: "boxes"
citation_package: natbib
biblio-style: apalike
incremental: TRUE
header-includes:
- \usepackage{makecell}
- \usepackage{booktabs}
- \usepackage{adjustbox}
- \addfootbox{normal text}{\hfill\insertframenumber\quad}
---
# Motivation
Big business
# Motivation 2
Small business

Related

Coloring paragraph section headers

I am trying to color my paragraph section headers but the is not working. Could someone point out why this is not coloring my sections? Consider the example below:
---
title: "number_sections"
output:
pdf_document:
number_sections: yes
toc_depth: 4
toc: true
header-includes:
-\usepackage{color}
- \usepackage{sectsty}
- \allsectionsfont{\color{red}}
---
# Main Section
The above section and the ones below should be red
## 2nd Level
### 3rd Level
# Second Section
## another section
### yet another
#### and the last one please
Your code is pretty much correct, it's just the indentation in the YAML header that's slightly off:
---
title: "number_sections"
output:
pdf_document:
number_sections: yes
toc_depth: 4
toc: true
header-includes:
- \usepackage{color}
- \usepackage{sectsty}
- \allsectionsfont{\color{red}}
---
header-includes should be at the left (not indented), and a missing space before \usepackage

strange symbols generated from rmarkdown when I use Chinese characters in ggplot2

Recently, I encounter a problem in Rmarkdown.
When I add Chinese characters into xlab() and ylab() in ggplot2. The pdf document generated by rmd will display strange ...... symbol. However, I try to search useful something and the result told me I should add dev: cairo_pdf. Ok, after I add the code to YAML, the new error strange symbols occur again. It displays another strange symbols of □□□.
I want to ask for help from someone who may pay attention to my quesiton. Could you help me? Thank you very much. And here my test code:
---
title: "test.Rmd"
author: "author"
documentclass: ctexart
output:
rticles::ctex:
fig_caption: yes
number_sections: yes
toc: no
dev: cairo_pdf
word_document: default
keywords:
header-includes: \usepackage{booktabs} \usepackage{longtable} \usepackage{array} \usepackage{multirow}
\usepackage{wrapfig} \usepackage{float} \floatplacement{figure}{H}
---
library(ggplot2)
ggplot(cars,aes(speed,dist)) +
geom_line()+xlab("速度\nSpeed") + ylab("距离\nDist")
Sorry, I cannot replicate your images. I just altered the header-includes and included the figure in a code chunk. Did you install xelatex and TeX Live?
Here is the code that worked fine for me:
---
title: "test.Rmd"
author: "author"
documentclass: ctexart
output:
rticles::ctex:
fig_caption: yes
number_sections: yes
toc: no
dev: cairo_pdf
word_document: default
header-includes:
- \usepackage{booktabs}
- \usepackage{longtable}
- \usepackage{array}
- \usepackage{multirow}
- \usepackage{wrapfig}
- \usepackage{float}
- \floatplacement{figure}{H}
---
```{r}
library(ggplot2)
ggplot(cars,aes(speed,dist)) +
geom_line()+xlab("速度\nSpeed") + ylab("距离\nDist")
```
-output

R Markdown - remove left-sided header in pdf output

I am trying to create an automated report in rmarkdown for business partners and I am a bit stuck on how to set up the headers using the Latex package fancyhdr.
The report includes a table of contents set to level 1 headers, but there are sub-sections in the report that are created using level 2 headers.
When I generate the PDF the fancy header has the level 1 header on the right header (which is fine), the message I set in the central header (also fine), and the sub-section (level 2 header) in the left header.
I would like to remove this, but the documentation is very vague as to how to do so - I've just spent a considerable amount of fruitless time trying to get this to work.
Here are the YAML settings at the top of the R Markdown document:
title: "Report Title"
author: "Authors"
date: 'Date'
output:
pdf_document:
latex_engine: xelatex
toc: true
toc_depth: 1
header-includes:
- \usepackage{fontspec}
- \setmainfont{Gotham Book}
- \usepackage{booktabs}
- \usepackage[tocflat]{tocstyle}
- \usetocstyle{standard}
- \usepackage{fancyhdr}
- \pagestyle{fancy}
- \fancyhead[CO,CE]{Center Message}
- \fancyfoot[CO,CE]{Footer Message}
- \fancyfoot[LE,RO]{\thepage}
---
These are the "left-odd" and "right-even" headers. If you set them to nothing using \fancyhead[LO,RE]{} they will go away:
---
title: "Report Title"
author: "Authors"
date: 'Date'
output:
pdf_document:
latex_engine: xelatex
toc: true
toc_depth: 1
header-includes:
- \usepackage{fontspec}
- \usepackage{booktabs}
- \usepackage[tocflat]{tocstyle}
- \usetocstyle{standard}
- \usepackage{fancyhdr}
- \pagestyle{fancy}
- \fancyhead[CO,CE]{Center Message}
- \fancyfoot[CO,CE]{Footer Message}
- \fancyfoot[LE,RO]{\thepage}
- \fancyhead[LO,RE]{}
- \usepackage{blindtext}
---
\blinddocument
(I have removed your font and inserted some sample text to show the effect.)

Is it possible to define a letterhead header in Rmarkdown?

R gurus,
I am struggling to design a letterhead template in Rmarkdown for a massive mail merge project.
What I ideally need is something like following:
Question is if the header can be defined in YAML? The code might look something like following:
---
output:
pdf_document:
fig_caption: false
logo: logo.png
institute: UNIVERSITY OF CALIFORNIA
name: Prof. Jones
address: Mathematics Search Committee
Department of Mathematics
University of California
Berkeley, California 12345
email: pj#uc.ac
latex_engine: pdflatex
fontfamily: mathpazo
fontsize: 11pt
# spacing: double
endnote: no
---
---
title: "Prof. Jones \nDepartment \nUniversity \nState \nEmail"
output: pdf_document
editor_options:
chunk_output_type: console
header-includes:
- \usepackage{titling}
- \usepackage{graphicx}
- \usepackage{fancyhdr}
- \pagestyle{fancy}
- \pretitle{\begin{flushright}\LARGE\includegraphics[width=8cm]{logo.jpg}\\[\bigskipamount]}
- \posttitle{\end{flushright}}
---
Add your logo to where it has {logo.jpg} and the width might need altering as well.
Bit of a workaround using double space and \n to add a line break to the heading to create the address.
flushright right aligns the logo and title then.

part of square root latex equation dissappears in pdf rendering from RStudio's rmarkdown

When I use this code to make a square root in my pdf document (rendered by rmarkdown):
---
title: "Test"
author: "test test"
geometry: margin=1in
output:
pdf_document:
keep_tex: yes
latex_engine: xelatex
number_sections: yes
toc: yes
toc_depth: 3
html_document:
css: tables.css
number_sections: yes
theme: cerulean
toc: yes
toc_depth: 3
header-includes:
- \usepackage[dutch]{babel}
- \usepackage{fancyhdr}
- \pagestyle{fancy}
- \fancyfoot[LE,RO]{this is a fancy foot}
- \usepackage{dcolumn}
- \usepackage{here}
- \usepackage{longtable}
- \usepackage{caption}
- \captionsetup{skip=2pt,labelsep=space,justification=justified,singlelinecheck=off}
subtitle: test test test
fontsize: 12pt
---
$$ S_E\text{=}S_x\sqrt{\text{(}\text{1}\text{-}r_{xx}\text{)}} $$
this is the result:
Notice the strange looking square root. Does anyone know what's going wrong here in my code?
I found the solution to this problem here:
https://tex.stackexchange.com/questions/210153/pdftex-font-expansion-error-during-compilation
In the directory C:\Program Files\MiKTeX 2.9\miktex\bin\x64 I ran updmap.exe. After that the problem was solved.

Resources