如何使用 R markdown 和 bookdown 将图表列表和 table 列表添加到内容的 table

How to add list of figures and list of tables to the table of content with R markdown and bookdown

我有一份报告(pdf 输出),我想在附录中添加参考书目、图表列表和 table 列表。我希望这三个元素出现在 table 内容中。

我通过将 bibliography: bibliography.bib 添加到我的 yaml header 来添加 参考书目 。图的列表和table的列表是我直接用LaTex加的。

因此我的阑尾看起来像:

# Literature {-}

\listoffigures

\listoftables

有效:参考书目、图表列表和 table 列表正确呈现。

唯一的问题是,table 的内容只显示条目 文学。图列表和 table 列表未出现。

我该如何解决这个问题?


我在 yaml header 的不同地方尝试了 lof: yeslot: yes(来自 here 的想法以及 toc_appendix: yes(来自同一来源)

我错过了什么?


我完整的 header 看起来像:

---
title: something
header-includes: \usepackage{graphicx} \usepackage{float} \usepackage{xcolor} \usepackage{framed} \usepackage{longtable} \definecolor{shadecolor}{RGB}{240,240,240} \pagenumbering{roman} \usepackage{caption} \captionsetup{font=footnotesize}
output:
  bookdown::pdf_book:
    fig_caption: yes
    highlight: kate
    number_sections: yes
    toc: yes
date: | 
    |  
    | `r format(Sys.time(), '%B %d, %Y')`
documentclass: report
geometry: margin=1in
fontfamily: mathpazo
fontsize: 11pt
bibliography: bibliography.bib
preamble: |
  % Any extra latex you need in the preamble
---

问题出在文档 class 报告上。我猜它不像文章 class 那样处理 table 列表或数字列表。

一个简单的解决方案是将 \usepackage[nottoc]{tocbibind} 添加到您的文档中。该软件包完全符合您的要求 - 它将两个附录部分添加到您的 table 内容中。您仍然需要使用 \listoffigures\listoftables.

在文档末尾手动添加它们