放在哪里 header.tex 将页面更改为 Landscape Rmarkdown

Where to put header.tex to change page to Landscape Rmarkdown

我在这里阅读了如何添加使我能够将页面更改为横向所需的内容: enter link description here

但是我已经将 header.tex 文件保存在所有我能想到的地方,但我仍然收到以下错误:

Called from: (function (e) 
{
if (inherits(e, "shiny.silent.error")) 
    return()
handle <- getOption("shiny.error")
if (is.function(handle)) 
    handle()
})(list(message = "pandoc document conversion failed with error 43", 
call = NULL))
Browse[1]> 

我知道这对我输入 \blandscape 和 \elandscape 是不利的,因为只要我删除这些命令,PDF 就会工作。我需要帮助的是弄清楚 header.tex 文件的保存位置,以便 Rmarkdown 知道如何找到它。在此先感谢大家的帮助!

跟进: 根据 scoa 关于将其添加到我的 header 的建议,我将我的 Rmd 文件的顶部编辑为以下内容。不幸的是,它仍然没有用。

---
title: "Lake Report"
output: pdf_document
header-includes:
- \usepackage{lscape}
- \newcommand{\blandscape}{\begin{landscape}}
- \newcommand{\elandscape}{\end{landscape}}
---
\newpage
\blandscape
```{r Non-Seasonal MK results, echo=FALSE}
# MKanalysis <- reactive(HM_MK(data = NonSeasonalData(),n = 4))
kable(MKanalysis(), caption = "Non-Seasonal Trend Analysis")
```
The results of the Mann Kendall analysis....
\elandscape

Latex program/verision:pdfTex,版本 3.14159265-2.6-1.40.17

header.tex 保存在与 Rmd 文件相同的目录中。此外,您可以将这些命令添加到您的 yaml front matter 中,而不是外部文件,这是一种更便携的解决方案:

---
title: "Lake Report"
output: pdf_document
header-includes:
- \usepackage{lscape}
- \newcommand{\blandscape}{\begin{landscape}}
- \newcommand{\elandscape}{\end{landscape}}
---