crsh / papaja

papaja (Preparing APA Journal Articles) is an R package that provides document formats to produce complete APA manuscripts from RMarkdown-files (PDF and Word documents) and helper functions that facilitate reporting statistics, tables, and plots.
https://frederikaust.com/papaja_man/
Other
652 stars 133 forks source link

Full-fledged Word-support #486

Open crsh opened 2 years ago

crsh commented 2 years ago

As it currently stands, apa6_docx produces a decent document that is reasonably close to APA-style (with some manual labor involved), but it lacks several features available in PDF documents. It would be great to offer support for the most important ones. Since I first wrote the function there has been a lot of improvements on the pandoc-side and new R packages, such as officedown that could be leveraged to make apa6_word more powerful. I'll try to collect some of the things I would like to improve here for later reference.

For all of the below, we should do some research on officedown. I'd prefer to use native pandoc features and Lua-filters where possible, but this package adds a lot of functionality that may be indispensible or laborous to reimplement.

conig commented 2 years ago

This sounds great, I would also love the ability to make page layouts landscape for wide apa_tables in docx (related to point 7).

crsh commented 2 years ago

Indeed, thanks for mentioning this. It seems that this would require either an additional Lua-filter (also see here) or using the officedown package.

crsh commented 2 years ago

The Lua-filter list-table seems a promising alternative to power a cross-format apa_table()!

conig commented 2 years ago

Flagging that with pandoc 2.19 col/row spanners are supported via the grid table layout. Could help in getting the col_spanners argument to work with docx.

An example that should work out of the box in papaja::apa6_docx

rmarkdown::pandoc_version()
#> [1] '2.19'
: A table caption

+---------------+---------------+--------------------+
|               | col_spanner                        |
+               +---------------+--------------------+
|               | Var1          | Var2               |
+===============+:=============:+:==================:+
| Row 1         | 1.32          | 1.54               |
+---------------+---------------+--------------------+
| Row 2         | 2.89          | 3.21               |
+===============+===============+====================+
<div custom-style='Compact'>
*Note.* a note
</div>

image