Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/r/65.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
仅将pandoc_参数应用于rmarkdown文档的一部分-例如两列_R_R Markdown_Pandoc - Fatal编程技术网

仅将pandoc_参数应用于rmarkdown文档的一部分-例如两列

仅将pandoc_参数应用于rmarkdown文档的一部分-例如两列,r,r-markdown,pandoc,R,R Markdown,Pandoc,是否有一种方法可以使用rmarkdown创建一个输出,该输出在页面的一部分只有两列?也就是说,我想要一个标题和一些横跨整个页面的文本,但数字仍然是列格式。考虑下面的示例,其中列被设置为2,但标题仍在那里。 更新 我使用\twocolumn解决方案更接近这里,但随后创建了一个新的空白页 --- title: "twocol_test" author: "test" output: pdf_document --- ```{r setup, includ

是否有一种方法可以使用rmarkdown创建一个输出,该输出在页面的一部分只有两列?也就是说,我想要一个标题和一些横跨整个页面的文本,但数字仍然是列格式。考虑下面的示例,其中列被设置为2,但标题仍在那里。

更新 我使用
\twocolumn
解决方案更接近这里,但随后创建了一个新的空白页

---
title: "twocol_test"
author: "test"
output: pdf_document
---
  
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```

## This header should stretch across the whole page
Then this text should also not be in a column. But then the figures below should be organized into two columns:

\twocolumn

```{r}
plot(iris$Sepal.Length, iris$Sepal.Width)
```

```{r}
plot(iris$Sepal.Length, iris$Sepal.Width)
```

\onecolumn


```{r}
plot(iris$Sepal.Length, iris$Sepal.Width)
```

```{r}
plot(iris$Sepal.Length, iris$Sepal.Width)
```

更一般地说,问题是如何仅对
.Rmd
文件的一部分应用pandoc arg?

我无法准确地理解这一点,但找到了一些适合我的方法,包括向跨两列的标题传递参数。不完美,但这将起作用:

---
output: 
  pdf_document:
    pandoc_args: [
      "-V", "classoption=twocolumn"
    ]
params:
  test:
    value: test
  set_title: test_title
---

---
title: `r params$set_title`
---

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

```{r}
plot(iris$Sepal.Length, iris$Sepal.Width)
```

```{r}
plot(iris$Sepal.Length, iris$Sepal.Width)
```

```{r}
plot(iris$Sepal.Length, iris$Sepal.Width)
```

```{r}
plot(iris$Sepal.Length, iris$Sepal.Width)
```

一个相关的问题是“如何在乳胶中做到这一点?”如果markdown可以轻松做到这一点,我会感到惊讶,但既然您正在创建PDF,您可以找到未加工的乳胶,然后改为这样做。(这是我如何轮换了一些页面,但不是全部。)我认为解决方案包括直接包含一些latex代码,但还不能准确地确定是哪一个。我建议这将在上得到更快的回答。他们是否在那里回答了rmarkdown问题?要明确的是,这是一个rmarkdown问题,而不是LaTeX问题。乳胶中的两个柱相对来说是微不足道的。这是如何使它在rmarkdown中工作的。他们没有太多地处理(r)标记,如果是真的,但我相信这在标记中是不可能的。我认为您必须在markdown文件中输入raw-LaTeX命令;pandoc应将其通过,并由
pdflatex
流程接管。