Empty headings in table of contents when RMarkdown contains tabs? - r

When making an RMarkdown containing tabs, some extra (blank) items appear in the table of contents.
Example
This generates the html doc below
---
output:
html_document:
toc: true
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
# First Tabs {.tabset .tabset-fade .tabset-pills}
Text before tabs
## First tab
Content in first tab
## Second tab
Content in second tab
#
# here is another section
Some further content.
Everything is as expected, except there's a blank line in the TOC.
What I've tried
I tried replacing the # that ends the tabbed content with </div> as described here. This causes the TOC to populate correctly, but (strangely) causes the content after the tabs to left-align (no idea why)
For ease of reproducibility, here's the code and a screengrab of the resulting HTML
---
output:
html_document:
toc: true
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
# First Tabs {.tabset .tabset-fade .tabset-pills}
Text before tabs
## First tab
Content in first tab
## Second tab
Content in second tab
</div>
# here is another section
Some further content.

As written in the comment: Just remove the single #.
There is also a workaorund, if you have have the following problem
Use TOC
Use Tabs
End tabbed region with further text under the tabbed region
Problem: Normaly use ## to end tabbed region, but this would be another header in the TOC
Solution: ## {.unlisted .unnumbered} will remove the header from TOC.
Example:
---
output:
html_document:
toc: true
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
## title {.tabset .tabset-fade}
content above tabbed region.
### tab 1
tab content 1
### tab 2
tab content 2
## {.unlisted .unnumbered}
content below tabbed region

Related

How to make figure bigger than body column width in Quarto

According to the Quarto docs, the figure below should be screen-width but instead it is just positioned at the left-hand side of the screen. How can I make it bigger? Adding #| layout-ncol: 1 doesn't help either.
---
title: "Test"
format: html
---
```{r}
#| column: screen
plot(pressure)
```
The generated image is not big enough to fill the full screen. Try the out-width parameter to scale the image (docs). For best results, choose a vector-graphic format to ensure smooth scaling of the image.
```{r}
#| column: screen
#| out-width: 100%
#| fig-format: svg
plot(pressure)
```

R Flexdashboard: Navigation captions don't show up in hidden storyboard

I am building a Flexdashboard. On the start page there should be links leading to several hidden storyboard (i.e. so that the storyboards do not show up in the navigation bar at the top).
However, it appears that using {.hidden} on a storyboard page interferes with the navigation captions: only the first caption of three is visible: Screenshot
Using the arrows one can still access all three graphs but without the captions.
Does anybody know how to make hidden storyboard-pages work?
I am using R 4.2.0; Flexdashboard 0.5.2; RStudio 2022.02.1
Reproducible example:
---
title: "Untitled"
output:
flexdashboard::flex_dashboard:
orientation: columns
vertical_layout: fill
---
```{r setup, include=FALSE}
library(flexdashboard)
```
Start page
===========================================================
[Link](#storyboard)
Storyboard{.storyboard .hidden}
===========================================================
### Chart A
```{r}
boxplot(mtcars$mpg)
```
### Chart B
```{r}
boxplot(mtcars$cyl)
```
### Chart C
```{r}
boxplot(mtcars$hp)
```

R DT clips table selection buttons (when text is added to body)

Actual Behavior - Clipping
I'm using the R DT package with flexdashboard. When I add text to the body of a DT table, the bottom of the dashboard is clipped (to varying extents). See below.
---
title: "With text in the body the bottom is clipped"
output: flexdashboard::flex_dashboard
---
Notice at the bottom that "Showing X entries" and "Previous/Next" are both clipped
```{r}
library(DT)
datatable(mtcars)
```
Expected Behavior - No Clipping
If I remove the text from the body of my table everything behaves as expected. But I want my body text ¯_(ツ)_/¯. What to do?
Is this a bug I should report, or is there another solution I'm unaware of?
---
title: "Without text in the body nothing is clipped"
output: flexdashboard::flex_dashboard
---
```{r}
library(DT)
datatable(mtcars)
```
Version Info:
other attached packages:
[1] DT_0.16 flexdashboard_0.5.2
used this link for intel just adding ### in the chart, helped align the table with Flexdashboard margins
---
title: "With text in the body the bottom is clipped"
output: flexdashboard::flex_dashboard
---
Notice at the bottom that "Showing X entries" and "Previous/Next" are both clipped
###
```{r }
library(DT)
datatable(mtcars)
```

R Markdown: Responsive image with link

I'm working with R Markdown in a dashboard containing several tabs. In some of those tabs I want to display only an image with a link to a webpage. I managed to do this with this code:
---
title: "MyDashboard"
output:
flexdashboard::flex_dashboard:
orientation: rows
vertical_layout: fill
logo: Logo.png
favicon: Favicon.png
---
```{r setup, include=FALSE}
library(flexdashboard)
```
Row {data-height=350}
-------------------------------------
### THIS TAB CONTAINS NORMAL CONTENT
```{r}
plot(example)
```
Row {data-height=650}
-------------------------------------
### THIS TAB CONTAINS AN IMAGE WITH LINK
```{r}
```
[<img src="image.png" style="width:100%; height=100%">](https://webpage.com/)
This displays the image with the link as expected, but when knitted, the image doesn't adjust to the tab's size and depending on the browser I use, vertical and horizontal scrollbars appear.
I would need to fit the image inside the limits of the tab in every browser I use, but all I tried until now failed.
Any help would be appreciated.

TOC summary in the header of each slide

There is the list of possible R-Markdown templates for beamer_presentation in R-Markdown.
And most of them include a kind of a "Navigation bar" at the top (or left/right) of each slide, like that:
While I do understand how to create a TOC in R-Markdown (by providing a toc: true in the header, I cannot figure out how to add this navigation to each slide.
I also understand how to create a floating TOC for the R-Markdown for HTML format (via toc_float: true as it is described here) but still cannot figure out how to make it in a beamer format. Any hint will be appreciated.
The headline with the navigation bar is automatically inserted in every frame if you use a suitable beamer theme. The one you show in your questions is called Antibes
---
title: test title
output:
beamer_presentation:
theme: "Antibes"
header-includes:
- \usepackage{tikzlings}
---
# Section name
## Subsection name
### Slide 1
\begin{tikzpicture}
\pig[scale=2]
\end{tikzpicture}

Resources