R Markdown中的列

问题描述 投票:1回答:1

我想做简单的beamer演示。我的代码是这样的。

---
title: "Untitled"
author: "Name"
output:
  beamer_presentation:
    theme: "AnnArbor"
    colortheme: "dolphin"
    fonttheme: "structurebold"
fontsize: 24pt
---
## Slide 1

\begin{columns}

\column{0.75\textwidth}

```{r echo = FALSE, warning=FALSE, out.width="75%"}
plot(1:10)
```

\column{0.25\textwidth}
text

\end{columns}

## Slide 2

\begin{columns}

\column{0.25\textwidth}
text

\column{0.75\textwidth}

```{r echo = FALSE, warning=FALSE, out.width="75%"}
plot(1:10)
```

\end{columns}

在第一张幻灯片上,我得到的情节只是在左边和漂亮的文字, 但在第二张幻灯片上,我的情节是在幻灯片的中间,而文字只是移动到幻灯片的左侧。你知道如何使它看起来像在第一张幻灯片的美学?我将是伟大的充分的任何帮助:)

r latex r-markdown beamer
1个回答
1
投票

你观察到的是几个不同原因的组合。

  • 你使用的主题的边距比平常小 -- 一切都会显得很拥挤。

  • 如果你的列的组合宽度太大,它们会突出到边缘。请使用 \begin{columns}[onlytextwidth] 或将其缩小

  • 借用 out.width="75%" 你的剧情将只跨越其列的四分之一,从而增加了很多不对称的空白空间。如果 100% 对你来说太大,请将该列变小。

  • 为了避免第三帧中的文字向左对齐,您可以使用 \centering


---
title: "Untitled"
author: "Name"
output:
  beamer_presentation:
    theme: "AnnArbor"
    colortheme: "dolphin"
    fonttheme: "structurebold"
    keep_tex: true
fontsize: 24pt
---
## Slide 1

\begin{columns}[onlytextwidth]

\column{0.75\textwidth}

```{r echo = FALSE, warning=FALSE, out.width="100%"}
plot(1:10)
```


\column{0.25\textwidth}
\centering
text

\end{columns}

## Slide 2

\begin{columns}[onlytextwidth]

\column{0.25\textwidth}
\centering
text

\column{0.75\textwidth}

\hfill
```{r echo = FALSE, warning=FALSE, out.width="100%"}
plot(1:10)
```

\end{columns}

enter image description here

© www.soinside.com 2019 - 2024. All rights reserved.