降价。如何减少标题栏和正文开头之间的空间

pau*_*ulr 3 latex r pandoc knitr r-markdown

我一直在通过 Mac 上的 RStudio 成功使用 RMarkdown。

最近升级到 RStudio 1.2.5019 和 tinytex_0.18,现在我的“标题块”和“第一个正文/标题”之间的垂直间距增加了。

简单的例子,(故意排除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.
Run Code Online (Sandbox Code Playgroud)

然后我尝试使用“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.
Run Code Online (Sandbox Code Playgroud)

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

电流输出

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

期望输出

那么,如何减少标题栏和文档正文开头之间的垂直间距?

提前致谢。

Car*_*era 6

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

---
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.
Run Code Online (Sandbox Code Playgroud)