Open
Description
When fig.show = "hold"
is used for multiple plots, figure counting result is different between html_document2
and word_document2
.
Word output adds each count per sub figure whereas html only counts main plot.
Reprex
Test Rmd File
- Create "test.Rmd" file:
---
output:
bookdown::word_document2: default
bookdown::html_document2: default
---
```{r, echo = FALSE, fig.cap = "First figure."}
plot(1:5, 1:5)
```
```{r, echo = FALSE, fig.show = "hold", out.width = "50%", fig.cap = "Second figure."}
plot(1:5, 1:5)
cat("\n\n")
boxplot(dist ~ speed, data = cars)
```
```{r, echo = FALSE, fig.cap = "Third figure."}
plot(1:5, 1:5)
```
- Render the file:
rmarkdown::render("test.Rmd", output_format = "all")
Rendering Results
Session Info
rmarkdown::pandoc_version()
#> [1] '2.10.1'
xfun::session_info("bookdown")
#> R version 4.0.3 (2020-10-10)
#> Platform: x86_64-w64-mingw32/x64 (64-bit)
#> Running under: Windows 10 x64 (build 19042)
#>
#> Locale:
#> LC_COLLATE=English_United States.1252
#> LC_CTYPE=English_United States.1252
#> LC_MONETARY=English_United States.1252
#> LC_NUMERIC=C
#> LC_TIME=English_United States.1252
#> system code page: 65001
#>
#> Package version:
#> base64enc_0.1.3 bookdown_0.21.4 digest_0.6.27
#> evaluate_0.14 glue_1.4.2 graphics_4.0.3
#> grDevices_4.0.3 highr_0.8 htmltools_0.5.0.9002
#> jsonlite_1.7.1 knitr_1.30.2 magrittr_1.5
#> markdown_1.1 methods_4.0.3 mime_0.9
#> rlang_0.4.8 rmarkdown_2.5.3 stats_4.0.3
#> stringi_1.5.3 stringr_1.4.0 tinytex_0.27.1
#> tools_4.0.3 utils_4.0.3 xfun_0.19.3
#> yaml_2.2.1
Created on 2020-11-08 by the reprex package (v0.3.0.9001)