如何解决如何在使用 toc_float 和列时修复 RMD 文件中重复的 TOC
我通过github做了一个Rmd网站。对于一个 html 页面,我有一个带有浮动 TOC(目录)的 rknit 设置,每个内容都滚动到页面的下部,并带有内容详细信息。详细信息是书面说明和图像。但是,自从我添加以下内容来制作 div 列并将图像放在文本的右侧或左侧后,TOC 就会重复:
<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,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,Rachel N. Arney,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,这个问题就不会发生,因为它会列出每个项目的顶部链接以获取目录,但不会复制目录。
您能帮我弄清楚添加 div 列后出了什么问题吗?
注意:当我构建网站并查看它以及 HTML 文件本身和网站时,我在 Rstudio 中遇到了重复的 TOC 问题。这与提出但未解决的以下问题(最相似的问题)略有不同,其中仅在某些步骤中看到复制的 TOC:Rmarkdown - Duplicated TOC (Table of content)
解决方法
容易修复。您只需要关闭所有 firebase deploy --only hosting:prod
元素:
<div class="row">
<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
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。