当我想使用 Latex 将 Rmarkdown 文件渲染为 beamer pdf 时。我收到错误:
!\beamer@doifinframe 定义中的参数数量非法
我仅在标签内得到此信息columns
。
---
title: ""
output:
beamer_presentation:
toc: false
keep_tex: false
params:
one_touch_plot: NA
classoption: "aspectratio=169"
---
```{r setup, include=FALSE}
library(ggplot2)
library(knitr)
library(markdown)
knitr::opts_chunk$set(echo = FALSE,
warning = FALSE,
message = FALSE)
```
\begin{frame}[fragile]
\begin{columns}[T]
\begin{column}{0.27\textwidth}
```{r, out.width='100%', out.height='38%'}
params$one_touch_plot
```
\end{column}
\hfill
\end{columns}
\end{frame}
答案1
据我所知,您不能在 latex 环境中使用 r 块,例如frame
或columns
。但是 rmarkdown 对于列有自己的语法:
---
title: ""
output:
beamer_presentation:
toc: false
keep_tex: false
params:
one_touch_plot: NA
classoption: "aspectratio=169"
---
```{r setup, include=FALSE}
library(ggplot2)
library(knitr)
library(markdown)
knitr::opts_chunk$set(echo = FALSE,
warning = FALSE,
message = FALSE)
```
# {.fragile}
::: columns
:::: column
```{r, out.width='100%', out.height='38%'}
params$one_touch_plot
```
::::
:::