I am a new LaTeX and RMarkdown user. I am currently compiling reports using RMarkdown (in RStudio) but am unsure how to centre and bold one of my headings? For example, my document looks like this:

title: <center> <h1>Call Centre Report</h1> </center>
mainfont: Arial
    latex_engine: xelatex
sansfont: Arial
fig_crop: false
toc: true
classoption: landscape
fontsize: 14pt
geometry: margin=0.5in
- \usepackage{booktabs}
  .main-container {
    max-width: 1200px !important;

```{r global_options, R.options=knitr::opts_chunk$set(warning=FALSE, message=FALSE)}

# Iris 

```{r fig.width=18, fig.height=7, echo=FALSE, comment=" "}
ggplot(data = iris, aes(x = Sepal.Length, y = Sepal.Width, colour = Species)) +
   geom_point() +

I wish to have the "Iris" heading centred and bold while retaining it's format as a heading to appear in the TOC, but am unsure how to do so?

Any help would be greatly appreciated.


A package that doesn't clash wit the pandoc default.latex template is sectsty

At the end of the yaml, direct under header-includes add the package

- \usepackage{booktabs}
- \usepackage{sectsty} \sectionfont{\centering \emph}

See the package manual for more option

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.