我正在Rmarkdown中撰写论文,我需要在附录的开头生成附录表和图形的列表。我已经在下面的示例代码中手动输入了这样的列表。如何获得此列表以自动生成?另外,如何确保只将部分图形和表格标题用作表和图形列表中的标题?我猜想需要添加一些LaTeX标头,但我找不到正确的软件包。
---
title: "Nice title"
author: ""
output:
pdf_document:
number_sections: false
fig_crop: true
toc: false
keep_tex: false
header-includes:
- \usepackage{caption,booktabs,longtable,pdfpages,rotating,graphicx,footmisc,float}
- \captionsetup{width=5in}
- \setlength\parindent{24pt}
- \bibliographystyle{apsr}
fontsize: 11pt
references:
- id: fenner2012a
title: One-click science marketing
author:
- family: Fenner
given: Martin
container-title: Nature Materials
volume: 11
URL: 'http://dx.doi.org/10.1038/nmat3283'
DOI: 10.1038/nmat3283
issue: 4
publisher: Nature Publishing Group
page: 261-263
type: article-journal
issued:
year: 2012
month: 3
---
```{r echo=FALSE}
knitr::opts_chunk$set(echo = FALSE)
```
Main text here [@fenner2012a].
\newpage
# References {-}
<div id="refs"></div>
\newpage
# Appendix {-}
[THIS IS WHERE I WANT TO HAVE A LIST OF APPENDIX TABLES AND FIGURES. IT WOULD LOOK SOMETHING LIKE:]
Figures:
Figure A1: I would like this sentence only to appear in the list of figures. .... 1
Tables:
Table A1: I would like this sentence only to appear in the list of tables. .... 1
\setcounter{page}{0}
\pagenumbering{arabic}
\setcounter{page}{1}
\setcounter{figure}{0}
\setcounter{table}{0}
\renewcommand{\thefigure}{A\arabic{figure}}
\renewcommand{\thetable}{A\arabic{table}}
\newpage
```{r results='asis', fig.cap="I would like this sentence only to appear in the list of figures. Here is some other text to describe the figure that should not appear in the text giving the list of figures."}
p <- rnorm(100)
plot(p)
```
```{r results='asis'}
library(kableExtra)
q <- rnorm(5)
kable(q, caption = "I would like this sentence only to appear in the list of tables. Here is some other text to describe the figure that should not appear in the text giving the list of tables.")
```