hughjonesd / huxtable

An R package to create styled tables in multiple output formats, with a friendly, modern interface.
http://hughjonesd.github.io/huxtable
Other
321 stars 28 forks source link

Cross-referencing for huxtables is not working in quarto for docx (Word document ) output format #229

Open shafayetShafee opened 2 years ago

shafayetShafee commented 2 years ago

Bug Description

Table cross-referencing is not working when using huxtable in quarto document for word document output format.

Minimal Reproducible Example

Here's a Minimal Reprex

---
title: "Untitled"
format: docx
---

## Table for word document in quarto

```{r}
library(huxtable)
```

```{r}
#| label: tbl-air1

mytab1 <- hux(head(airquality))
caption(mytab1)<- "My caption"
mytab1
```

- Table caption appears
- This reference @tbl-air1 doesn't work

```{r}
mytab2 <- hux(head(airquality))
caption(mytab2) <- "Second table caption"
label(mytab2) <- "tbl-air2"
mytab2
```

- Table caption appears
- This reference @tbl-air2 doesn't work

```{r}
#| label: tbl-air3
#| tbl-cap: "Third table caption"

mytab3 <- hux(head(airquality))
mytab3
```

- Table caption doesn't appear
- This reference @tbl-air3 doesn't work

Version Info

Package Version

packageVersion("huxtable")
#> [1] '5.5.0'
packageVersion("flextable")
#> [1] '0.7.3'
packageVersion("officer")
#> [1] '0.4.3'

Rstudio and Quarto Version

rstudioapi::versionInfo()

#>  $version
#>  [1] '2022.7.1.554'
#
# > $release_name
# > [1] "Spotted Wakerobin"

quarto::quarto_version()
#> [1] '1.0.38'

R version and System Info

version
#>                _                                
#> platform       x86_64-w64-mingw32               
#> arch           x86_64                           
#> os             mingw32                          
#> crt            ucrt                             
#> system         x86_64, mingw32                  
#> status                                          
#> major          4                                
#> minor          2.1                              
#> year           2022                             
#> month          06                               
#> day            23                               
#> svn rev        82513                            
#> language       R                                
#> version.string R version 4.2.1 (2022-06-23 ucrt)
#> nickname       Funny-Looking Kid
hughjonesd commented 2 years ago

This is possibly related to https://github.com/quarto-dev/quarto-cli/issues/1556

shafayetShafee commented 2 years ago

Yes have seen that too. I tried both huxtable and flextable and neither of them is working properly. So thought that I let you know.