Unbolden and italicize headers in RMarkdown

Viewed 236

I'd like to create subheaders that are not bold and italicized in an RMarkdown file. When I try manually use html tags like this

<h2 style="font-weight: normal;">*Header Example*</h2>

it gets indented as if it's a new paragraph. I do not want the subheader to be indented.

I have the setting in my YAML:

header-includes:
  - \setlength{\parindent}{30pt}

If I use the above approach, can I still control the line spacing between headers and paragraphs?

And there doesn't seem to be a difference between h1 and h2 tags with the above approach.

1 Answers

I used the HTML \small element to make the text smaller and \textnormal to unbold.

# HEADER EXAMPLE $(\small{\textnormal{subheader example}})$

This keeps the subheader on the same line as the header. You can also easily italicize with *s.

# HEADER EXAMPLE $(\small{\textnormal{*subheader example*}})$

This way it doesn't get indented into a new line and you can still control the line spacing between headers and paragraphs.

Related