【问题标题】:Decrease vertical space between align environment and text content in RMarkdown减少 RMarkdown 中对齐环境和文本内容之间的垂直空间
【发布时间】:2016-09-16 00:58:43
【问题描述】:

我正在编写带有方程式的 rmarkdown pdf 文档(使用 mac、knitr、pdf-latex)。我遇到的问题是 rmarkdown 会自动在前面的文本和方程式之间创建一个 2-3 行的大空白间隙。我该如何摆脱这个差距?

下面的示例 rmarkdown 文档。

---
title: "No More Gaps"
author: "Llew Mills"
date: "16th of September 2016"
output: pdf_document
header-includes:
- \setlength{\mathindent}{0pt}
linestretch: 1.3
toc: yes
classoption: fleqn
---

Some text to illustrate the gap. I still want there to be a decent line spacing between lines of text, but I would like a much smaller gap between the equations and the preceding text.
\begingroup\Large
\begin{align*}
Y_{ij} &= \pi_{0i} + \pi_{1i}TIME_{ij} + \pi_{2i}(0) + \varepsilon_{ij}\\
&= \pi_{0i} + \pi_{1i}TIME_{ij} + \varepsilon_{ij}
\end{align*}
\endgroup

Can anyone help with this problem?

【问题讨论】:

  • 你可以在\begingroup之前使用\vspace{-.5cm}
  • 是的。正是我想要的。谢谢!

标签: latex knitr r-markdown


【解决方案1】:

这里有两个选项。正如我在评论中指出的那样,first 只是使用\vspace第二个是使用\abovedisplayskip。有关此(以及同级命令)如何工作的详细信息,我可以向您推荐 Remove vertical space around align

---
title: "Spacing"
output: pdf_document
header-includes:
  - \usepackage{amsmath}
  - \usepackage{lipsum}
---
\setlength{\abovedisplayskip}{-15pt}
\setlength{\belowdisplayskip}{0pt}
\setlength{\abovedisplayshortskip}{0pt}
\setlength{\belowdisplayshortskip}{0pt}
\lipsum*[3]
\begin{align*}
  A\cap B & = \{b,d,e\} \cap \{a,b,f,g\} \\
          & = \{b\}
\end{align*}
\lipsum[3]

【讨论】:

  • 我喜欢这个。它有一种更“全球化”的感觉。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2019-12-24
  • 1970-01-01
  • 2017-01-17
  • 2022-09-25
  • 1970-01-01
  • 1970-01-01
  • 2014-07-27
相关资源
最近更新 更多