r - 使用 R Markdown 将 Logo 插入投影仪演示文稿

标签 r markdown beamer

我正在尝试使用 Rmarkdown 将 Logo 插入投影仪演示中,它看起来像 \logo{\includegraphics[height=1cm,width=3cm]{logo.png}} 中的大小控件不工作,无论我放什么值,图像总是相同的大小。除了手动修改图像之外还有什么建议吗?

---
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)
```

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

更新:快速解决 - 简单地修改图像将不起作用 - 图像丑陋且像素化。简单地转换为 pdf 也效果不佳,所以我使用以下 R 代码创建 pdf 并在\logo{\includegraphics{logo.pdf}} 中使用它
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()

最佳答案

我找到了解决方案;在投影仪手册中有另一种使用 Logo 功能的方法,它工作正常。

\pgfdeclareimage[height=0.2787cm, width=2.5cm]{logo}{logo.png}
\logo{\pgfuseimage{logo}}

关于r - 使用 R Markdown 将 Logo 插入投影仪演示文稿,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25890939/

相关文章:

r - 计算特定时间间隔内 KM 图中的幸存者数量

r - 尝试在 ggplot2 中绘制简单直方图给出 "Error: position_stack requires constant width"

r - 将回归模型估计值合并到一个表中

Stack Overflow 的 Markdown 的 Emacs 模式

intellij-idea - 为什么 IntelliJ 的 Markdown 插件中的某些按钮会变灰?

python - 我的一长行 Python 代码在投影仪幻灯片中没有很好地显示

latex 投影仪 : How is it possible to make piece of text in a frame in italics?

r - 将 R 脚本从非交互式切换到交互式

latex - tikz:为节点设置适当的x值

html - IntelliJ 更改语言模式与 VS Code 相同