我正在用方程式编写rmarkdown pdf文档(使用mac,knitr,pdf-latex)。我遇到的问题是rmarkdown会自动在前面的文本和等式之间创建2-3行的大空白间隙。我如何摆脱这种差距?
以下示例rmarkdown doc。
---
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?
答案 0 :(得分:5)
这里有两种选择。正如我在评论中指出的那样,第一个就是使用\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]