Search code examples
latexr-markdownbeamer

How to add two logos on frame title in rmarkdown beamer presentation?


I have the following rmardown beamer presentation presentation.rmd:

---
title: "Markdown beamer with to logos"
output: 
beamer_presentation:
    slide_level: 1
    theme: "Berkeley"
header-includes: |
\pgfdeclareimage[height=.5cm, width=1.5cm]{logoMyCompany}{data/img/logoMyCompany.png}
\pgfdeclareimage[height=.5cm, width=1.5cm]{logoMyCompany}{data/img/logoOurClient.png}

---

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = FALSE)
```

# First page title

enter image description here

I want to add two companies logos on the TOP RIGHT side on the slide (in frame titles on each frame).

How do I do that.

I use Berkeley beamer theme which I would like to keep, if possible.

I know how to add logo in top left coner:

\pgfdeclareimage[height=.5cm, width=1.5cm]{logo}{data/img/logo.png}
\logo{\pgfuseimage{logo}}

But in this case it is not suitable.


Solution

  • You can use as many logos as you want in the \logo{} macro:

    \documentclass{beamer}
    \usetheme{Berkeley}
    
    \pgfdeclareimage[height=.5cm]{logoHarman}{example-image-duck}
    \pgfdeclareimage[height=.5cm]{logoMSC}{example-image-duck}
    
    \logo{\pgfuseimage{logoMSC}\pgfuseimage{logoHarman}}
    
    \begin{document}
    
    \begin{frame}
    \frametitle{title}
        abc
    \end{frame} 
    
    \end{document}
    

    and in rmarkdown:

    ---
    title: "Markdown beamer with to logos"
    output: 
      beamer_presentation:
        slide_level: 1
        theme: "Berkeley"
    header-includes: 
      - \pgfdeclareimage[height=.5cm]{logoHarman}{example-image-duck}
      - \pgfdeclareimage[height=.5cm]{logoMSC}{example-image-duck}
      - \logo{\pgfuseimage{logoMSC}\pgfuseimage{logoHarman}}
    ---
    
    ```{r setup, include=FALSE}
    knitr::opts_chunk$set(echo = FALSE)
    ```
    
    # First page title
    

    enter image description here