How to set a different font for headings?

Hi,

how do I style headings’ font differently from paragraphs?

I looked in the docs, but I can’t find a solution. “font“ does not seem to be a valid key in heading styles.

EDIT: Damn, this was one of those cases in which you had to go public on a forum and find the solution a minute afterwards yourself…

#show heading.where(
  level: 2
): it => text(
  font: "Atma",
  size: 20pt,
  weight: "regular",
  style: "normal",
  it.body,
)

This is solved.

#show heading.where(
  level: 2
): it => text(
  font: "Atma",
  size: 20pt,
  weight: "regular",
  style: "normal",
  it.body,
)
1 Like

It would be nice if you share your solution, so others can benefit from your work. :slight_smile:

They have shared the solution, see the “Edit” and the code block in the initial post.

2 Likes

I had a problem with this code : the body’s text appeared right after the title, without a breakline, so I tried something else :

#show heading.where( level: 2 ): set text(
  font: "Atma",
  size: 20pt,
  weight: "regular",
  style: "normal",)

I find it more practical. Maybe because I don’t fully understand the “it” parameter in the previous code.

Hope I helped a bit ;)

1 Like