RMarkdown 更改作者和标题的顺序

问题描述

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

class ProfileFragment : Fragment() {

val btnUpdate: Button = view.findViewById(R.id.btn_update)
        btnUpdate.setonClickListener {
            if(selectedImageUri != null){
                uploadUserImage()
            } else {
                updateUserProfileData()
            }
            findNavController().navigate(R.id.action_nav_my_profile_to_nav_home)
        }

解决方法

} 末尾缺少 - \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}}
---

-输出 enter image description here