Rmarkdown - Duplicated TOC (Table of content) - r

Hello StackOverflow community,
When creating an Rmarkdown document all goes fine and table of content appears as intended.
TOC Correct:
When I open the HTML in my browser from Rstudio to my browser it does as well appear correctly.
The issue happens when I save that HTML and open it later on or send it to somebody, the TOC would then appear duplicated.
TOC with duplicated items:
Below is the code used regarding the toc in my .rmd file.
output:
html_document:
toc: true
toc_float : true
Would you know what I am doing wrong or might be missing. Thanks in advance for any feedback!

Related

R markdown landscape-only word document

I am trying to knit an .Rmd file to a word document that is entirely in landscape format.
Based on this post, I have tried using a reference doc. I created a Word document, changed the layout to landscape and saved it in the same folder as the .Rmd. However, this doesn't seem to work for me. Maybe I am missing something and saving a file in landscape format is not enough?
Previously, I was using the HTML comments/tags <!---BLOCK_LANDSCAPE_START---> and <!---BLOCK_LANDSCAPE_STOP---> from {officedown}, but since those can only be placed before and after code chunks, the title of the document would end up on a separate page that is portrait. Also, it gives a last page that is blank and portrait and that I don't know how to get rid of.
The current YAML header looks as follows:
---
title: "Summary Report"
output:
officedown::rdocx_document:
reference_docx: landscape_template.docx
---
I am also sure that the reference file is used because I get a warning in the console about not having set a Figure style:
Warning message:
paragraph style for plots "Figure" has not been found in the reference_docx document. Style 'Normal' will be used instead.
Does anyone have any suggestions on what I am missing?
After reaching out to the developer of {officedown} on GitHub, here is the very simple solution to the problem:
YAML header of .Rmd file:
---
output:
officedown::rdocx_document:
page_size:
orient: "landscape"
---

Rmd: Make the figure larger when clicked on it

I have a Rmarkdown file where I include figures with
knitr::include_graphics
The figures show up in the knitted document nicely. However, when I'm reading the knitted document, if I want to focus on one figure, I use the zoom option of the browser, which is not ideal.
Is it possible to add open the figure in a larger window when clicked on it?
PS: I use gitbook and/or bookdown::html for the output format of my Rmd files.
You can try out the themes from rmdformats package which implement this feature. They call it lightbox. To enable,you just need to set lightbox to true in the RMD yaml.
Example:
---
title: "My document"
output:
rmdformats::downcute:
lightbox: true
---

Hashtag appears in R Markdown html [duplicate]

Well, I've been working with Markdown for a year and today, suddenly, next to the headings an a tag has been automatically added.
Someone would know why these anchors have been generated automatically and how I could remove them?
Pd: one way to solve it is with h1,h2, etc., but then with the pdf output the index is eliminated, so it would not really solve the problem.
This is a new feature in rmarkdown 2.5.
You can change this in your YAML header at the top of your rmd file:
html_document:
anchor_sections: false

IN R MARKDOWN, How Can I add a background image (HTML output)?

I'm trying to put an image as background for my R markdown document (HTML output) Instead of the black background. I Was searching everywhere in the documentation on how to do this but I can't seem to find any answer as it's my first time working with R Markdown.
I can't seem to know how to put the background image and how to divide it that way so I can have my content in the middle
I'm also trying to attach a Hyperlink to tablist option,in the Picture2 as you can see "Source" as for when I click on it, it directs me to an external page
but ## [Source] ("github.com/example") isn't working which was the syntax in the documentation.
this is my code till now ..
I hope you can help me with these two questions,
it's again : - How to set a background image to an HTML output on the whole page like the black background
and how can I make the click on " Source " or TabItem directs me to an external link?
Thank you
---
title: "Title"
author: "Nessy"
date: "2 3 2020"
output:
rmarkdown::html_document:
theme: lumen
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
# {.tabset .tabset-fade}
## Analysis
## Source
Just posting the answers here so it can be marked as "answered." (Kindly mark this as answer when you're done and if this satisfies you).
1) Regarding background theme check this out: https://rpubs.com/thaufas/555157
2) Try [github](someurl) with no space in between. EDIT:
Regarding opening the link in markdown there try these links R Markdown - Hyperlink outside Rmd file or Linking to url with rmarkdown using Knit Word in Rstudio.

outline/toc on the left and contents on the right layout using rmarkdown

I was checking out how to include a nice table of contents / document outline in my rmarkdown document (with html output).
Well, the "standard" approach:
html_document:
toc: true
It works, but I do not like it (not even tweaking options and themes).
But actually, in several pages of the documentation (e.g. http://rmarkdown.rstudio.com/html_document_format.html), they use a very nice layout that includes a table of contents / document outline to the left of the page and the contents of the right (and the outline syncs with the contents part, Highlighting where on the contents you currenly are).
This is EXACTLY what I want. And I guess they did it using rmarkdown. But I cannot find how to do it.
I've check that documentation page, as well as rmarkdown gallery, flex dashboard, web sites among others. But I can't seem to figure it out how to do it.
Well, using web sites I would be able to do it, but it seems overly complicated for what I want (you need to have several pages, and at least index.Rmd file and the _site.yml file).
Instead, I guess there should be an option to simply tell rmarkdown to take my single document and put the section headers in a nice frame to the left, as in the example page from RStudio.
Have you tried this approach? It works for me and it's also on the homepage, you provided:
---
title: "Untitled"
output:
html_document:
toc: true
toc_float: true
---
# header 1
# header 2
# header 3
With a little bit of text, it looks like that:

Resources