RMarkdown. Как уменьшить пространство между заголовком и началом основного текста - PullRequest
0 голосов
/ 08 января 2020

Я успешно использую RMarkdown через RStudio на Ма c.

Недавно обновлен до 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.

Затем я попытался использовать пакет "titlese c", но не смог определить, какую команду использовать для достижения желаемый результат. Пример попытки:

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

Current output

Это то, что я хотелось бы, чтобы PDF выглядел более похожим (редактирование из графической программы).

Desired output

Итак, как я могу уменьшить это вертикальное расстояние между блоком заголовка и начало тела документа?

Заранее спасибо.

1 Ответ

1 голос
/ 10 января 2020

Вы можете уменьшить расстояние между (под) заголовком и первым абзацем, добавив команду \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.
...