Logo mit R Markdown @ in Beamer-Präsentation einfüg

Ich versuche, ein Logo mit Rmarkdown in die Beamer-Präsentation einzufügen, und es sieht aus wie eine Größensteuerung in\logo{\includegraphics[height=1cm,width=3cm]{logo.png}} funktioniert nicht, egal welche Werte ich dort angegeben habe, das Bild ist immer gleich groß. Irgendwelche Vorschläge außer dem manuellen Ändern des Bildes?

---
title: "Presentation"
author: "Author"
output:
  beamer_presentation:
    includes:
      in_header: mystyle.tex

---

## R Markdown

This is an R Markdown presentation. Markdown is a simple formatting
syntax for authoring HTML, PDF, and MS Word documents. For more
details on using R Markdown see <http://rmarkdown.rstudio.com>.

When you click the **Knit** button a document will be generated that
includes both content as well as the output of any embedded R code
chunks within the document.

## Slide with Bullets

- Bullet 1
- Bullet 2
- Bullet 3

## Slide with R Code and Output

```{r}
summary(cars)
```

## Slide with Plot

```{r, echo=FALSE}
plot(cars)
```

Das ist mystyle.tex

\logo{\includegraphics[height=1cm,width=3cm]{logo.png}}
\usetheme{Madrid}
\usefonttheme{serif}
\institute{Institute}
\setbeamertemplate{navigation symbols}{}

UPDATE: Schnelle Umgehung - das einfache Ändern des Bildes funktioniert nicht - das Bild ist hässlich und pixelig. Das einfache Konvertieren in PDF hat auch nicht gut funktioniert, daher habe ich folgenden R-Code verwendet, um PDF zu erstellen und in \ logo {\ includesegraphics {logo.pdf}} zu verwenden.

library(png)
library(grid)
img <- readPNG('logo.png')
img <- rasterGrob(img, interpolate=TRUE)
pdf(file = 'logo.pdf', width = 1, height = 0.25)
grid.newpage()
grid.raster(img)
dev.off()

Antworten auf die Frage(1)

Ihre Antwort auf die Frage