R语言 在同一PDF页面上的章节标题和横向图

dced5bon  于 2023-06-27  发布在  其他
关注(0)|答案(1)|浏览(107)

在一个编织者生成的PDF中,我希望在同一页上有一个横屏格式显示的图的部分标题。
如果我这么做

---
title: "Untitled"
output: pdf_document
date: '2022-06-21'
header-includes:
  - \usepackage{pdflscape}
---
# Section title
\begin{landscape}
```{r pressure, out.extra= 'angle=0', echo = F}
plot(pressure)

\end{landscape}


该图显示在与“章节标题”不同的页面上,因为\开始{landscape}显然开始了一个新页面
但如果我这么做

title: "Untitled"
output: pdf_document
date: '2022-06-21'
header-includes:

  • \usepackage{pdflscape}

\begin{landscape}

Section title

plot(pressure)

\end{landscape}


我收到错误消息

! You can't use `macro parameter character #' in vertical mode.
l.74 #
Section title

Error: LaTeX failed to compile sectionTitle.tex. See https://yihui.org/tinytex/r/#debugging for debugging tips. See sectionTitle.log for more info.
Execution halted


编辑:这种语法,在节标题周围留下空行,不起作用

title: "Untitled"
output: pdf_document
date: '2022-06-21'
header-includes:

  • \usepackage{pdflscape}

\begin{landscape}

Section title

plot(pressure)

\end{landscape}

zvokhttg

zvokhttg1#

只是引用一辉的评论链接到bookdown documentation,以表明它听起来很复杂,但真的很容易!

---
title: "Untitled"
output: pdf_document
date: '2022-06-21'
header-includes:
  - \usepackage{pdflscape}
---

::: {.landscape data-latex=""}

# Section title

```{r pressure, echo=FALSE}
plot(pressure)

:::

相关问题