TransWikia.com

How to integrate custom beamer template in rmarkdown/ issues with yaml

TeX - LaTeX Asked by persephone on February 19, 2021

I am procrastinating for fun on a modern beamer template using IBMs awesome new PLEX font (i will share it on git once finished or atleast half-done). As I am planning to completely switch to Rmarkdown, I would love to integrate this template in a pipeline. However, as I am new to RMD, I am having troubles doing this.

Right know, i only manage to achieve this with the following code:

RMD:

output:
  beamer_presentation:
    includes:
      in_header: template.tex
    keep_tex: yes
    latex_engine: pdflatex
---

# {.plain}
titlepage

# test

This is a test.

Tex-file:

usepackage[utf8]{inputenc}
usepackage[T1]{fontenc}
usepackage{hyperref}
usepackage{fontawesome}

usetheme{stylefile}

title{A theme}
subtitle{A modern beamer and Rmarkdown template}
date{today}
author{XY}
supervisor{XY}
institute{Institution or Company of High Esteem}
symbols{twitter{}{}git{}{}}

After knitting, this gives me the desired output. However, I would like to include title/date/author/supervisor(costum command) in the rmd yaml header. How do I achieve this?

Also, does anyone know of a good example/walk-through for integrating costum tex templates with rmd – google did not help so far?

Thanks in advance!

One Answer

I would like to include title/date/author/supervisor(costum command) in the rmd yaml header. How do I achieve this?

So simple:

---
title: A theme
subtitle: A modern beamer and Rmarkdown template
date: today
author: XY
supervisor: YZ
institute: Institution or Company of High Esteem
output: beamer_presentation
---
# test

This is a test.

If you compile this, this produce a title frame and the only thing ignored of the YALM header is YZ.

The reason is that there are not any $supervisor$ variable nor $if(supervisor)$ <whatever> $else$ <whatever> $endif$ in the default template. This link the second question:

Does anyone know of a good example/walk-through for integrating costum tex templates?

cd  /usr/share/pandoc/data/templates # In Linux Mint
nano default.beamer                  # change "nano" to your favorite editor

OK, ok, some simpler to start: simplest.template:

documentclass{beamer}
begin{document}
begin{frame}
$body$
end{frame}
end{document}

Test.Rmd:

---
output:
  pdf_document:
    template: simplest.template
--- 

This is the body.

Too simple? Ok, ok, I know, ... some less simple: the supervisor.template:

documentclass{beamer}
begin{document}
begin{frame}
$if(supervisor)$ Supervisor: $supervisor$ 
$else$ I have not a supervisor $endif$ 
end{frame}
end{document}

Test2.Rmd:

---
supervisor: YZ
output:
  pdf_document:
    keep_tex: yes
    template: supervisor.template
---
  
This is ignored text.

... And so on.

Answered by Fran on February 19, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP