Rmarkdown 的瑣碎但煩人的問題。我正在嘗試在 Rmarkdown 的同一個 pdf 檔案中顯示橫向和縱向頁面。
我搜索了不同的解決方案并決定堅持使用乳膠選項(R 塊在 rmarkdown 檔案中的 LaTeX 中)。但是,即使使用該選項,我也無法將 R 代碼放在乳膠命令中。
---
title: ""
header-includes:
- \usepackage{lscape}
- \newcommand{\blandscape}{\begin{landscape}}
- \newcommand{\elandscape}{\end{landscape}}
output: pdf_document
---
\newpage
\blandscape
```{r}
plot(1,1)
```
\elandscape
\newpage
More portrait
```{r}
summary(cars)
```
我收到一個錯誤:
output file: hello.knit.md
! LaTeX Error: \begin{landscape} on input line 113 ended by \end{document}.
Error: LaTeX failed to compile hello.tex. See https://yihui.org/tinytex/r/#debugging for debugging tips. See hello.log for more info.
Execution halted
當以下代碼作業時:
---
title: ""
header-includes:
- \usepackage{lscape}
- \newcommand{\blandscape}{\begin{landscape}}
- \newcommand{\elandscape}{\end{landscape}}
output: pdf_document
---
\newpage
\blandscape
```{r}
1 1
```
\elandscape
\newpage
More portrait
```{r}
summary(cars)
```
我不知道為什么:D
有人有嗎?
uj5u.com熱心網友回復:
您可以直接使用環境的底層命令,而不是定義新命令:
---
title: ""
header-includes:
- \usepackage{lscape}
output: pdf_document
---
\newpage
\landscape
```{r}
plot(1,1)
```
\endlandscape
\newpage
More portrait
```{r}
summary(cars)
```
轉載請註明出處,本文鏈接:https://www.uj5u.com/gongcheng/517490.html
標籤:rpdf乳胶r-降价
