I want to include latex packages in R markdown pdf and beamer.
Could you help me in including usepackage command in rmarkdown beamer file?
Thanks a lot.
The use of additional LaTeX packages can allow for extensive customization of document styling. In addition, several packages such as kableExtra (Zhu 2021) may have LaTeX dependencies for the R package to function.
LaTeX \newcommand in R Markdown Define the command as you would in LaTeX. Put it below the YAML header at the beginning of your R Markdown file. Call the new command within $… $ to let R Markdown know that this command is defined in the LaTeX environment.
If you would like to create PDF documents from R Markdown, you will need to have a LaTeX distribution installed.
A simple solution would be to have your header setup like this:
---
title: "Document title"
author: "Author's name"
date: "Document date"
output: beamer_presentation
header-includes:
- \usepackage[brazil]{babel}
- \usepackage{graphicx}
- \usepackage[a4paper]{geometry}
---
The YAML header of the Rmd would look like:
---
title: "Habits"
output:
pdf_document:
includes:
in_header: header.tex
---
Then, in the file header.tex, include any usepackage statements you need, eg. \usepackage{pdflscape}
See http://rmarkdown.rstudio.com/pdf_document_format.html for more information.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With