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
657 stars 133 forks source link

Tables not numbered when knitting to word #594

Closed mariusbarth closed 1 month ago

mariusbarth commented 2 months ago

Describe the bug When knitting to apa6_docx, tables are not numbered, see screenshot: Bildschirmfoto vom 2024-09-24 12-08-54

To Reproduce Add the following lines to the papaja template:

```{r npk-data}
apa_table(head(npk), caption = "The npk data set.")
```

Table\ \@ref(tab:npk-data) contains the npk data set.

Expected behavior I would have expected "Table 1" as table header.

Additional context


> installed.packages()[c("rmarkdown", "bookdown", "knitr"), "Version", drop = F]
          Version
rmarkdown "2.28" 
bookdown  "0.40" 
knitr     "1.48" 
> R.version.string
[1] "R version 4.4.1 (2024-06-14)"
> rmarkdown::pandoc_version()
[1] ‘3.1.11’
``
crsh commented 2 months ago

Thanks for reporting. Indeed, this is related to a change in the AST on the pandoc side. I already have fix for this on a local branch that I need to polish. I'll try to get this done by next week.

mariusbarth commented 2 months ago

This might be a separate issue, but maybe this is also related to the changes in the AST that you mentioned: Cross references to appendices (and also to figures and tables in appendices) are also incorrect when knitting to word, with cross references reading "Appendix 1", etc instead of "Appendix A" and "Table 11" instead of "Table A1"

crsh commented 2 months ago

I have just opened a PR with a fix for this. The separate numbering of figures and tables in the abstract is, I'm afraid, an entirely different problem. Could you open new issue for this?