# How to customize header with Rmarkdown?

I'm currently working on a pdf document using Rmarkdown on RStudio but I'm very much confused about to how to customize my YAML section. This is my actual code:

---
title: "The very basics of R"
author: "Alejandro C."
date: "March, 2020"
output:
pdf_document:
latex_engine: xelatex
toc: true

mainfont: Times New Roman
fontsize: 12pt
- \usepackage{titling}
- \pretitle{\begin{flushleft}}
- \posttitle{\end{flushleft}}
- \preauthor{\begin{flushleft}}
- \postauthor{\end{flushleft}}
- \predate{\begin{flushleft}}
- \postdate{\end{flushleft}}

---


What I want to achieve is the following:

• Use a bigger fontsize in my title (for example, 14) and boldface it
• Use 12 fontsize for author and date
• Use 11 fontsize for my document (I don't know if this must be specified in the YAML section)

I'm new on this topic so I really don't know where to start besides the R Markdown Reference Guide. Any help and advice will be much appreciated.

You lost the format of each element of title forcing flushleft environments instead of redefining \maketitle, but some like ...

fontsize: 11pt
- \usepackage{titling}
- \pretitle{\begin{flushleft}\huge\bfseries}
- \posttitle{\end{flushleft}}
- \preauthor{\begin{flushleft}\Large}
- \postauthor{\end{flushleft}}
- \predate{\begin{flushleft}\large}
- \postdate{\end{flushleft}}


... must be nearly to what you want. You can see what font sizes are exactly commands as \large or \Large here.

• Exactly what I was looking for. Thank you so much! Jan 29 '20 at 15:48
• By the way, where can I found some info about redifining \maketitle? As I said, this is a completely new topic for me but I'm eager to learn. Jan 29 '20 at 15:56
• Simply is \makeatletter\def\@maketitle{<your definition >}\makeatotter. An example here. Alternatively, mostly in books, you can use a titlepage` environment to construct yourself the page title in a free format. But instead of make elaborate YAML headers or add a lot of LaTeX code in the Rmarkdown body, my advice is search about modify pandoc templates.
– Fran
Jan 29 '20 at 18:22