首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >办公用R包中的不等压痕

办公用R包中的不等压痕
EN

Stack Overflow用户
提问于 2022-04-14 09:48:49
回答 1查看 71关注 0票数 0

我使用officedown包生成MS文档。我注意到了一个又奇怪又烦人的问题。在生成的输出中左右有不相等的缩进(见附图)。

我使用的Rmarkdown代码:

代码语言:javascript
复制
---
output: officedown::rdocx_document
---

No actual content

我用MS 2016打开文档(桌面安装)。

R sessionInfo输出:

代码语言:javascript
复制
R version 4.1.0 (2021-05-18)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19042)

Matrix products: default

locale:
[1] LC_COLLATE=Polish_Poland.1250  LC_CTYPE=Polish_Poland.1250    LC_MONETARY=Polish_Poland.1250 LC_NUMERIC=C                  
[5] LC_TIME=Polish_Poland.1250    

attached base packages:
[1] stats     graphics  grDevices datasets  utils     methods   base     

other attached packages:
[1] ggplot2_3.3.5    officedown_0.2.4

loaded via a namespace (and not attached):
 [1] zip_2.2.0         Rcpp_1.0.8.3      pillar_1.7.0      compiler_4.1.0    tools_4.1.0       digest_0.6.29     uuid_1.0-4       
 [8] evaluate_0.15     memoise_2.0.1     lifecycle_1.0.1   tibble_3.1.6      gtable_0.3.0      pkgconfig_2.0.3   rlang_1.0.2      
[15] DBI_1.1.2         cli_3.2.0         yaml_2.3.5        xfun_0.30         fastmap_1.1.0     withr_2.5.0       dplyr_1.0.8      
[22] officer_0.4.1     stringr_1.4.0     xml2_1.3.3        knitr_1.37        generics_0.1.2    vctrs_0.3.8       gdtools_0.2.4    
[29] systemfonts_1.0.4 tidyselect_1.1.2  grid_4.1.0        glue_1.6.2        R6_2.5.1          rvg_0.2.5         fansi_1.0.2      
[36] rmarkdown_2.13    bookdown_0.25     farver_2.1.0      purrr_0.3.4       magrittr_2.0.2    scales_1.1.1      htmltools_0.5.2  
[43] ellipsis_0.3.2    assertthat_0.2.1  colorspace_2.0-3  renv_0.15.4       labeling_0.4.2    utf8_1.2.2        stringi_1.7.6    
[50] munsell_0.5.0     cachem_1.0.6      crayon_1.5.0   

当我使用bookdown::word_document2作为输出时,问题就消失了,所以我希望officedown包有问题。然而,作者不允许在GitHub上出现新的问题。

我检查了页面大小和页边距的默认设置,它们似乎很好,即边距在两边相等。

我的第一个问题是,你能复制officedown的奇怪行为(我在两台不同的机器和码头容器中测试了它,但只在MS Word 2016中进行了测试)。第二个问题--它能以某种方式解决吗?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2022-04-14 10:28:11

您可以定义要使用的边距(请参阅?rdocx_document参数page_margins):

代码语言:javascript
复制
---
date: "`r Sys.Date()`"
author: "Your Name"
title: "officedown template"
output: 
  officedown::rdocx_document:
    page_margins:
      bottom: .75
      top: .75
      right: 1
      left: 1
      header: 0.5
      footer: 0.5
      gutter: 0
---

Github问题已关闭,而是邀请用户开始讨论https://github.com/davidgohel/officedown/discussions

请参阅https://github.com/davidgohel/officedown#questions-and-issues

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/71869635

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档