officedown R包中的不等缩进

Unequal indentation in officedown R package

我正在使用 officedown 程序包生成 MS Word 文档。我注意到一个奇怪而烦人的问题。生成的输出左右两边缩进不等(见附图)

我使用的Rmarkdown代码:

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

No actual content

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

R 会话信息输出:

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 的奇怪行为吗(我在两台不同的机器和 docker 容器中测试过它,但仅限 MS Word 2016)?第二个问题 - 它能以某种方式修复吗?

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


---
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