首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >如何使用pagedown包模板在任何地方添加目录?

如何使用pagedown包模板在任何地方添加目录?
EN

Stack Overflow用户
提问于 2020-12-06 21:47:33
回答 1查看 115关注 0票数 0

我使用了pagedown包的论文模板中的代码。目录的默认位置在确认之后,在表格列表之前。我想把它加在文献综述部分之后。我怎么做这件事呢?

这是pagedown包的论文模板中的代码。你可以安装它: remotes::install_github('rstudio/pagedown')

代码语言:javascript
运行
复制
---
title: A paged html thesis template for R Markdown users
subtitle: A {pagedown} template.
author: 
  - name: William Brent Thorne
    edu: BSc
degree: Master of Documentation
institute: Typeset University
faculty: Reproducibility and FOSS
department: Templates
location: St. Catharines, ON 
date:
  - year: 2019
    month: August
sign_page: true
dedication: A dedication line or two goes here.
abstract: This is the abstract.
preface: A preface to the thesis.
acknowledge: Put the ackknowledgements here.
committee:
  - name: Jane Doe III
    prefix: Dr
    position: Chair of Department
  - name: John Smith
    prefix: Dr
    position: Faculty Advisor
lof: true
lot: true
toc-title: Contents
output:
  pagedown::thesis_paged: 
    toc: true
    number_sections: yes
    pandoc_args: --mathjax
    self_contained: no
bibliography: packages.bib
link-citations: yes
# uncomment this line to produce HTML and PDF in RStudio:
knit: pagedown::chrome_print
---

```{r setup, include=FALSE}

knitr::opts_chunk$set(echo =假,

代码语言:javascript
运行
复制
                  fig.align = 'center')
代码语言:javascript
运行
复制
# Literature Review {-}

This is where you can include a lit review if you don't wish for it to be an individual chapter or to be numbered. To make sure that a section heading is not numbered use the `{-}` notation beside the header text like this:

_**rmarkdown**_:

```markdown

文献综述{-}

如果你不希望它成为一个单独的章节或编号,你可以在这里加入一篇文学评论。要确保小节标题没有编号,请在标题文本旁边使用{-}表示法,如下所示:

代码语言:javascript
运行
复制
# The Basics {.chapter}

## Introduction

This template is based on the `pagedown::html_paged` template and modified to meet the requirements of a generic thesis document. Standard RMarkdown formatting can be used for smooth and distraction free writting, for example I will add a citation for the {knitr} package which is located in the `Thesis.bib` file auto-generated in this template [@R-knitr].

Thanks to the [help](https://github.com/rstudio/pagedown/issues/101) of [Romain Lesur](https://github.com/RLesur) this template has the ability to tag section headers with the word "Chapter ". To have your chapters display as this one (_Chapter 1 The Basics_) use the `{.chapter}` class like this:
EN

回答 1

Stack Overflow用户

发布于 2020-12-07 01:52:18

使用这个LINK,我能够在文献评论部分之后获得一个要呈现的目录。我相信你必须删除你的yaml头的table of contents部分。

这是我的内容.Rmd文件的目录

代码语言:javascript
运行
复制
---
output: html_document
---

# Table of contents
## literature review
## literature review

然后是您的代码和链接资源,我用它将其呈现在另一个.Rmd文件中

代码语言:javascript
运行
复制
---
title: A paged html thesis template for R Markdown users
subtitle: A {pagedown} template.
author: 
  - name: William Brent Thorne
    edu: BSc
degree: Master of Documentation
institute: Typeset University
faculty: Reproducibility and FOSS
department: Templates
location: St. Catharines, ON 
date:
  - year: 2019
    month: August
sign_page: true
dedication: A dedication line or two goes here.
abstract: This is the abstract.
preface: A preface to the thesis.
acknowledge: Put the ackknowledgements here.
committee:
  - name: Jane Doe III
    prefix: Dr
    position: Chair of Department
  - name: John Smith
    prefix: Dr
    position: Faculty Advisor
lof: true
lot: true
output:
  pagedown::thesis_paged: 
    toc: true
    number_sections: yes
    pandoc_args: --mathjax
    self_contained: no
link-citations: yes
---

```{r setup, include=FALSE}

knitr::opts_chunk$set(echo =假,

代码语言:javascript
运行
复制
                  fig.align = 'center')

devtools::source_gist("c83e078bf8c81b035e32c3fc0cf04ee8",

代码语言:javascript
运行
复制
                  filename = 'render_toc.R')
代码语言:javascript
运行
复制
# Literature Review {-}

This is where you can include a lit review if you don't wish for it to be an individual chapter or to be numbered. To make sure that a section heading is     not numbered use the `{-}` notation beside the header text like this:


```{r toc, echo=FALSE} 

render_toc("tableofcontent.Rmd")

代码语言:javascript
运行
复制
_**rmarkdown**_:


```markdown

文献综述{-}

如果你不希望它成为一个单独的章节或编号,你可以在这里加入一篇文学评论。要确保小节标题没有编号,请在标题文本旁边使用{-}表示法,如下所示:

代码语言:javascript
运行
复制
# The Basics {.chapter}

## Introduction

This template is based on the `pagedown::html_paged` template and modified to meet the requirements of a generic thesis document. Standard RMarkdown     formatting can be used for smooth and distraction free writting, for example I will add a citation for the {knitr} package which is located in the     `Thesis.bib` file auto-generated in this template [@R-knitr].

Thanks to the [help](https://github.com/rstudio/pagedown/issues/101) of [Romain Lesur](https://github.com/RLesur) this template has the ability to tag     section headers with the word "Chapter ". To have your chapters display as this one (_Chapter 1 The Basics_) use the `{.chapter}` class like this:    

但是您的格式非常具体,因此您必须对其进行更好的格式化,以适应您想要的输出。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/65168775

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档