在 RMarkdown 中减少对齐环境和文本内容之间的垂直 space
Decrease vertical space between align environment and text content in RMarkdown
我正在用方程式编写 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?
这里有两个选项。正如我在评论中指出的那样, 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]
我正在用方程式编写 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?
这里有两个选项。正如我在评论中指出的那样, 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]