降价。如何减少标题栏和 body 文本开头之间的 space

RMarkdown. How to reduce space between title block and start of body text

我已经在 Mac 上成功地通过 RStudio 使用 RMarkdown。

最近升级到 RStudio 1.2.5019 和 tinytex_0.18,现在我的 "title block" 和 "first body text / heading" 之间的垂直间距增加了。

简单的例子,(特意排除了author:date:),就是:

---
output: 
  pdf_document
title: "Example of Title to Body Text"
subtitle: Subtitle Places Here
---
This is the first paragraph (or heading if specified as such). It is quite a way down from the title of the document. How can this be reduced to a "single line" vertical space?

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt.

然后我尝试使用 "titlesec" 程序包,但一直无法确定使用哪个命令来达到预期的结果。尝试的例子是:

---
output: 
  pdf_document

subparagraph: yes
header-includes: |
  \usepackage{titlesec}
  \titlespacing{\title}{0pt}{\parskip}{-\parskip}

title: "Example of Title to Body Text"
subtitle: Subtitle Places Here
---
This is the first paragraph (or heading if specified as such). It is quite a way down from the title of the document. How can this be reduced to a "single line" vertical space?

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt.

这是当前呈现为 PDF 的样子。

这是我希望 PDF 看起来更像的样子(从图形程序编辑)。

那么,如何缩小标题栏和文档开头之间的垂直间距 body?

提前致谢。

您可以通过在第一段之前添加来自 LaTeX 的 \vspace{} 命令来减少(子)标题和第一段之间的 space。

---
output: 
  pdf_document

subparagraph: yes
header-includes: |
  \usepackage{titlesec}
  \titlespacing{\title}{0pt}{\parskip}{-\parskip}

title: "Example of Title to Body Text"
subtitle: Subtitle Places Here
---

\vspace{-5truemm}


This is the first paragraph (or heading if specified as such). It is quite a way down from the title of the document. How can this be reduced to a "single line" vertical space?

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt.

对于同时尝试将标题和 body 文本向上移动的其他人:

我不明白paulr分享的两行是干什么的:

\usepackage{titlesec}
\titlespacing{\title}{0pt}{\parskip}{-\parskip}

但是我找到了另一个解决方案here,它使用titling的包,然后将标题上移\setlengh{\droptitle}{5em}

完成标题后,您可以使用 carlos's answer 将 body 文本向上移动。