Closed jjanmaat closed 1 year ago
Can you provide a minimal reproducible example, please?
Hope it is just something simple I am doing wrong, or just don't understand.
`> sessionInfo() R version 4.2.2 (2022-10-31 ucrt) Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows 10 x64 (build 19045)
Matrix products: default
locale:
[1] LC_COLLATE=C LC_CTYPE=English_Canada.utf8 LC_MONETARY=C
[4] LC_NUMERIC=C LC_TIME=C
system code page: 65001
attached base packages: [1] parallel stats graphics grDevices utils datasets methods base
other attached packages:
[1] ggrepel_0.9.2 ggforce_0.4.1 cowplot_1.1.1 gridExtra_2.3 ggplot2_3.4.0
[6] foreach_1.5.2 rcompanion_2.4.18 huxtable_5.5.1 xtable_1.8-4 spdep_1.2-7
[11] sf_1.0-9 spData_2.2.1 sp_1.5-1 logitr_0.8.0 dplyr_1.0.10
[16] MASS_7.3-58.1
`
Minimal example:
--- title: "Demonstration" author: "John Janmaat" date: "
r Sys.Date()`"
output:
word_document:
bookdown::word_document2
html_document:
bookdown::html_document2knitr::opts_chunk$set(echo = TRUE)
library(huxtable)
ht <- huxtable(head(cars))
caption(ht) <- "First Table"
ht <- theme_article(ht)
ht
ht <- huxtable(tail(cars))
caption(ht) <- "Second Table"
ht <- theme_article(ht)
ht
ht <- huxtable(cars[sample(1:nrow(cars),6),])
caption(ht) <- "Third Table"
ht <- theme_article(ht)
ht
ht <- huxtable(cars[sample(1:nrow(cars),6),])
caption(ht) <- "Fourth Table"
ht <- theme_article(ht)
ht
Thank you. So here, all the tables have this problem. One more thing: what version of officer are you using?
And same question for flextable…
One other simple question: have you set the option huxtable.use_bookdown = TRUE
?
Hello
To answer your questions.
Adding
library(huxtable) options(huxtable.use_bookdown=TRUE) options(huxtable.bookdown=TRUE)
didn’t change anything for the test script. Had tried these with the original as well.
Office version is Microsoft Office Professional Plus 2019
flextable version is 0.8.3.
Thanks for looking into it.
John.
From: David Hugh-Jones @.> Sent: December 2, 2022 10:51 AM To: hughjonesd/huxtable @.> Cc: Janmaat, John @.>; Author @.> Subject: Re: [hughjonesd/huxtable] Huxtable -> bookdown -> word caption numbering problem (Issue #233)
[CAUTION: Non-UBC Email]
One other simple question: have you set the option huxtable.use_bookdown = TRUE?
— Reply to this email directly, view it on GitHubhttps://github.com/hughjonesd/huxtable/issues/233#issuecomment-1335675902, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AE7XDKMQBQQCCEMMGGYJGV3WLJAIRANCNFSM6AAAAAASREGBQE. You are receiving this because you authored the thread.Message ID: @.**@.>>
You can solve your problem by using labels without spaces in. Replace {r table 1, ...}
with {r table1, ...}
, etc. and the tables will be numbered as usual.
I think this is probably not a bug, because nothing in knitr says that it is legitimate to embed a space within the chunk label (https://yihui.org/knitr/options/). Indeed, that page says "Try to avoid spaces, periods (.), and underscores (_) in chunk labels and paths."
Hello David,
Thanks for responding. Guess I should read the documentation more carefully!
John.
From: David Hugh-Jones @.> Sent: December 7, 2022 3:45 AM To: hughjonesd/huxtable @.> Cc: Janmaat, John @.>; Author @.> Subject: Re: [hughjonesd/huxtable] Huxtable -> bookdown -> word caption numbering problem (Issue #233)
[CAUTION: Non-UBC Email]
You can solve your problem by using labels without spaces in. Replace {r table 1, ...} with {r table1, ...}, etc. and the tables will be numbered as usual.
I think this is probably not a bug, because nothing in knitr says that it is legitimate to embed a space within the chunk label (https://yihui.org/knitr/options/). Indeed, that page says "Try to avoid spaces, periods (.), and underscores (_) in chunk labels and paths."
— Reply to this email directly, view it on GitHubhttps://github.com/hughjonesd/huxtable/issues/233#issuecomment-1340848669, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AE7XDKPUUWFBBQWYOREDL3LWMB2CDANCNFSM6AAAAAASREGBQE. You are receiving this because you authored the thread.Message ID: @.**@.>>
Hello,
I have a Rmarkdown document with multiple tables and figures. Am using huxtable for the tables and bookdown::word_document2 in the knitr instructions.
I only get caption numbering for two of the tables and two of the figures. The remainder have numberings of the form (#tab:chunk_name) immediately before the caption. The two that are numbered are not the first two. Have tried adding blank lines, adding lines and text between chunks, etc. Nothing seems to change it.
Any suggestions?
Thanks.