I want to change the apperance of my dropdown tabset in R Markdown. For example, I want my dropdown to expand on hover and change the overall apperance of the box. Furthermore I want to change font, color, and text-alignment within the dropdown. I have tried a lot of different methods in my .css file without any success. See code and picture below.
This is the dropdown I want to customize
---
output:
html_document:
theme: paper
highlight: tango
number_sections: false
toc: false
toc_float: false
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
## Title {.tabset .tabset-fade .tabset-pills}
### Subject1 {.tabset .tabset-dropdown}
#### How can i customize this?
#### How can i customize this?
### Subject2 {.tabset .tabset-dropdown}
#### How can i customize this?
#### How can i customize this?
You need to add styles.css in your r code at the top, and also as a new file in your folder.
R Code
---
output:
html_document:
theme: paper
highlight: tango
number_sections: false
toc: false
toc_float: false
css: styles.css
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
## Title {.tabset .tabset-fade .tabset-pills}
### Subject1 {.tabset .tabset-dropdown}
#### How can i customize this?
#### How can i customize this?
### Subject2 {.tabset .tabset-dropdown}
#### How can i customize this?
#### How can i customize this?
CSS code (styles.css):
.nav-tabs > li.active:nth-child(1) > a {
background-color: #E8C120;
}
.nav-tabs > li > a {
background-color: #5882A6;
color: red;
}
OUTPUT:
Related
I have navbar like this.
CSS code is
.navbar {
background-color:yellow;
border-color:black;
}
How I can change that blue thing with tells active page?
EDIT:
I have rmarkdown file and that css-file is myfile.css
---
title: "Title"
output:
flexdashboard::flex_dashboard:
orientation: columns
vertical_layout: fill
css: mystyle.css
---
```{r setup, include=FALSE}
library(flexdashboard)
```
Plots
=====================================
Column {data-width=650}
-----------------------------------------------------------------------
Column {data-width=350}
-----------------------------------------------------------------------
Table
=====================================
Heatmap
=====================================
The active page probably has a class with "active" or "active-page". If so, you can style the class for example:
.active {
background-color: red;
}
I'm running RStudio Version 1.2.1335 and am having difficulty knitting an R markdown file to HTML. I don't know what this error message means or what a solution might be. I/ve gone through and run each chunk to ensure there are no coding errors. I was unable to find a similar problem/question online. Thanks for any help!
Here is an example start to my markdown file:
---
title: "Linking environmental contaminants with hepatic and biliary disease in White perch from Choptank and Severn Rivers"
author:
- Mark Matsche
- Cooperative Oxford Laboratory
- mark.matsche#maryland.gov
date: '`r Sys.Date()`'
output:
html_document:
df_print: paged
fig_caption: yes
theme: united
toc: yes
toc_float: yes
indent: yes
header-includes: \setlength\parindent{24pt}
---
<style type="text/css">
body, td {
font-size: 12pt;
}
code.r{
font-size: 16pt;
}
pre {
font-size: 16pt
}
caption {
color: black;
font-weight: bold;
font-size: 1.0em;
}
</style>
```{r setup, include = FALSE}
options(knitr.table.format = "html")
knitr::opts_chunk$set(echo = TRUE)
```
```{r echo=FALSE, include= FALSE, message= FALSE, warning= FALSE}
# This function will load packages.
library(tidyverse)
library(readxl)
library(kableExtra)
library(knitr)
library(ggplot2)
library(png)
library(tinytex)
library(scales)
library(grid)
library(svglite) # needed to save vector graphics
library(broom)
library(lemon)
#library(plyr)
#library(rms)
#library(GGally)
#library(car) #need for calculating vifs
#library(leaps) #stepwise regression
#library(DAAG) #need for doing cross validation
#library(rms) #check structural form
#library(ROCR) #compute sensitivity and specificity
```
```{r readxl, echo=FALSE}
Alldata<-read_excel("Data12Aug.xlsx")
```
I am trying to modify some of the styles with CSS for a tabset in flexdashboard. Here's an example of an RMarkdown file.
---
title: "Title"
output:
flexdashboard::flex_dashboard
---
Section
===========================================================
Column {.tabset .tabset-fade}
-----------------------------------------------------------------------
### tab1
text1
### tab2
text2
I want to change the color of the top of the active tab from blue to something else.
The closest I can get is changing the color of all tabs and not the top.
---
title: "Title"
output:
flexdashboard::flex_dashboard
---
<style>
.tabset {
background-color: #00806E;
}
</style>
Section
===========================================================
Column {.tabset .tabset-fade}
-----------------------------------------------------------------------
### tab1
text1
### tab2
text2
Try this:
<style>
.nav-tabs-custom > .nav-tabs > li.active {border-top-color: green}
</style>
I wonder if one could simply use LaTeX \newpage command in R markdown v2 in a different way than this:
```{r, results='asis', echo=FALSE}
cat("\\newpage")
```
I produce pdf_output.
If any1 has any idea please do not hesitate to comment :) !
Thanks
I create pdf like this:
---
title: " "
author: " "
date: "2014"
output:
pdf_document:
includes:
in_header: naglowek.tex
highlight: pygments
toc: true
toc_depth: 3
number_sections: true
keep_tex: true
---
Simply \newpage or \pagebreak will work, e.g.
hello world
\newpage
```{r, echo=FALSE}
1+1
```
\pagebreak
```{r, echo=FALSE}
plot(1:10)
```
This solution assumes you are knitting PDF. For HTML, you can achieve a similar effect by adding a tag <P style="page-break-before: always">. Note that you likely won't see a page break in your browser (HTMLs don't have pages per se), but the printing layout will have it.
In the initialization chunk I define a function
pagebreak <- function() {
if(knitr::is_latex_output())
return("\\newpage")
else
return('<div style="page-break-before: always;" />')
}
In the markdown part where I want to insert a page break, I type
`r pagebreak()`
You can make the pagebreak conditional on knitting to PDF. This worked for me.
```{r, results='asis', eval=(opts_knit$get('rmarkdown.pandoc.to') == 'latex')}
cat('\\pagebreak')
```
If you're having problems with \newpage or \pagebreak and floating figures/tables. You need to use \clearpage, as answered here.
I have the following RMarkdown FlexDashboard document:
---
title: "Some title"
runtime: shiny
output:
flexdashboard::flex_dashboard:
orientation: columns
vertical_layout: fill
---
```{r setup, include=FALSE}
library(flexdashboard)
```
Column {data-width=650}
-----------------------------------------------------------------------
### Some chart
```{r}
plot(faithful)
```
Column {data-width=650}
-----------------------------------------------------------------------
### Chart 2
```{r}
```
### Chart 3
```{r}
```
How can I put the footer that span across the page with the following content?
tags$div( HTML("<footer><small>© Copyright 2017, MyCompany Co.,Ltd</small></footer>"))
You can put the HTML of your footer in a footer.html file and include it after the body of your flexdashboard using after_body in your markdown:
---
title: "Some title"
runtime: shiny
output:
flexdashboard::flex_dashboard:
orientation: columns
vertical_layout: fill
includes:
after_body: footer.html
---
You can try this:
tags$footer( HTML("<footer><small><b>© Manoj Kumar 2021.</b></small></footer>"), align="left", style="position:absolute; bottom:0; width:95%; height:50px; color: #000000; padding: 0px; background-color: transparent; z-index: 1000;")