Home > Software design >  R-Markdown(PDF): Add space b/w Author, Date, and Abstract in YAML header
R-Markdown(PDF): Add space b/w Author, Date, and Abstract in YAML header

Time:12-29

My YAML header looks like this, and I would like to change only the space between the author/date, and abstract.

How can I achieve this? I have tried using /vspace{1cm} after the date (failed), and also at the start of the abstract text, but that only spaces the text, and not "Abstract" itself. Any ideas?

---
title: 
subtitle: 
author: "Me "
date: "`r format(Sys.time(), '%B %d, %Y')`" 
abstract: "The document shows the answer to all questions & the output (as it relates to each)"
output:
  pdf_document: 
    keep_tex: false
    toc: false
---

CodePudding user response:

With an up-to-date latex installation, you can use the hook system to add a bit of space before the abstract environment or the \@date macro which inserts the date:

---
title: "test"
subtitle: 
author: "Me "
date: "`r format(Sys.time(), '%B %d, %Y')`" 
abstract: "The document shows the answer to all questions & the output (as it relates to each)"
output:
  pdf_document: 
    keep_tex: false
    toc: false
header-includes:
  - \AddToHook{env/abstract/before}{\vspace*{4cm}}
  - \makeatletter\AddToHook{cmd/@date/before}{\vspace*{4cm}}\makeatother
---

\maketitle


test

enter image description here

  • Related