我想知道如何使用
这里有一个简单可复现的示例。首先,在RStudio中呈现这个
然而,这段代码会导致错误:
rmarkdown
生成一个既有纵向又有横向布局的pdf文档。如果有纯粹的 rmarkdown
选项,那就比使用latex更好了。这里有一个简单可复现的示例。首先,在RStudio中呈现这个
.Rmd
(点击Knit PDF按钮),生成的pdf所有页面都是横向布局:---
title: "All pages landscape"
output: pdf_document
classoption: landscape
---
```{r}
summary(cars)
```
\newpage
```{r}
summary(cars)
```
接下来是尝试创建一个混合纵向和横向布局的文档。基本设置在YAML
中根据这里的'Includes'部分完成(链接)。文件'in_header'中只包含\usepackage{lscape}
,这是一个建议用于knitr
横向布局的包(链接)。.tex
文件与.Rmd
文件在同一目录中。
---
title: "Mixing portrait and landscape"
output:
pdf_document:
includes:
in_header: header.tex
---
Portrait:
```{r}
summary(cars)
```
\newpage
\begin{landscape}
Landscape:
```{r}
summary(cars)
```
\end{landscape}
\newpage
More portrait:
```{r}
summary(cars)
```
然而,这段代码会导致错误:
# ! You can't use `macro parameter character #' in horizontal mode.
# l.116 #
# pandoc.exe: Error producing PDF from TeX source
# Error: pandoc document conversion failed with error 43
非常感谢您的帮助。
.md
文件(可以),然后进行 md->tex 转换(这就是出错的地方)。错误信息并没有帮助,因为已经进入了下一步(latex)。 - baptiste