RMarkdown 更改作者和标题的顺序

RMarkdown change the order of author and title

我正在尝试对齐正确的作者并将其放在居中的标题之前。

---
author: "Author name" 
title: "Title name"
output: pdf_document
header-includes:
    - \usepackage{titling}
    - \preauthor{\begin{flushright}}
    - \postauthor{\end{flushright}}

---

- \preauthor{\begin{flushright}末尾少了一个}。为了让作者更上一层楼,可以使用\vspace*{-1.5cm}.

代码:

---
author: "Author name" 
title: "Title name"
output: pdf_document
header-includes:
    - \usepackage{titling}
    - \preauthor{\begin{flushright}\vspace*{-1.5cm}}
    - \postauthor{\end{flushright}}
---

-输出