在同一PDF页面上的部分标题和面向景观的图
在Knitr生成的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}
绘图出现在与“部分标题”不同的页面上,因为\ begin {Landscape}显然启动了一个
新
---
title: "Untitled"
output: pdf_document
date: '2022-06-21'
header-includes:
- \usepackage{pdflscape}
---
\begin{landscape}
# Section title
```{r pressure, out.extra= 'angle=0', echo = F}
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
```{r pressure, echo=FALSE}
plot(pressure)
```
\end{landscape}
Inside a knitr-generated PDF, I want to have the section title on the same page as a figure displayed in landscape format.
If I do this
---
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}
The plot appears on a different page than "Section title" as \begin{landscape} apparently starts a new page
But if I do this
---
title: "Untitled"
output: pdf_document
date: '2022-06-21'
header-includes:
- \usepackage{pdflscape}
---
\begin{landscape}
# Section title
```{r pressure, out.extra= 'angle=0', echo = F}
plot(pressure)
```
\end{landscape}
I am getting an error message
! 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
Edit: this syntax, leaving empty lines around the section heading, is not working
---
title: "Untitled"
output: pdf_document
date: '2022-06-21'
header-includes:
- \usepackage{pdflscape}
---
\begin{landscape}
# Section title
```{r pressure, echo=FALSE}
plot(pressure)
```
\end{landscape}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
只需应用Yihui的评论,该评论链接到 bookdown文档听起来很复杂,但真的很容易!
Just applying Yihui's comment that links to the bookdown documentation, to show that it sounds complex but is really easy!