为什么横向页面会导致 Officeverse 中的页码/节页眉/页脚出现问题?

问题描述 投票:0回答:1

当将下面的

Rmd
与横向页面编织并查看其生成的单词输出时,很明显,第二页似乎丢失了。此外,页面页脚中的页码仅在包含横向页面后才开始。

相反,编织下面的

Rmd
没有横向页面时,则没有这样的问题

这是为什么?如何使横向页面的文档与没有横向页面的文档一样?

横向页面:

---
output: officedown::rdocx_document
---

```{r setup, include=FALSE}
library(officedown) # 0.3.0
```

<!---BLOCK_TOC--->

# Chapter 1
# Chapter 2
<!---BLOCK_LANDSCAPE_START--->
# Chapter 3
<!---BLOCK_LANDSCAPE_STOP--->
# Chapter 4
\newpage
# Chapter 5
\newpage
# Chapter 6

无横向页面:

---
output: officedown::rdocx_document
---

```{r setup, include=FALSE}
library(officedown) # 0.3.0
```

<!---BLOCK_TOC--->

# Chapter 1
# Chapter 2
# Chapter 3
# Chapter 4
\newpage
# Chapter 5
\newpage
# Chapter 6
r r-markdown officer officedown
1个回答
0
投票

第2页:
使用

<!---BLOCK_LANDSCAPE_STOP{break_page: "nextPage"}--->
而不是
<!---BLOCK_LANDSCAPE_STOP--->
可以解决此问题。

页脚中的页码从第 1 页开始:

<!---BLOCK_TOC--->
之后添加以下块。该块中的函数来自
officer
包。

```{r}
footer_default <- block_list(fpar(run_word_field(field = "PAGE"),
                                  fp_p = fp_par(text.align = "center") ))

block_section(prop_section(footer_default = footer_default))
```

大家一起:

---
output: officedown::rdocx_document
---

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = FALSE)
library(officedown) # 0.3.0
library(officer) # 0.6.2
```

<!---BLOCK_TOC--->

```{r}
footer_default <- block_list(fpar(run_word_field(field = "PAGE"),
                                  fp_p = fp_par(text.align = "center") ))

block_section(prop_section(footer_default = footer_default))
```

# Chapter 1
# Chapter 2
<!---BLOCK_LANDSCAPE_START--->
# Chapter 3
<!---BLOCK_LANDSCAPE_STOP{break_page: "nextPage"}--->
# Chapter 4
\newpage
# Chapter 5
\newpage
# Chapter 6
© www.soinside.com 2019 - 2024. All rights reserved.