[Tex/LaTex] How to customize header with Rmarkdown

rrstudiotitles

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
header-includes:
  - \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.

Best Answer

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

fontsize: 11pt
header-includes:
  - \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.