使用 rmarkdown 生成的投影仪演示文稿中的列内容垂直居中对齐 [英] Vertically center-align content of columns in a beamer presentation generated with rmarkdown
本文介绍了使用 rmarkdown 生成的投影仪演示文稿中的列内容垂直居中对齐的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何在 `rmarkdown::beamer_presentation 中垂直居中对齐多个列的内容?
正如对
如果有一种简单的方法可以为每一列以不同方式对齐内容,那也将非常有帮助(例如,c1:顶部,c2:中间,c3:底部,c4:中间).
MWE
---输出:bookdown::pdf_book:base_format: rmarkdown::beamer_presentation幻灯片级别:2keep_tex: 真---## 列中的数字顶部对齐::: 列:::: {.column width=30%"}```{r top-p-5, echo=FALSE, out.width='30%'}情节(压力[1:5,])```:::::::: {.column width=30%"}```{r top-p-10, echo=FALSE, out.width='50%'}情节(压力[1:10,])```:::::::: {.column width=30%"}```{r top-p-all, echo=FALSE, out.width='100%'}情节(压力[1:nrow(压力),])```:::::::## 列中的数字居中对齐(不起作用)::: 列::: {.column width=30%"}```{r center-p-5, echo=FALSE, out.width='30%'}情节(压力[1:5,])```:::::: {.column width=30%"}```{r center-p-10, echo=FALSE, out.width='50%'}情节(压力[1:10,])```:::::: {.column width=30%"}```{r center-p-all, echo=FALSE, out.width='100%'}情节(压力[1:nrow(压力),])```::::::
解决方案
你可以使用 :::: {.columns align=center}
来获得居中对齐
---输出:bookdown::pdf_book:base_format: rmarkdown::beamer_presentation幻灯片级别:2keep_tex: 真---## 列中的数字顶部对齐::: 列:::: {.column width=30%"}```{r top-p-5, echo=FALSE, out.width='30%'}情节(压力[1:5,])```:::::::: {.column width=30%"}```{r top-p-10, echo=FALSE, out.width='50%'}情节(压力[1:10,])```:::::::: {.column width=30%"}```{r top-p-all, echo=FALSE, out.width='100%'}情节(压力[1:nrow(压力),])```:::::::## 列中的数字居中对齐(不起作用):::: {.columns align=center}::: {.column width=30%"}```{r center-p-5, echo=FALSE, out.width='30%'}情节(压力[1:5,])```:::::: {.column width=30%"}```{r center-p-10, echo=FALSE, out.width='50%'}情节(压力[1:10,])```:::::: {.column width=30%"}```{r center-p-all, echo=FALSE, out.width='100%'}情节(压力[1:nrow(压力),])```:::::::
How to vertically center-align the content of multiple columns in a `rmarkdown::beamer_presentation?
As recommended in a comment in to an answer to this SO post, I tried ::: {.column width="30%"}
, which however did not work for me.
If there is a simple way to align content differently for each column, that would further be very helpful too (e.g., c1: top, c2: middle, c3: bottom, c4: middle).
MWE
---
output:
bookdown::pdf_book:
base_format: rmarkdown::beamer_presentation
slide_level: 2
keep_tex: true
---
## Figures in columns top-aligned
::: columns
:::: {.column width="30%"}
```{r top-p-5, echo=FALSE, out.width='30%'}
plot(pressure[1:5,])
```
::::
:::: {.column width="30%"}
```{r top-p-10, echo=FALSE, out.width='50%'}
plot(pressure[1:10,])
```
::::
:::: {.column width="30%"}
```{r top-p-all, echo=FALSE, out.width='100%'}
plot(pressure[1:nrow(pressure),])
```
::::
:::
## Figures in columns center-aligned (not working)
::: columns
::: {.column width="30%"}
```{r center-p-5, echo=FALSE, out.width='30%'}
plot(pressure[1:5,])
```
:::
::: {.column width="30%"}
```{r center-p-10, echo=FALSE, out.width='50%'}
plot(pressure[1:10,])
```
:::
::: {.column width="30%"}
```{r center-p-all, echo=FALSE, out.width='100%'}
plot(pressure[1:nrow(pressure),])
```
:::
:::
解决方案
You can use :::: {.columns align=center}
to get centre alignment
---
output:
bookdown::pdf_book:
base_format: rmarkdown::beamer_presentation
slide_level: 2
keep_tex: true
---
## Figures in columns top-aligned
::: columns
:::: {.column width="30%"}
```{r top-p-5, echo=FALSE, out.width='30%'}
plot(pressure[1:5,])
```
::::
:::: {.column width="30%"}
```{r top-p-10, echo=FALSE, out.width='50%'}
plot(pressure[1:10,])
```
::::
:::: {.column width="30%"}
```{r top-p-all, echo=FALSE, out.width='100%'}
plot(pressure[1:nrow(pressure),])
```
::::
:::
## Figures in columns center-aligned (not working)
:::: {.columns align=center}
::: {.column width="30%"}
```{r center-p-5, echo=FALSE, out.width='30%'}
plot(pressure[1:5,])
```
:::
::: {.column width="30%"}
```{r center-p-10, echo=FALSE, out.width='50%'}
plot(pressure[1:10,])
```
:::
::: {.column width="30%"}
```{r center-p-all, echo=FALSE, out.width='100%'}
plot(pressure[1:nrow(pressure),])
```
:::
::::
这篇关于使用 rmarkdown 生成的投影仪演示文稿中的列内容垂直居中对齐的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文