papaja icon indicating copy to clipboard operation
papaja copied to clipboard

Full-fledged Word-support

Open crsh opened this issue 2 years ago • 4 comments

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.

  • [ ] Make use of available reference styles, e.g. captions, and define custom styles, where necessary.
  • [ ] Use caption bookmarks
  • [ ] Consider using the native_numbering extension
  • [ ] Explore using gt, flextable, huxtable, and kableExtra as a backend to extend the functionality of apa_table() (https://github.com/crsh/papaja/issues/466)
  • [ ] Explore postprocessing of docx-file to enable line numbering
  • [ ] Can we use manual reference section placement to simplify the inclusion of appendices and the associated post-processing?
  • [ ] Experiment with a Lua-filter to move tables and figures to the back of the manuscript. This is low priority as APA 7th edition no longer requires this.
  • [ ] Experiment with Lua-filters to support figurelist etc.

crsh avatar Nov 02 '21 16:11 crsh

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

conig avatar Feb 25 '22 05:02 conig

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 avatar Feb 25 '22 15:02 crsh

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

crsh avatar Apr 25 '22 09:04 crsh

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

conig avatar Aug 11 '22 03:08 conig