【问题标题】:Inserting logo into beamer presentation using R Markdown使用 R Markdown 将徽标插入投影仪演示文稿
【发布时间】:2014-09-17 12:45:00
【问题描述】:

我正在尝试使用 Rmarkdown 将徽标插入投影仪演示中,看起来 \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()

【问题讨论】:

  • 顺便说一句:如果你想用 Markdown 做演示,为什么不直接用 RemarkJS 这样的工具呢?
  • 它是用R自动生成的,它会拉取数据,处理它,创建图表和表格。
  • 哦,好的,谢谢你的澄清:-)

标签: r markdown beamer


【解决方案1】:

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

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

【讨论】:

    【解决方案2】:

    我发现这个beamer tutorial 非常有用。只需将以下内容添加到传递给 YAML 选项 in_header 的文件 mystyle.tex 中(如问题所示):

    \usepackage{tikz}
    \titlegraphic { 
    \begin{tikzpicture}[overlay,remember picture]
    \node[left=0.2cm] at (current page.30){
        \includegraphics[width=3cm]{Beamer-Logo}
    };
    \end{tikzpicture}
    }
    

    然后您可以使用节点参数来调整徽标的位置 (Beamer-Logo)。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-08-03
      • 1970-01-01
      • 2023-03-08
      • 2017-12-07
      • 2021-05-19
      • 2021-05-24
      • 2011-03-02
      • 1970-01-01
      相关资源
      最近更新 更多