gpt4 book ai didi

latex - 减少RMarkdown中对齐环境和文本内容之间的垂直空间

转载 作者:行者123 更新时间:2023-12-03 13:46:25 27 4
gpt4 key购买 nike

我正在写带有方程式的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?

最佳答案

这里有两个选择。正如我在评论中指出的,的第一个仅用于使用\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]

关于latex - 减少RMarkdown中对齐环境和文本内容之间的垂直空间,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39522390/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com