Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I modifiy the positions of the text and logo on RMarkdown title slide

Because of the picture I have at the bottom of my title slide, I want to:

  • move all title, subtitle and author up from their center positions.
  • remove the Rlogo in the title slide only (don't really know how to do it). I could only remove slide number for now using .title-slide .remark-slide-number { display: none; }.

Any suggestion is appreciated! Thanks!

Here is my reproducible example:

tweaks.css file

/* for logo and slide number in the footer */
.remark-slide-content:after {
    content: "";
    position: absolute;
    bottom: 15px;
    right:   8px;
    height: 40px;
    width: 120px;
    background-repeat: no-repeat;
    background-size: contain;
    background-image: url("Rlogo.png");
}

/* for background image in title slide */
.title-slide {
  background-image: url("slideMasterSample.png");
  background-size: cover;
}

.title-slide h1 {
  color: #F7F8FA;
  margin-top: -170px;
}

.title-slide h2, .title-slide h3 {
  color: #e7e8e2; 
  line-height: 1.0em;
  margin-top: -75px;
}

.title-slide .remark-slide-number {
  display: none;
}

1st attempt: modified margin-top in tweaks.css file as mentioned in xaringan wiki

---
title: "Presentation Ninja"
subtitle: "xaringan"
author: "Author"
output:
  xaringan::moon_reader:
    lib_dir: libs
    css: ["default", "tweaks.css"]
    nature:
      highlightStyle: github
      highlightLines: true
      countIncrementalSlides: false
---

Result 1:

Result 1

2nd attempt: added <br> to the title to manually push it up but then the subtitle and author were also pushed down. Adding <br> to subtitle and author did not help either.

---
title: "Presentation Ninja<br><br><br><br><br><br>"
subtitle: "xaringan"
author: "Author"
output:
  xaringan::moon_reader:
    lib_dir: libs
    css: ["default", "tweaks.css"]
    nature:
      highlightStyle: github
      highlightLines: true
      countIncrementalSlides: false
---

Result 2:

Result 2

Photos used

slideMasterSample.png Rlogo.png

like image 307
Tung Avatar asked Feb 25 '18 17:02

Tung


People also ask

How do you center text in Rmarkdown?

Aligning Text By default, all text in Markdown fields are aligned to the left. You can also align to the right, or center the content by wrapping the text in div tags.

How do I add a logo to Markdown?

You can add images to Markdown using the [alt text](image_url) syntax. Let's see how it works.

What is Ioslides?

ioslides is one of the presentation format that can be easily put together using R Markdown. It has good compatibility with html, and very easy set-up.


1 Answers

Using seal: false you can create a title slide that is independent from the YAML header. It often simplifies slide creation imo.

For the R logo across all slides but the title slide, create a custom div and set it as a layout.

enter image description hereenter image description here

CSS:

.title-slide {
  background-image: url("slideMasterSample.png");
  background-size: cover;
}
.title-slide h1, h2, h3 {
  text-align: center;
  color: #F7F8FA;
}

.title-slide .remark-slide-number {
  display: none;
}

div.my-footer {
content: "";
    position: absolute;
    bottom: 15px;
    right:   8px;
    height: 40px;
    width: 120px;
    background-repeat: no-repeat;
    background-size: contain;
    background-image: url("Rlogo.png");
}

Rmd:

---
title: "Presentation Ninja"
subtitle: "xaringan"
author: "Author"
output:
  xaringan::moon_reader:
    lib_dir: libs
    css: ["tweaks.css", "default"]
    nature:
      highlightStyle: github
      highlightLines: true
      countIncrementalSlides: false
    seal: false
---

```{r setup, include=FALSE}
options(htmltools.dir.version = FALSE)
```

class: title-slide   

# Header 1

## Header 2  

### Header 3 

---

layout: true

<div class="my-footer"></div>       

---

# new slide 1

---

# new slide 2
like image 128
pat-s Avatar answered Sep 20 '22 21:09

pat-s