RMarkdown.如何减少标题栏和正文之间的间距 [英] RMarkdown. How to reduce space between title block and start of body text

查看:358
本文介绍了RMarkdown.如何减少标题栏和正文之间的间距的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I've been using RMarkdown via RStudio on a Mac successfully.

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

Recently upgraded to RStudio 1.2.5019 and tinytex_0.18 and now the vertical spaceing between my "title block" and "first body text / heading" has increased.

一个简单的示例(故意不包括author:date:)是:

Simple example, (deliberately excluding author: and date:), is:

---
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"包,但无法确定要使用哪个命令来实现所需的结果.尝试的示例是:

I then tried to use the "titlesec" package, but haven't been able to work out which command to use to achieve the desired outcome. Example of attempt is:

---
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的外观.

This is what it currently looks like rendered to PDF.

这就是我希望PDF看起来更像的东西(通过图形程序编辑).

This is what I would like the PDF to look more like (edit from graphics program).

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

So, how can I reduce this vertical spacing between the title block and the start of the document's body?

谢谢.

推荐答案

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

You can reduce the space between the (sub)title and the first paragraph by adding \vspace{} command from LaTeX right before the first paragraph.

---
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.

这篇关于RMarkdown.如何减少标题栏和正文之间的间距的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆