I'm trying to align right author and put it before the title that is centered.
---
author: "Author name"
title: "Title name"
output: pdf_document
header-includes:
- \usepackage{titling}
- \preauthor{\begin{flushright}}
- \postauthor{\end{flushright}}
---
There is a } lacking at the end of - \preauthor{\begin{flushright}. In order to move the author up, you may use \vspace*{-1.5cm}.
Code:
---
author: "Author name"
title: "Title name"
output: pdf_document
header-includes:
- \usepackage{titling}
- \preauthor{\begin{flushright}\vspace*{-1.5cm}}
- \postauthor{\end{flushright}}
---
-output
Related
Hi I added background image for my title page but once I added the following in order to move my title to top and left, the background image was gone.
Is there any way to fix this issue?
titleSlideClass: [top, left]
---
title: "ECON"
subtitle: "Course Outline"
author: "Instructor"
institute: "University"
date: "`r Sys.Date()`"
output:
xaringan::moon_reader:
css: [default, metropolis, metropolis-fonts, "styles.css"]
lib_dir: libs
nature:
highlightStyle: arta
highlightLines: true
countIncrementalSlides: false
titleSlideClass: [top, left]
---
You may want to create your own title slide. To do that, as per the documentation
If you'd like to create your own title slide, disable xaringan's title slide with the seal = FALSE option of moon_reader.
So seal xaringan's default title slide and create your own slide using rmarkdown::metadata and control the title position using class: title-slide, top, left
---
title: "ECON"
subtitle: "Course Outline"
author: "Instructor"
institute: "University"
output:
xaringan::moon_reader:
css: [default, metropolis, metropolis-fonts, "styles.css"]
lib_dir: libs
seal: false
nature:
highlightStyle: arta
highlightLines: true
countIncrementalSlides: false
---
class: title-slide, top, left, inverse
background-image: url(lights.jpg)
background-size: cover
# **`r rmarkdown::metadata$title`**
## **`r rmarkdown::metadata$subtitle`**
### `r rmarkdown::metadata$author`
### `r rmarkdown::metadata$institute`
### `r Sys.Date()`
---
I was wondering if there is a simple way to do the change of font size, colour and style (bold, italic, etc.) for particular words or phrases in individual xaraingan slides within rmarkdown.
The following is my code:
---
title: "Econ"
subtitle: "Week 1"
author: "Instructor"
date: "`r Sys.Date()`"
output:
xaringan::moon_reader:
css: [default, metropolis, metropolis-fonts]
lib_dir: libs
nature:
highlightStyle: arta
highlightLines: true
countIncrementalSlides: false
---
# Is economics a science?
--
Probably not, maybe pseudo-science?.
I want to make "pseudo-science" bold, italicized, red, slightly bigger.
To style certain lines or phrases, you need to define your own content class (say .my-style) using CSS and wrap those lines or phrases with that content class (like .my-style[lines or phrases]) and define CSS rules for styles that you want to use in CSS file styles.css. Then attach that CSS file by specifying it in the YAML key css: along with other style files.
---
title: "Econ"
subtitle: "Week 1"
author: "Instructor"
date: "`r Sys.Date()`"
output:
xaringan::moon_reader:
css: [default, metropolis, metropolis-fonts, "styles.css"]
lib_dir: libs
nature:
highlightStyle: arta
highlightLines: true
countIncrementalSlides: false
---
# Is economics a science?
--
Probably not, maybe .my-style[pseudo-science]?.
styles.css
.my-style {
font-weight: bold;
font-style: italic;
font-size: 1.5em;
color: red;
}
For some reason, ![:scale 50%](image.jpg) does not work for me.
Any solution to fix this?
My yaml heading is the following:
---
title: "Econ"
subtitle: "Orientation and Lecture 1"
author: "Teacher"
institute: "University"
date: "`r Sys.Date()`"
output:
xaringan::moon_reader:
css: [default, metropolis, metropolis-fonts, "styles.css"]
lib_dir: libs
nature:
highlightStyle: arta
highlightLines: true
countIncrementalSlides: false
---
To scale an image in xaringan slides (in R-markdown), a safe option is using knitr::include_graphics along with chunk options.
```{r echo=FALSE, out.width="50%"}
knitr::include_graphics("test_animal.jpg")
```
Update
If you want to fill the entire slide with an image you can use background-image and background-size option in xaringan slides to do that.
---
title: "Econ"
subtitle: "Lecture 1"
author: "Instructor"
institute: "College"
date: "`r Sys.Date()`"
output:
xaringan::moon_reader:
css: [default, metropolis, metropolis-fonts, "styles.css"]
lib_dir: libs
nature:
highlightStyle: arta
highlightLines: true
countIncrementalSlides: false
---
---
background-image: url(test_animal.jpg)
background-size: cover
Does anyone know how to increase the width of a floating table of content in rmarkdown so that it can show all titles in one line with no break.
Here is an example:
---
title: "Title"
author: "Author "
date: '`r format(Sys.Date(), "%B %d, %Y")`'
output:
html_document:
toc_float: true
toc: true
number_sections: true
code_folding: show
theme: lumen
editor_options:
chunk_output_type: console
---
# A loooooooooooooooooooooooong title
Thanks
What did the trick for me was to change the CSS style of the floating TOC. You can use a CSS code chunk to embed the CSS rules directly in your Rmd document. For example, like this:
title: "XY"
author: "XX"
date: '`r format(Sys.Date(), "%B %d, %Y")`'
output:
html_document:
toc: true
theme: united
toc_depth: 4
toc_float: true
.tocify .tocify-header {
position: fixed;
top: 50px;
left: 50px;
width: 500px;
height: 200px;
}
Or you can include this in a custom stylesheet:
output:
html_document:
css: "style.css"
I was wondering wether it was possible to hide a element in shiny rmarkdown from the user and still get the reactive value.
---
title: "My Title"
author: "My Name"
date: "Today"
output:
rmdformats::html_clean:
highlight: kate
runtime: shiny
---
```{r knitr_init, echo=FALSE, cache=FALSE}
library(knitr)
library(rmdformats)
## Global options
options(max.print="75")
opts_chunk$set(echo=FALSE,
cache=TRUE,
prompt=FALSE,
tidy=TRUE,
comment=NA,
message=FALSE,
warning=FALSE)
opts_knit$set(width=75)
```
```{r setup, include=FALSE}
library(tidyverse)
library(shinyjs)
```
```{r name, echo=FALSE, cache=FALSE}
inputPanel(
selectizeInput(inputId = "Name", label = "Choose Name", choices=c("Rachel","Mike"), selected="Mike"),
numericInput(inputId = "Cluster", label = "Choose Cluster", min = 1, max=10, value = 1 ,step = 1)
)
renderText(paste("Hallo:",input$Cluster))
```
What I got is this rmarkdown: Picture 1
See Hallo: 1, what shows, that renderText get the reactive value from input$Cluster. Is it possible to somehow hide this numericInput, that it looks like this: Picture 2
I've tried shinyjs with different settings but it was no good.
At least two options here:
1. Use plain CSS
<style>
#Cluster {
display :none;
}
</style>
This way you will have to delete the label for the numericInput.
2. Use jQuery to select the parent div containing label and input field
<script>
$(document).ready(function() {
$('#Cluster').parent('div').css('display', 'none');
});
</script>
Here we just hide the whole container.
Put either of those right underneath your YAML header.