【问题标题】:How to fix duplicated TOC in RMD file while using toc_float and columns如何在使用 toc_float 和列时修复 RMD 文件中重复的 TOC
【发布时间】:2021-09-08 12:09:34
【问题描述】:

我通过 github 做了一个 Rmd 网站。对于一个 html 页面,我有一个带有浮动 TOC(目录)的 rknit 设置,并且每个内容都滚动到页面的下部,其中包含内容详细信息。详细信息是书面描述和图像。但是,自从我添加以下内容来制作 div 列并将图像放在文本的右侧或左侧之后,目录就会重复:

<div class="row" style="padding-top: 30px;">
<div class="col-sm-6">

在网页上查看目录:https://cymfroehlich.github.io/projects.html

这里是完整的代码:

    ---
title: "RESEARCH PROJECTS"
output:
  html_document:
    toc: true
    toc_float: true
    collapsed: false
    number_sections: false
    toc_depth: 1
    #code_folding: hide
---

![](images/slide3s.png)

```{r setup, include=FALSE}
knitr::opts_chunk$set(message=FALSE,warning=FALSE, cache=TRUE)
```

# Linking Animal Behaviour, Mutualisms and Environmental Change

<div class="row" style="padding-top: 30px;">
<div class="col-sm-6">

As environmental disturbances become more intense and frequent, there are many changes that have been documented at population levels and ecosystem levels. We have yet to uncover how such disturbances affect the behaviour of animals, which is critical for the maintenance of many populations and could prove detrimental to particular species or even groups of species. Importantly, many animal relationships exist among different organisms, and mutualistic relationships are key for the maintenance of several ecosystems. Accordingly, changes to animal behaviours and ecological relationships may have flow-on effects on ecosystems. For my research, I aim to delve deeper into the potential environmental consequences on animal behaviour for mutualistic organisms. I use a combination of observational, manipulative, and phylogenetic approaches to link animal behaviour and environmental change for coral-dwelling gobies, which live exclusively in some of the corals most susceptible to coral damage and death from cyclones and bleaching-induced heatwaves.

Collaborators: Marian Y.L. Wong, O. Selma Klanten, Siobhan J. Heatwole, Martin L. Hing, Mark Dowton


</div>
<div class="col-sm-6">

<a href = "https://www.biorxiv.org/content/10.1101/2021.01.13.426488v1">
![](images/DNAExtract_TaggedGoby.jpg)

![](images/slide1s.png)
</a>
</div>

# Social Behaviour of Coral Reef Fishes

<div class="row" style="padding-top: 30px;">
<div class="col-sm-6">

<a href = "https://www.frontiersin.org/articles/10.3389/fmars.2021.665780/full"> ![](images/GobyAnemonefishMutualismSociality.jpg)
</a>


</div>
<div class="col-sm-6">

Animals often live in groups temporarily or permanently for a variety of ecological, social, and life history reasons. For several marine fishes, size hierarchies are established to maintain the peace in which the two biggest individuals breed and the rest control their growth and forgo reproduction to maintain group membership. I aim to uncover key evolutionary mechanisms for the maintenance of group membership and size hierarchies in such animals. Two fish groups that are of particular focus for my research are coral-dwelling gobies and anemonefishes.

Collaborators: Marian Y.L. Wong, O. Selma Klanten, Siobhan J. Heatwole, Martin L. Hing, Theresa Rueger, Peter M. Buston, Rebecca Branconi

</div>

# Fisheries Management and Animal Behaviour

<div class="row" style="padding-top: 30px;">
<div class="col-sm-6">

Over decades and centuries, fisheries have changed fish populations and we are only beginning to understand the degree of these impacts. Management agencies have used available monitoring data to attempt to remove overfishing stress for many taxa, yet many species are continuing to experience excessive fishing pressure. Many fish are exhibiting behavioural changes, size truncations and lower reproductive capacity from fishing pressure, which have detrimental consequences on population maintenance and conservation. Accordingly, my research aims to understand how fish movement, size and growth, and reproduction are affected by fisheries, and to provide suggestions to improve management of these fisheries. I have particular experience with red snapper, <i>Lutjanus campechanus</i>.

Collaborators: Richard J. Kline, Andres Garcia, Carlos E. Cintra-Buenrostro, Adam M. Lee, Ramiro Oquita, David W. Hicks, J. Dale Shively, J. Brooke Shipley

</div>
<div class="col-sm-6">

 ![](images/10014876_10152148903631794_1171996106372918196_o.jpg)
[Image by Seth Patterson](https://www.flickr.com/photos/spatterd/)

</div>

# Artificial Reef Research

<div class="row" style="padding-top: 30px;">
<div class="col-sm-6">

![](images/slide2s.png)
 ![](images/Culverts. picture taken by seth patterson.jpg)
[Image by Seth Patterson](https://www.flickr.com/photos/spatterd/)

</div>
<div class="col-sm-6">

Artificial reefs (i.e., man-made reefs) are critical habitat for many marine taxa that live in environments with limited natural habitat and/or degraded habitat. Although artificial reefs have been deployed or accidentally created (e.g. through shipwrecks) for decades and centuries, we have yet to understand the optimal arrangements and structural characteristics necessary for artificial reefs to mimic natural habitat. Accordingly, my research aims to identify optimal habitat characteristics and formations for the deployment of artificial reef habitat that effectively mimics natural habitat.

Collaborators: Richard J. Kline, Andres Garcia, Carlos E. Cintra-Buenrostro, Adam M. Lee, Rachel N. Arney, Ramiro Oquita, David W. Hicks


</div>


# Teamwork makes the dream work

None of this could be done without the helpful team of collaborators, colleagues, field assistants, boat captains, volunteers, reef station managers, local help, and our support system. Thank you everyone!

![](images/slide4s.png)

有趣的是,如果我删除 toc_float: true,则不会发生此问题,因为它会列出每个项目,并在顶部链接到 TOC,但不会复制 TOC。

您能帮我弄清楚添加 div 列后出了什么问题吗?

注意:当我构建网站并查看它以及 HTML 文件本身以及网站上时,我在 Rstudio 中反复出现 TOC 问题。这与仅在某些步骤中看到复制的 TOC 的后续问题(最相似的问题)略有不同:Rmarkdown - Duplicated TOC (Table of content)

【问题讨论】:

    标签: html web r-markdown multiple-columns tableofcontents


    【解决方案1】:

    轻松修复。你只需要关闭所有&lt;div class="row"&gt; 元素:

    <div class="row" style="padding-top: 30px;">
      <div class="col-sm-6">
      Content...
      </div>
    
      <div class="col-sm-6">
      Content...
      </div>
    </div>    <--- missing closing </div> tag
    
    ---
    title: "RESEARCH PROJECTS"
    output:
      html_document:
        toc: true
        toc_float: true
        collapsed: false
        number_sections: false
        toc_depth: 1
        #code_folding: hide
    ---
    
    ```{r setup, include=FALSE}
    knitr::opts_chunk$set(message=FALSE,warning=FALSE, cache=TRUE)
    ```
    
    ![](images/slide3s.png)
    
    # Linking Animal Behaviour, Mutualisms and Environmental Change
    
    <div class="row" style="padding-top: 30px;">
      <div class="col-sm-6">
    As environmental disturbances become more intense and frequent, there are many changes that have been documented at population levels and ecosystem levels. We have yet to uncover how such disturbances affect the behaviour of animals, which is critical for the maintenance of many populations and could prove detrimental to particular species or even groups of species. Importantly, many animal relationships exist among different organisms, and mutualistic relationships are key for the maintenance of several ecosystems. Accordingly, changes to animal behaviours and ecological relationships may have flow-on effects on ecosystems. For my research, I aim to delve deeper into the potential environmental consequences on animal behaviour for mutualistic organisms. I use a combination of observational, manipulative, and phylogenetic approaches to link animal behaviour and environmental change for coral-dwelling gobies, which live exclusively in some of the corals most susceptible to coral damage and death from cyclones and bleaching-induced heatwaves.
    
    Collaborators: Marian Y.L. Wong, O. Selma Klanten, Siobhan J. Heatwole, Martin L. Hing, Mark Dowton
      </div>
    
    <div class="col-sm-6">
    <a href = "https://www.biorxiv.org/content/10.1101/2021.01.13.426488v1">
    ![](images/DNAExtract_TaggedGoby.jpg)
    ![](images/slide1s.png)
    </a>
      </div>
    </div>
    
    # Social Behaviour of Coral Reef Fishes
    
    <div class="row" style="padding-top: 30px;">
      <div class="col-sm-6">
    <a href = "https://www.frontiersin.org/articles/10.3389/fmars.2021.665780/full"> 
    ![](images/GobyAnemonefishMutualismSociality.jpg)
    </a>
      </div>
    
      <div class="col-sm-6">
    Animals often live in groups temporarily or permanently for a variety of ecological, social, and life history reasons. For several marine fishes, size hierarchies are established to maintain the peace in which the two biggest individuals breed and the rest control their growth and forgo reproduction to maintain group membership. I aim to uncover key evolutionary mechanisms for the maintenance of group membership and size hierarchies in such animals. Two fish groups that are of particular focus for my research are coral-dwelling gobies and anemonefishes.
    
    Collaborators: Marian Y.L. Wong, O. Selma Klanten, Siobhan J. Heatwole, Martin L. Hing, Theresa Rueger, Peter M. Buston, Rebecca Branconi
      </div>
    </div>
    
    # Fisheries Management and Animal Behaviour
    
    <div class="row" style="padding-top: 30px;">
      <div class="col-sm-6">
    Over decades and centuries, fisheries have changed fish populations and we are only beginning to understand the degree of these impacts. Management agencies have used available monitoring data to attempt to remove overfishing stress for many taxa, yet many species are continuing to experience excessive fishing pressure. Many fish are exhibiting behavioural changes, size truncations and lower reproductive capacity from fishing pressure, which have detrimental consequences on population maintenance and conservation. Accordingly, my research aims to understand how fish movement, size and growth, and reproduction are affected by fisheries, and to provide suggestions to improve management of these fisheries. I have particular experience with red snapper, <i>Lutjanus campechanus</i>.
    
    Collaborators: Richard J. Kline, Andres Garcia, Carlos E. Cintra-Buenrostro, Adam M. Lee, Ramiro Oquita, David W. Hicks, J. Dale Shively, J. Brooke Shipley
      </div>
    
      <div class="col-sm-6">
    ![](images/10014876_10152148903631794_1171996106372918196_o.jpg)
    [Image by Seth Patterson](https://www.flickr.com/photos/spatterd/)
      </div>
    </div>
    
    # Artificial Reef Research
    
    <div class="row" style="padding-top: 30px;">
      <div class="col-sm-6">
    ![](images/slide2s.png)
    ![](images/Culverts. picture taken by seth patterson.jpg)
    [Image by Seth Patterson](https://www.flickr.com/photos/spatterd/)
      </div>
    
      <div class="col-sm-6">
    Artificial reefs (i.e., man-made reefs) are critical habitat for many marine taxa that live in environments with limited natural habitat and/or degraded habitat. Although artificial reefs have been deployed or accidentally created (e.g. through shipwrecks) for decades and centuries, we have yet to understand the optimal arrangements and structural characteristics necessary for artificial reefs to mimic natural habitat. Accordingly, my research aims to identify optimal habitat characteristics and formations for the deployment of artificial reef habitat that effectively mimics natural habitat.
    
    Collaborators: Richard J. Kline, Andres Garcia, Carlos E. Cintra-Buenrostro, Adam M. Lee, Rachel N. Arney, Ramiro Oquita, David W. Hicks
      </div>
    </div>
    
    
    # Teamwork makes the dream work
    
    None of this could be done without the helpful team of collaborators, colleagues, field assistants, boat captains, volunteers, reef station managers, local help, and our support system. Thank you everyone!
    
    ![](images/slide4s.png)
    

    输出:

    【讨论】:

    • 太棒了,感谢您指出这一点。完全有道理。现已修复。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2019-08-21
    • 1970-01-01
    • 2022-01-22
    • 1970-01-01
    • 2016-06-21
    • 1970-01-01
    • 2017-06-05
    相关资源
    最近更新 更多