rstudio / rmarkdown-cookbook

R Markdown Cookbook. A range of tips and tricks to make better use of R Markdown.
https://bookdown.org/yihui/rmarkdown-cookbook/
578 stars 224 forks source link

Tables caption in Appendix A and Appendix B #406

Open Nico-Rojas opened 2 months ago

Nico-Rojas commented 2 months ago

Hi,

First of all, thank you so much for your terrific work.

The issue: In the cookbook references example here there is a super useful way of separating References from two Appendices, Appendix A and Appendix B.

Titles work great, but if one adds tables in the appendix the coding keeps naming tables from Appendix A.

I added the simplest example below, building on the bookdown.org example.

# References

<div id="refs"></div>

# (APPENDIX) Appendix {-} 

# More information
```{r}
t1 <- c(1,2,3)
kable(t1, caption = "This table is Table A1", format = "latex") 
This will be Appendix A.

# One more thing

This will be Appendix B
```{r}
t2 <- c(1,2,3)
kable(t2, caption = "This table is Table A2 and I want it to be Table B1", format = "latex")