0
votes

When using the metropolis theme in xaringan (RStudio 1.2.1070)

output:
    xaringan::moon_reader:
      css: [default, metropolis, metropolis-fonts]

I wish to have a smaller font for the title of each slide. If I use h1 for a slide title i.e.

---
# The title of this slide

content

it works as expected, but if I try to use h2 i.e.

---
## The title of this slide

content

the text appears in the body of the slide and not the banner.

Suggestions?


Update

Thanks for the prompt answer Martin. I modified your suggestion slightly.

Including:

.remark-slide-content.hljs-default {
  border-top: 40px solid #23373B;
}

adds the border to the title slide (which I didn't want).

For me, just adding this works fine:

<style>

.remark-slide-content > h1 {   font-size: 35px;   margin-top: -88px; }

</style>

Nevertheless, I must say my original question about using ## was prompted by the entry on xaringan Presentations in R Markdown: The Definitive Guide https://bookdown.org/yihui/rmarkdown/xaringan-format.html where it states:

7.3.1 Slides and properties

Every new slide is created under a horizontal rule (---). The content of the slide can be arbitrary, e.g., it does not have to have a slide title, and if it does, the title can be of any level you prefer (#, ##, or ###).

1

1 Answers

0
votes

Try the following:

---
title: Test
output:
  xaringan::moon_reader:
    css: [default, metropolis, metropolis-fonts]
---

<style>
.remark-slide-content.hljs-default {
  border-top: 40px solid #23373B;
}

.remark-slide-content > h1 {
  font-size: 20px;
  margin-top: -55px;
}

</style>

---
# The title of this slide

content

I guess you have to play around with the settings to achieve exactly the layout you want.

enter image description here