我已经成功地通过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.
然后,我尝试使用“ 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看起来更像的东西(通过图形程序编辑)。
那么,如何减小标题栏和文档正文开头之间的垂直间距?
谢谢。
答案 0 :(得分:4)
您可以通过在第一段之前添加来自LaTeX的\vspace{}
命令来减少(子标题)与第一段之间的距离。
---
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.
答案 1 :(得分:0)
对于同时尝试将标题和正文向上移动的其他人:
我不知道paulr共享的两行在做什么:
\usepackage{titlesec}
\titlespacing{\title}{0pt}{\parskip}{-\parskip}
但是我找到了另一种解决方案here,该解决方案使用titling
包,然后将标题上移\setlengh{\droptitle}{5em}
。
完成标题后,您可以使用carlos's answer向上移动正文。