0

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]
 
---
jck21
  • 751
  • 4
  • 16

1 Answers1

1

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()`

---
shafee
  • 15,566
  • 3
  • 19
  • 47
  • Where do I have to write the second part of your answer? In css file, correct? – jck21 Aug 06 '22 at 14:49
  • 1
    No, you would write exactly like written here. There's no css code here. `class`, `background-size` these are part of xaringan, AFAIK – shafee Aug 06 '22 at 15:17
  • Hi sorry again. I was not so attentive last time. Only part that still does not work is date. It still shows up like `r Sys.Date()`, not actual date. – jck21 Aug 19 '22 at 12:02
  • 1
    @joe, see the update. – shafee Aug 19 '22 at 13:19