如何使用R减价和记账方式将图形列表和表格列表添加到目录中 [英] How to add list of figures and list of tables to the table of content with R markdown and bookdown

查看:37
本文介绍了如何使用R减价和记账方式将图形列表和表格列表添加到目录中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个报告(pdf输出),我想在其中添加书目,图形列表和表格列表.我希望这三个元素出现在目录中.

I have a report (pdf output) where I want to add bibliography, list of figures and list of tables to the appendix. And I want those three elements to appear in the table of content.

我通过在我的Yaml标头中添加 bibliography:bibliography.bib 来添加 bibliography .我直接用LaTex添加的图形列表和表格列表.

I add the bibliography by adding bibliography: bibliography.bib to my yaml header. The list of figures and the list of tables I add with LaTex directly.

因此我的附录看起来像:

My appendix therefore looks like:

# Literature {-}

\listoffigures

\listoftables

几乎的工作原理:书目,图形列表和表格列表正确呈现.

This nearly works: bibliography, list of figures and list of tables are rendered correctly.

唯一的问题是,目录仅显示条目文献.没有出现图形列表和表格列表.

The only problem is, the table of content does only show an entry Literature. The list of figures and list of tables does not appear.

我该如何解决?

我在Yaml标头的各个位置尝试了 lof:是 lot:是(来自

I tried with lof: yes and lot: yes in various places of the yaml header (idea from here as well as with toc_appendix: yes (from the same source)

我想念什么?

我完整的标题如下:

---
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
---

推荐答案

问题出在文档类报告中.我猜想它不像article类那样处理表格列表或图形列表.

The problem lies with the document class report. I guess that it does not handle the list of tables or list of figures like the article class does.

一个简单的解决方案是将 \ usepackage [nottoc] {tocbibind} 添加到您的文档中.该软件包完全可以满足您的要求-将两个附录部分都添加到目录中.您仍然必须使用 \ listoffigures \ listoftables 在文档末尾手动添加它们.

A simple solution is to add \usepackage[nottoc]{tocbibind} to your document. The package does exactly what you want - it adds both appendix sections to your table of contents. You still have to manually add them at the end of your document using \listoffigures and \listoftables.

这篇关于如何使用R减价和记账方式将图形列表和表格列表添加到目录中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆