简体   繁体   English

如何在 rmarkdown 演示文稿中包含左侧图像和右侧文本

[英]How to include image on left side and text on the right side for rmarkdown presentation

How can this be done in Markdown?如何在 Markdown 中完成此操作?

I am using the beamer presentation in Rmarkdown, and I want an image on the left side of a slide and text on the right side of a slide.我在 Rmarkdown 中使用 beamer 演示文稿,我想要幻灯片左侧的图像和幻灯片右侧的文本。

Basically, what this does: https://tex.stackexchange.com/questions/165475/figure-next-to-text-in-beamer基本上,这是做什么的: https ://tex.stackexchange.com/questions/165475/figure-next-to-text-in-beamer

But for Markdown not latex.但是对于 Markdown 不是乳胶。

Use the multicol package:使用multicol包:

---
title: "Untitled"
author: "Martin"
date: "7/9/2017"
output: 
  beamer_presentation: 
    keep_tex: yes
header-includes:
  - \usepackage{multicol}
---

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

## R Markdow

\begin{multicols}{2}

  \null \vfill
  \includegraphics[width=.3\textwidth]{unnamed.png}
  \vfill \null

\columnbreak

  \null \vfill
  \begin{itemize}
    \item Item 1
    \item Item 2
  \end{itemize}
  \vfill \null
\end{multicols}

在此处输入图像描述

You can do it in Pandoc's way!你可以按照 Pandoc 的方式来做! Refer to the manual for more information.有关详细信息,请参阅手册

---
output: beamer_presentation
---

:::: {.columns}
::: {.column width="60%"}
![giraffe](giraffe.jpg)
:::
::: {.column width="40%"}
["Funny giraffe looking at the side"](https://www.flickr.com/photos/8070463@N03/9594476129) by [Tambako the Jaguar](https://www.flickr.com/photos/8070463@N03) is licensed under [CC BY-ND 2.0](https://creativecommons.org/licenses/by-nd/2.0/?ref=ccsearch&atype=rich)
:::
::::

截屏

I would not use the multicol package with beamer, beamer has its own mechanism for columns:我不会将multicol包与 beamer 一起使用,beamer 有自己的列机制:

---
output: 
  beamer_presentation:
    theme: "CambridgeUS"
    keep_tex: true

---

# test

\begin{columns}[onlytextwidth,T]
  \begin{column}{.45\linewidth}
    \includegraphics[width=\linewidth]{example-image-duck}
  \end{column}
  \begin{column}{.45\linewidth}
    test
  \end{column}
\end{columns}

在此处输入图像描述

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM