markdown如何调整行距,RMarkdown.如何减少标题栏和正文之间的间距

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

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.

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.

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.

This is what it currently looks like rendered to PDF.

y76dd.jpg

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

qU00F.png

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

Thanks in advance.

解决方案

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.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值