我正在尝试从 RMarkdown 创建一个 Word 文档 - 到目前为止,一切都很好,除了我必须输出 4 页报告,第一页是纵向,接下来的 2 页 ggplots 是横向的,最后一页是纵向 ggplot。
我已经尝试了所有我能想到的解决方案。我在参考文档中制作了 4 个页面,其中包含我需要的方向,但这不起作用。我还使用包含以下内容的 header.tex 文件尝试了此解决方案:
\usepackage{lscape}
\newcommand{\blandscape}{\begin{landscape}}
\newcommand{\elandscape}{\end{landscape}}
Run Code Online (Sandbox Code Playgroud)
我在 StackOverflow 上看到这个解决方案,使用 pandoc_args 中的 lua 过滤器。
---
title: "Example"
output:
word_document:
pandoc_args:
'--lua-filter=page-break.lua'
---
Run Code Online (Sandbox Code Playgroud)
解决我的问题的解决方案是officedown包中的这个参数: https: //github.com/davidgohel/officedown
<!---BLOCK_LANDSCAPE_START--->
Blah blah blah.
<!---BLOCK_LANDSCAPE_STOP--->
Run Code Online (Sandbox Code Playgroud)
但不幸的是,我无法使用 devtools() 从我需要的工作 RServer 上下载它。有什么方法可以使用和操作office(officedown的非markdown版本)中的某些功能来在我的文档中获得纵向和横向的混合方向?例如,officer包有这个功能: https://github.com/davidgohel/officer/blob/master/R/docx_section.R
body_end_section_landscape <- function( x, w = 21 / 2.54, h = 29.7 / 2.54 ){
w = w * 20 * 72
h = h * …Run Code Online (Sandbox Code Playgroud)