Set position of columns in Beamer (R markdown) - latex

I am creating a RMarkdown presentation using Szeged as beamer type. Does anyone know how to set the position of the columns so that there is less space between them? I have the following output:
the code:
---
title: |
| Text
author: |
| Name
| email
|
date: date
output:
beamer_presentation:
theme: Szeged
slide_level: 2
includes:
in_header: header.tex
keep_tex: true
linkcolor: false
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = FALSE)
```
# Workshop
## section
\footnotesize
:::::::::::::: {.columns}
::: {.column}
Text 1
- option 1
- option 1
- option 1
- option 1
:::
::: {.column}
Text 2
- option 1
- option 1
- option 1
- option 1
:::
::: {.column}
Text 3
- option 1
- option 1
- option 1
- option 1
:::
::::::::::::::
But I would the columns to have less space between them so that they are more central, otherwise the text does not fit. Any ideas?

You can set the width of the columns:
---
title: |
| Text
author: |
| Name
| email
|
date: date
output:
beamer_presentation:
theme: Szeged
slide_level: 2
includes:
in_header: header.tex
keep_tex: true
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = FALSE)
```
# Workshop
## section
\footnotesize
:::::::::::::: {.columns totalwidth=\textwidth}
::: {.column width="30%"}
Text 1
- option 1
- option 1
- option 1
- option 1
:::
::: {.column width="30%"}
Text 2
- option 1
- option 1
- option 1
- option 1
:::
::: {.column width="30%"}
Text 3
- option 1
- option 1
- option 1
- option 1
:::
::::::::::::::

Related

References do not show up after I run Biblatex in rmarkdown latex

My biblatex does not generate references section with the following error:
I have a difficulty finding the source of problem.
I am using TexShop and already refer to https://tex.stackexchange.com/questions/154751/biblatex-with-biber-configuring-my-editor-to-avoid-undefined-citations, but it is still not working. I am not sure if it is configuration problem in TexShop or coding issue somewhere else.
Warning message:
Package pgfplots Warning: running in backwards compatibility mode (unsuitable t
ick labels; missing features). Consider writing \pgfplotsset{compat=1.16} into
your preamble.
on input line 125.
LaTeX Warning: Citation 'ennis2019' on page 1 undefined on input line 129.
LaTeX Warning: Citation 'worldbank2017' on page 1 undefined on input line 129.
LaTeX Warning: Empty bibliography on input line 131.
LaTeX Warning: There were undefined references.
Package biblatex Warning: Please (re)run Biber on the file:
(biblatex) table.markup
(biblatex) and rerun LaTeX afterwards.
---
title: "Paper"
thanks:
author: |
| \normalfont Joe
output:
pdf_document:
keep_tex: true
number_sections: true
fig_caption: true
fig_height: 4.5
fig_width: 8
toc: false
in_header: preamble.tex
keep_tex: yes
fontsize: 11pt
linestretch: 1.3
subparagraph: true
number_sections: true
geometry: margin=1in
header-includes:
- \usepackage{amsmath}
- \usepackage{amsthm}
- \numberwithin{equation}{section}
- \usepackage{makecell}
- \usepackage{geometry}
- \usepackage{graphicx}
- \usepackage{tikz}
- \usepackage{verbatim}
- \usepackage{chronosys}
- \usepackage{stackengine}
- \usepackage{booktabs, colortbl, xcolor}
- \usepackage[english]{babel}
- \usetikzlibrary{arrows.meta,calc}
- \usepackage[font=small]{caption}
- \usepackage{adjustbox}
- \usepackage{tabularx}
- \usepackage{pgfplots}
- \usepackage[makeroom]{cancel}
- \usetikzlibrary{arrows,decorations.markings}
- \usetikzlibrary{intersections}
- \usepackage[nottoc]{tocbibind}
- \usepackage{filecontents}
- \newtheorem{prop}{Proposition}
- \newtheorem{definition}{Definition}
- \newtheorem{algorithem}{Algorithm}
- \usepackage[T1]{fontenc}
- \usepackage[toc,page]{appendix}
- \usepackage{tabularx,ragged2e,booktabs,caption}
- \newenvironment{rcases}
{\left.\begin{aligned}}
{\end{aligned}\right\rbrace}
- \renewcommand{\refname}{References}
- \UseRawInputEncoding
- \usepackage[utf8]{inputenc}
- \usepackage{hyperref}
- \hypersetup{
colorlinks=true,
linkcolor=black,
filecolor=blue,
citecolor = blue,
urlcolor=blue,
}
- \usepackage{subcaption}
- \usepackage[font=small,labelfont=bf]{caption}
- \usepackage{float}
- \usepackage{flafter}
- \floatstyle{plaintop}
- \restylefloat{table}
- \setlength{\parindent}{2em}
- \setlength{\parskip}{0em}
- \usepackage{adjustbox}
- \usepackage[style=english]{csquotes}
- \usepackage[nameinlink,capitalize,noabbrev]{cleveref}
- \creflabelformat{equation}{#2\textup{(\textcolor{red}{#1})}#3}
- \creflabelformat{figure}{#2\textcolor{red}{#1}#3}
- \creflabelformat{table}{#2\textcolor{red}{#1}#3}
- \creflabelformat{section}{#2\textcolor{red}{#1}#3}
- \usepackage{dcolumn}
- \usepackage{rotating}
- \usepackage{siunitx}
- \usepackage[natbib, style=authoryear]{biblatex}
- \addbibresource{Users/references022.bib}
---
blah blah \cite{ennis2019} \cite{worldbank2017}
\printbibliography
#article{ennis2019,
author = {Ennis, Sean F and Gonzaga, Pedro and Pike, Chris},
title = "{Inequality: A hidden cost of market power}",
journal = {Oxford Review of Economic Policy},
volume = {35},
number = {3},
pages = {518-549},
year = {2019},
month = {07},
issn = {0266-903X},
doi = {10.1093/oxrep/grz017},
url = {https://doi.org/10.1093/oxrep/grz017},
eprint = {https://academic.oup.com/oxrep/article-pdf/35/3/518/28929084/grz017.pdf},
}
#book{worldbank2017,
author = "World Bank",
title = "A Step Ahead: Competition Policy for Shared Prosperity and Inclusive Growth",
year = "2017",
pages = 245,
url = "https://www.oecd-ilibrary.org/content/publication/978-1-4648-0945-3",
doi = "https://doi.org/https://doi.org/10.1596/978-1-4648-0945-3"
}
My output is:

How to put references before appendix in rmarkdown with natbib citation package?

I want to insert references section before appendix section in my rmarkdown latex document. I tried to change my citation package from natbib to biblatex, but it looks too complicated for me and requires me to go through lots of modification. I was wondering if there could be a way to do so without changing too much on the current YAML header. Or is there any alternative ways to do so?
---
title: "Paper"
thanks:
author: |
| \normalfont Joe
output:
pdf_document:
number_sections: true
citation_package: natbib
fig_caption: true
fig_height: 4.5
fig_width: 8
link-citations: yes
toc: false
bibliography: /Users/references02.bib
biblio-style: apalike
in_header: preamble.tex
keep_tex: yes
fontsize: 11pt
linestretch: 1.3
subparagraph: true
number_sections: true
geometry: margin=1in
header-includes:
- \usepackage{amsmath}
- \usepackage{amsthm}
- \numberwithin{equation}{section}
- \usepackage{makecell}
- \usepackage{geometry}
- \usepackage{graphicx}
- \usepackage{tikz}
- \usepackage{verbatim}
- \usepackage{chronosys}
- \usepackage{stackengine}
- \usepackage{booktabs, colortbl, xcolor}
- \usepackage{babel}
- \usetikzlibrary{arrows.meta,calc}
- \usepackage[font=small]{caption}
- \usepackage{adjustbox}
- \usepackage{tabularx}
- \usepackage{pgfplots}
- \usepackage[makeroom]{cancel}
- \usetikzlibrary{arrows,decorations.markings}
- \usetikzlibrary{intersections}
- \usepackage[nottoc]{tocbibind}
- \usepackage{filecontents}
- \newtheorem{prop}{Proposition}
- \newtheorem{definition}{Definition}
- \newtheorem{algorithem}{Algorithm}
- \usepackage[T1]{fontenc}
- \usepackage[toc,page]{appendix}
- \usepackage{tabularx,ragged2e,booktabs,caption}
- \newenvironment{rcases}
{\left.\begin{aligned}}
{\end{aligned}\right\rbrace}
- \renewcommand{\refname}{References}
- \UseRawInputEncoding
- \usepackage[utf8]{inputenc}
- \usepackage{hyperref}
- \hypersetup{
colorlinks=true,
linkcolor=black,
filecolor=blue,
citecolor = blue,
urlcolor=blue,
}
- \usepackage{subcaption}
- \usepackage[font=small,labelfont=bf]{caption}
- \usepackage{float}
- \usepackage{flafter}
- \floatstyle{plaintop}
- \restylefloat{table}
- \setlength{\parindent}{2em}
- \setlength{\parskip}{0em}
- \usepackage{adjustbox}
- \usepackage[style=english]{csquotes}
- \usepackage[nameinlink,capitalize,noabbrev]{cleveref}
- \creflabelformat{equation}{#2\textup{(\textcolor{red}{#1})}#3}
- \creflabelformat{figure}{#2\textcolor{red}{#1}#3}
- \creflabelformat{table}{#2\textcolor{red}{#1}#3}
- \creflabelformat{section}{#2\textcolor{red}{#1}#3}
- \usepackage{dcolumn}
- \usepackage{rotating}
- \usepackage{siunitx}
---
blah blah \cite{ennis2019} \cite{worldbank2017}
\pagebreak
\begin{appendices}
blah blah
\cite{worldbank2017}
\end{appendices}
#article{ennis2019,
author = {Ennis, Sean F and Gonzaga, Pedro and Pike, Chris},
title = "{Inequality: A hidden cost of market power}",
journal = {Oxford Review of Economic Policy},
volume = {35},
number = {3},
pages = {518-549},
year = {2019},
month = {07},
abstract = "{This paper explores the impact of competition on inequality by developing a new model to illustrate how higher profits from market power, and associated higher prices, could influence the distribution of wealth and income. We analyse data from eight OECD countriesâCanada, France, Germany, Korea, Japan, Spain, the United Kingdom, and the United States. In an average country in the sample, market power increases the wealth of the richest 10 per cent by between 12 and 21 per cent for a range of reasonable assumptions about savings behaviour, while it reduces the income of the poorest 20 per cent by 11 per cent or more. The results contribute to the economic literature on the origins of inequality, suggesting that lack of competition may be one source of economic inequality.}",
issn = {0266-903X},
doi = {10.1093/oxrep/grz017},
url = {https://doi.org/10.1093/oxrep/grz017},
eprint = {https://academic.oup.com/oxrep/article-pdf/35/3/518/28929084/grz017.pdf},
}
#book{worldbank2017,
author = "World Bank",
title = "A Step Ahead: Competition Policy for Shared Prosperity and Inclusive Growth",
year = "2017",
pages = 245,
url = "https://www.oecd-ilibrary.org/content/publication/978-1-4648-0945-3",
doi = "https://doi.org/https://doi.org/10.1596/978-1-4648-0945-3"
}
You can use \AtEndDocument{} around your appendices to make sure they come at the very end:
---
title: "Paper"
thanks:
author: |
| \normalfont Joe
output:
pdf_document:
number_sections: true
citation_package: natbib
fig_caption: true
fig_height: 4.5
fig_width: 8
keep_tex: true
link-citations: yes
toc: false
bibliography: references02.bib
biblio-style: apalike
in_header: preamble.tex
keep_tex: yes
fontsize: 11pt
linestretch: 1.3
subparagraph: true
number_sections: true
geometry: margin=1in
header-includes:
- \usepackage{amsmath}
- \usepackage{amsthm}
- \numberwithin{equation}{section}
- \usepackage{makecell}
- \usepackage{geometry}
- \usepackage{graphicx}
- \usepackage{tikz}
- \usepackage{verbatim}
- \usepackage{chronosys}
- \usepackage{stackengine}
- \usepackage{booktabs, colortbl, xcolor}
- \usepackage{babel}
- \usetikzlibrary{arrows.meta,calc}
- \usepackage[font=small]{caption}
- \usepackage{adjustbox}
- \usepackage{tabularx}
- \usepackage{pgfplots}
- \usepackage[makeroom]{cancel}
- \usetikzlibrary{arrows,decorations.markings}
- \usetikzlibrary{intersections}
- \usepackage[nottoc]{tocbibind}
- \usepackage{filecontents}
- \newtheorem{prop}{Proposition}
- \newtheorem{definition}{Definition}
- \newtheorem{algorithem}{Algorithm}
- \usepackage[T1]{fontenc}
- \usepackage[toc,page]{appendix}
- \usepackage{tabularx,ragged2e,booktabs,caption}
- \newenvironment{rcases}
{\left.\begin{aligned}}
{\end{aligned}\right\rbrace}
- \renewcommand{\refname}{References}
- \UseRawInputEncoding
- \usepackage[utf8]{inputenc}
- \usepackage{hyperref}
- \hypersetup{
colorlinks=true,
linkcolor=black,
filecolor=blue,
citecolor = blue,
urlcolor=blue,
}
- \usepackage{subcaption}
- \usepackage[font=small,labelfont=bf]{caption}
- \usepackage{float}
- \usepackage{flafter}
- \floatstyle{plaintop}
- \restylefloat{table}
- \setlength{\parindent}{2em}
- \setlength{\parskip}{0em}
- \usepackage{adjustbox}
- \usepackage[style=english]{csquotes}
- \usepackage[nameinlink,capitalize,noabbrev]{cleveref}
- \creflabelformat{equation}{#2\textup{(\textcolor{red}{#1})}#3}
- \creflabelformat{figure}{#2\textcolor{red}{#1}#3}
- \creflabelformat{table}{#2\textcolor{red}{#1}#3}
- \creflabelformat{section}{#2\textcolor{red}{#1}#3}
- \usepackage{dcolumn}
- \usepackage{rotating}
- \usepackage{siunitx}
---
blah blah \cite{ennis2019} \cite{worldbank2017}
\AtEndDocument{\pagebreak
\begin{appendices}
blah blah
\cite{worldbank2017}
\end{appendices}}

With natbib citation package, how to make THREE authors appear on the citation in rmarkdown latex document

Instead of Jones et al., I want to make each author's name show up in my text citation until three with citation package natbib(from 4 authors it should be Jones et al.).
I tried citet*{} and citet{}, but they didn't work.
My rmarkdown code and .bib file are given as follows:
---
title: "Paper"
thanks:
author: |
| \normalfont Joe
output:
pdf_document:
number_sections: true
citation_package: natbib
fig_caption: true
fig_height: 4.5
fig_width: 8
link-citations: yes
toc: false
bibliography: /Users/references02.bib
biblio-style: apalike
in_header: preamble.tex
keep_tex: yes
fontsize: 11pt
linestretch: 1.3
subparagraph: true
number_sections: true
geometry: margin=1in
header-includes:
- \usepackage{amsmath}
- \usepackage{amsthm}
- \numberwithin{equation}{section}
- \usepackage{makecell}
- \usepackage{geometry}
- \usepackage{graphicx}
- \usepackage{tikz}
- \usepackage{verbatim}
- \usepackage{chronosys}
- \usepackage{stackengine}
- \usepackage{booktabs, colortbl, xcolor}
- \usepackage{babel}
- \usetikzlibrary{arrows.meta,calc}
- \usepackage[font=small]{caption}
- \usepackage{adjustbox}
- \usepackage{tabularx}
- \usepackage{pgfplots}
- \usepackage[makeroom]{cancel}
- \usetikzlibrary{arrows,decorations.markings}
- \usetikzlibrary{intersections}
- \usepackage[nottoc]{tocbibind}
- \usepackage{filecontents}
- \newtheorem{prop}{Proposition}
- \newtheorem{definition}{Definition}
- \newtheorem{algorithem}{Algorithm}
- \usepackage[T1]{fontenc}
- \usepackage[toc,page]{appendix}
- \usepackage{tabularx,ragged2e,booktabs,caption}
- \newenvironment{rcases}
{\left.\begin{aligned}}
{\end{aligned}\right\rbrace}
- \renewcommand{\refname}{References}
- \UseRawInputEncoding
- \usepackage[utf8]{inputenc}
- \usepackage{hyperref}
- \hypersetup{
colorlinks=true,
linkcolor=black,
filecolor=blue,
citecolor = blue,
urlcolor=blue,
}
- \usepackage{subcaption}
- \usepackage[font=small,labelfont=bf]{caption}
- \usepackage{float}
- \usepackage{flafter}
- \floatstyle{plaintop}
- \restylefloat{table}
- \setlength{\parindent}{2em}
- \setlength{\parskip}{0em}
- \usepackage{adjustbox}
- \usepackage[style=english]{csquotes}
- \usepackage[nameinlink,capitalize,noabbrev]{cleveref}
- \creflabelformat{equation}{#2\textup{(\textcolor{red}{#1})}#3}
- \creflabelformat{figure}{#2\textcolor{red}{#1}#3}
- \creflabelformat{table}{#2\textcolor{red}{#1}#3}
- \creflabelformat{section}{#2\textcolor{red}{#1}#3}
- \usepackage{dcolumn}
- \usepackage{rotating}
- \usepackage{siunitx}
---
blah blah \cite{ennis2019} \cite{worldbank2017}
#article{ennis2019,
author = {Ennis, Sean F and Gonzaga, Pedro and Pike, Chris},
title = "{Inequality: A hidden cost of market power}",
journal = {Oxford Review of Economic Policy},
volume = {35},
number = {3},
pages = {518-549},
year = {2019},
month = {07},
abstract = "{This paper explores the impact of competition on inequality by developing a new model to illustrate how higher profits from market power, and associated higher prices, could influence the distribution of wealth and income. We analyse data from eight OECD countriesâCanada, France, Germany, Korea, Japan, Spain, the United Kingdom, and the United States. In an average country in the sample, market power increases the wealth of the richest 10 per cent by between 12 and 21 per cent for a range of reasonable assumptions about savings behaviour, while it reduces the income of the poorest 20 per cent by 11 per cent or more. The results contribute to the economic literature on the origins of inequality, suggesting that lack of competition may be one source of economic inequality.}",
issn = {0266-903X},
doi = {10.1093/oxrep/grz017},
url = {https://doi.org/10.1093/oxrep/grz017},
eprint = {https://academic.oup.com/oxrep/article-pdf/35/3/518/28929084/grz017.pdf},
}
#book{worldbank2017,
author = "World Bank",
title = "A Step Ahead: Competition Policy for Shared Prosperity and Inclusive Growth",
year = "2017",
pages = 245,
url = "https://www.oecd-ilibrary.org/content/publication/978-1-4648-0945-3",
doi = "https://doi.org/https://doi.org/10.1596/978-1-4648-0945-3"
}
Use biblatex.
If your bibtex style does not happen to be exactly what you want, biblatex is much more flexible and easier to modify.
---
title: "Paper"
thanks:
author: |
| \normalfont Joe
output:
pdf_document:
keep_tex: true
number_sections: true
fig_caption: true
fig_height: 4.5
fig_width: 8
toc: false
in_header: preamble.tex
keep_tex: yes
fontsize: 11pt
linestretch: 1.3
subparagraph: true
number_sections: true
geometry: margin=1in
header-includes:
- \usepackage{amsmath}
- \usepackage{amsthm}
- \numberwithin{equation}{section}
- \usepackage{makecell}
- \usepackage{geometry}
- \usepackage{graphicx}
- \usepackage{tikz}
- \usepackage{verbatim}
- \usepackage{chronosys}
- \usepackage{stackengine}
- \usepackage{booktabs, colortbl, xcolor}
- \usepackage[english]{babel}
- \usetikzlibrary{arrows.meta,calc}
- \usepackage[font=small]{caption}
- \usepackage{adjustbox}
- \usepackage{tabularx}
- \usepackage{pgfplots}
- \usepackage[makeroom]{cancel}
- \usetikzlibrary{arrows,decorations.markings}
- \usetikzlibrary{intersections}
- \usepackage[nottoc]{tocbibind}
- \usepackage{filecontents}
- \newtheorem{prop}{Proposition}
- \newtheorem{definition}{Definition}
- \newtheorem{algorithem}{Algorithm}
- \usepackage[T1]{fontenc}
- \usepackage[toc,page]{appendix}
- \usepackage{tabularx,ragged2e,booktabs,caption}
- \newenvironment{rcases}
{\left.\begin{aligned}}
{\end{aligned}\right\rbrace}
- \renewcommand{\refname}{References}
- \UseRawInputEncoding
- \usepackage[utf8]{inputenc}
- \usepackage{hyperref}
- \hypersetup{
colorlinks=true,
linkcolor=black,
filecolor=blue,
citecolor = blue,
urlcolor=blue,
}
- \usepackage{subcaption}
- \usepackage[font=small,labelfont=bf]{caption}
- \usepackage{float}
- \usepackage{flafter}
- \floatstyle{plaintop}
- \restylefloat{table}
- \setlength{\parindent}{2em}
- \setlength{\parskip}{0em}
- \usepackage{adjustbox}
- \usepackage[style=english]{csquotes}
- \usepackage[nameinlink,capitalize,noabbrev]{cleveref}
- \creflabelformat{equation}{#2\textup{(\textcolor{red}{#1})}#3}
- \creflabelformat{figure}{#2\textcolor{red}{#1}#3}
- \creflabelformat{table}{#2\textcolor{red}{#1}#3}
- \creflabelformat{section}{#2\textcolor{red}{#1}#3}
- \usepackage{dcolumn}
- \usepackage{rotating}
- \usepackage{siunitx}
- \usepackage[natbib, style=authoryear]{biblatex}
- \addbibresource{bib.bib}
---
blah blah \cite{ennis2019} \cite{worldbank2017}
\printbibliography
And the bib file without illegal characters like â :
#article{ennis2019,
author = {Ennis, Sean F and Gonzaga, Pedro and Pike, Chris},
title = "{Inequality: A hidden cost of market power}",
journal = {Oxford Review of Economic Policy},
volume = {35},
number = {3},
pages = {518-549},
year = {2019},
month = {07},
abstract = "{This paper explores the impact of competition on inequality by developing a new model to illustrate how higher profits from market power, and associated higher prices, could influence the distribution of wealth and income. We analyse data from eight OECD countries Canada, France, Germany, Korea, Japan, Spain, the United Kingdom, and the United States. In an average country in the sample, market power increases the wealth of the richest 10 per cent by between 12 and 21 per cent for a range of reasonable assumptions about savings behaviour, while it reduces the income of the poorest 20 per cent by 11 per cent or more. The results contribute to the economic literature on the origins of inequality, suggesting that lack of competition may be one source of economic inequality.}",
issn = {0266-903X},
doi = {10.1093/oxrep/grz017},
url = {https://doi.org/10.1093/oxrep/grz017},
eprint = {https://academic.oup.com/oxrep/article-pdf/35/3/518/28929084/grz017.pdf},
}
#book{worldbank2017,
author = "World Bank",
title = "A Step Ahead: Competition Policy for Shared Prosperity and Inclusive Growth",
year = "2017",
pages = 245,
url = "https://www.oecd-ilibrary.org/content/publication/978-1-4648-0945-3",
doi = "https://doi.org/https://doi.org/10.1596/978-1-4648-0945-3"
}

Rmd: Add numbered TOC in Beamer slides with metropolis theme

I am creating a RMarkdown template of Beamer slides and use the metropolis theme as a basis.
Now, I want a numbered table of content, which I was able to implement by the toc.tex. But when I include it here
beamer_presentation:
includes:
in_header:
- toc.tex
the whole formatting of the slides disappears, which I do not want. How can I keep the formatting of the slides & get a numbered TOC
This is my (minimal working example):
slides.rmd:
---
title: "Title"
subtitle: "Subtitle"
author: "Simon"
institute: "RUB"
date: "September 22, 2021"
output:
beamer_presentation:
keep_md: true
keep_tex: no
latex_engine: xelatex
#theme: metropolis
includes:
in_header:
- toc.tex
slide_level: 2 # which header level should be printed as slides
incremental: no
header-includes:
- \usetheme[numbering=fraction]{metropolis}
- \definecolor{beaublue}{rgb}{0.74, 0.83, 0.9}
- \setbeamertemplate{frame footer}{\tiny{\textcolor{beaublue}{Conference 56. Jahrestagung der DGSMP, 2021}}}
- |
\makeatletter
\def\ps#titlepage{%
\setbeamertemplate{footline}{}
}
\addtobeamertemplate{title page}{\thispagestyle{titlepage}}{}
\makeatother
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = FALSE)
```
## Content
\tableofcontents[]
# Level I
Test
## Slide with Bullets
- Bullet 1
- Bullet 2
- Bullet 3
# Slide with R Output
```{r cars, echo = TRUE}
summary(cars)
```
toc.tex:
\setbeamertemplate{section in toc}[sections numbered]
\setbeamertemplate{subsection in toc}[subsections numbered]
You can add \include{toc} to your header-includes:
---
title: "Title"
subtitle: "Subtitle"
author: "Simon"
institute: "RUB"
date: "September 22, 2021"
output:
beamer_presentation:
keep_md: true
keep_tex: true
latex_engine: xelatex
#theme: metropolis
slide_level: 2 # which header level should be printed as slides
incremental: no
header-includes:
- \usetheme[numbering=fraction]{metropolis}
- \definecolor{beaublue}{rgb}{0.74, 0.83, 0.9}
- \setbeamertemplate{frame footer}{\tiny{\textcolor{beaublue}{Conference 56. Jahrestagung der DGSMP, 2021}}}
- |
\makeatletter
\def\ps#titlepage{%
\setbeamertemplate{footline}{}
}
\addtobeamertemplate{title page}{\thispagestyle{titlepage}}{}
\makeatother
\include{toc}
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = FALSE)
```
## Content
\tableofcontents[]
# Level I
Test
## Slide with Bullets
- Bullet 1
- Bullet 2
- Bullet 3
# Slide with R Output
```{r cars, echo = TRUE}
summary(cars)
```

How do you remove white space between title and table?

I tried asking this somewhere else as well, but I am having trouble removing the white space between the title of my table and the actual table. This doesn't happen when in my regular rmarkdown article, but when I knit to beamer for my presentation it produces these bizarre white spaces. Anyone know why?
mean.party.class <- dat3 %>%
group_by(party2, class2) %>%
filter (party2 !="Indep" & class != "IDK")%>%
summarise_at(vars(DL, DU, RL, RU, L, U, D, R), funs(mean(., na.rm=TRUE)))
knitr::kable(mean.party.class, col.names=c("Party ID", "Class", "DL", "DU", "RL", "RU", "L", "U", "D" , "R"), digits=2, caption = "Mean Trust Per Group (Party and Social Class Identity)", "latex", booktabs = T) %>%
kable_styling( full_width = F, position = "left", latex_options = "scale_down", bootstrap_options = c("striped", "hover")) %>% footnote(
general = c("1. D= Democrat, R=Republican, L=Lower Class, U = Upper Class; ", "2. Independents dropped")) %>% row_spec(0,bold=TRUE)
Here is an example
---
title: "Example"
author: "Its me"
date: "6/12/2020"
always_allow_html: true
header-includes:
- \usepackage{booktabs}
- \usepackage{longtable}
- \usepackage{tabu}
- \usepackage{threeparttable}
- \usepackage{adjustbox}
- \usepackage{caption} \captionsetup[table]{skip=0pt}
- \usepackage[font=small,skip=0pt]{caption}
- \usepackage{tikz}
- \usepackage{float}
- \usetikzlibrary{arrows,shapes,positioning}
output:
beamer_presentation:
theme: "Berkeley"
colortheme: "dolphin"
fonttheme: "structurebold"
slide_level: 2
#incremental: true
---
```{r}
setwd("~/Google Drive/UC Davis /R stuff")
```
```{r, include=FALSE}
library(rticles)
library(kableExtra)
library(knitr)
library(plyr)
library(dplyr)
library(gdata)
library(ggplot2)
library(MASS)
library(corrplot)
library(haven)
library(factoextra)
library(ggplot2)
library(ggrepel)
library(viridis)
library(lattice)
library(optiscale)
library(acepack)
library(psych)
library(smacof)
library(MCMCpack)
library(basicspace)
library(boot)
library(pscl)
library(wnominate)
library(RColorBrewer)
library(sjPlot)
```
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = FALSE)
```
```{r, include= FALSE}
#load cars
data("mtcars")
head(mtcars, 2)
```
```{r, include= FALSE}
mean.mpg <- mtcars %>%
summarise_at(vars(mpg), funs(mean(., na.rm=TRUE)))
```
## there it is
```{r}
knitr::kable(mean.mpg, col.names=c("mpg"), digits=2, caption = "This is a table", "latex", booktabs = T, escape=F) %>%
kable_styling(full_width = T, position = "left", latex_options = "scale_down", bootstrap_options = c("striped", "hover")) %>% footnote(
general = c("1. test 1", "2. test 2"))%>%
row_spec(0,bold=TRUE)
```
If you add keep_tex: true to your header you can edit the resulting .tex file to remove the multiple causes of the additional space:
remove the unnecessary and often harmful \resizebox{\linewidth}{!}{...} around the table
remove the caption package (which is unnecessarily loaded multiple times)
remove the parskip package
\PassOptionsToPackage{unicode=true}{hyperref} % options for packages loaded elsewhere
\PassOptionsToPackage{hyphens}{url}
%
\documentclass[ignorenonframetext,]{beamer}
\usepackage{pgfpages}
\setbeamertemplate{caption}[numbered]
\setbeamertemplate{caption label separator}{: }
\setbeamercolor{caption name}{fg=normal text.fg}
\beamertemplatenavigationsymbolsempty
% Prevent slide breaks in the middle of a paragraph:
\widowpenalties 1 10000
\raggedbottom
\setbeamertemplate{part page}{
\centering
\begin{beamercolorbox}[sep=16pt,center]{part title}
\usebeamerfont{part title}\insertpart\par
\end{beamercolorbox}
}
\setbeamertemplate{section page}{
\centering
\begin{beamercolorbox}[sep=12pt,center]{part title}
\usebeamerfont{section title}\insertsection\par
\end{beamercolorbox}
}
\setbeamertemplate{subsection page}{
\centering
\begin{beamercolorbox}[sep=8pt,center]{part title}
\usebeamerfont{subsection title}\insertsubsection\par
\end{beamercolorbox}
}
\AtBeginPart{
\frame{\partpage}
}
\AtBeginSection{
\ifbibliography
\else
\frame{\sectionpage}
\fi
}
\AtBeginSubsection{
\frame{\subsectionpage}
}
\usepackage{lmodern}
\usepackage{amssymb,amsmath}
\usepackage{ifxetex,ifluatex}
\usepackage{fixltx2e} % provides \textsubscript
\ifnum 0\ifxetex 1\fi\ifluatex 1\fi=0 % if pdftex
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{textcomp} % provides euro and other symbols
\else % if luatex or xelatex
\usepackage{unicode-math}
\defaultfontfeatures{Ligatures=TeX,Scale=MatchLowercase}
\fi
\usetheme[]{Berkeley}
\usecolortheme{dolphin}
\usefonttheme{structurebold}
% use upquote if available, for straight quotes in verbatim environments
\IfFileExists{upquote.sty}{\usepackage{upquote}}{}
% use microtype if available
\IfFileExists{microtype.sty}{%
\usepackage[]{microtype}
\UseMicrotypeSet[protrusion]{basicmath} % disable protrusion for tt fonts
}{}
\IfFileExists{parskip.sty}{%
%\usepackage{parskip}
}{% else
\setlength{\parindent}{0pt}
\setlength{\parskip}{6pt plus 2pt minus 1pt}
}
\usepackage{hyperref}
\hypersetup{
pdftitle={Example},
pdfauthor={Its me},
pdfborder={0 0 0},
breaklinks=true}
\urlstyle{same} % don't use monospace font for urls
\newif\ifbibliography
\setlength{\emergencystretch}{3em} % prevent overfull lines
\providecommand{\tightlist}{%
\setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}}
\setcounter{secnumdepth}{0}
% set default figure placement to htbp
\makeatletter
\def\fps#figure{htbp}
\makeatother
\usepackage{booktabs}
\usepackage{longtable}
\usepackage{tabu}
\usepackage{threeparttable}
\usepackage{adjustbox}
%\usepackage{caption}
%\captionsetup[table]{skip=0pt}
%\usepackage[font=small,skip=0pt]{caption}
\usepackage{tikz}
\usepackage{float}
\usetikzlibrary{arrows,shapes,positioning}
\title{Example}
\author{Its me}
\date{6/12/2020}
\begin{document}
\frame{\titlepage}
\begin{frame}{there it is}
\protect\hypertarget{there-it-is}{}
\begin{table}
\caption{\label{tab:unnamed-chunk-4}This is a table}
%\resizebox{\linewidth}{!}{
\begin{tabu} to \linewidth {>{\raggedleft}X}
\toprule
\textbf{mpg}\\
\midrule
20.09\\
\bottomrule
\multicolumn{1}{l}{\textit{Note: }}\\
\multicolumn{1}{l}{1. test 1}\\
\multicolumn{1}{l}{2. test 2}\\
\end{tabu}
%}
\end{table}
\end{frame}
\end{document}
(I would stay away from tabu and use a normal table instead)

Resources