我有一个定义,其中使用了一些数学文本。行与行之间的间距对我来说太大了,我的编辑器也将其列为坏框。我使用的 LaTeX 代码是:
\begin{defn} An \emph{affine combination} of points $x_1, x_2, \ldots, x_k$ is given by $\sum\limits_{i=1}^k \lambda_{i}x_{i}$, where $\lambda_1,\ldots, \lambda_k \ \in \mathbb{R}$ and $\sum\limits_{i=1}^k \lambda_{i} = 1$. A set of points is said to be \emph{affinely independent} if no point is an affine combination of the others.
\end{defn}
我得到的输出是:
有人能帮我缩小线条之间的间隙吗?谢谢!
答案1
警告:这不是通用解决方案。这是在完成大部分文档后应用的解决方案。
正如评论中提到的那样,您可以通过删除以下内容来解决此问题\limits
:
\documentclass{article}
\usepackage{amsmath,amssymb,amsthm}
\newtheorem{defn}{Definition}
\begin{document}
\begin{defn}
An \emph{affine combination} of points $x_1, x_2, \dots, x_k$
is given by $\sum_{i=1}^k \lambda_{i}x_{i}$, where
$\lambda_1,\dots, \lambda_k \in \mathbb{R}$ and $\sum_{i=1}^k \lambda_{i} = 1$.
A set of points is said to be \emph{affinely independent} if no point is
an affine combination of the others.
\end{defn}
\end{document}
如果您坚持按照您设置的限制来做,那么您可以\smash
在第一个实例中使用:
\documentclass{article}
\usepackage{amsmath,amssymb,amsthm}
\newtheorem{defn}{Definition}
\begin{document}
\begin{defn}
An \emph{affine combination} of points $x_1, x_2, \dots, x_k$
is given by $\smash{\sum\limits_{i=1}^k} \lambda_{i}x_{i}$, where
$\lambda_1,\dots, \lambda_k \in \mathbb{R}$ and $\sum\limits_{i=1}^k \lambda_{i} = 1$.
A set of points is said to be \emph{affinely independent} if no point is
an affine combination of the others.
\end{defn}
\end{document}
结果是
正如@egreg所指出的,\smash
,正如 重新定义的amsmath
,接受一个可选参数。 要么\smash[b]
要么\smash[t]
第一个打破垂直深度归零,但不影响高度,第二个打破垂直高度为零,但不影响深度:
\documentclass{article}
\usepackage{amsmath}
\setlength{\fboxsep}{0pt}
\begin{document}
I've set the \verb-\fboxsep- to \verb-0pt-, notice how in the first example, the \verb-\fbox- looks only like a line.
\[
\text{Smash removing vertical height and depth:} \quad
\fbox{$\smash{\sum\limits_{i=1}^k}$}
\]
\[
\text{Smash removing only the vertical depth:} \quad
\fbox{$\smash[b]{\sum\limits_{i=1}^k}$}
\]
\[
\text{Smash removing only the vertical height:} \quad
\fbox{$\smash[t]{\sum\limits_{i=1}^k}$}
\]
\end{document}
在第一个例子中,最后两行看起来有点太接近,因此您可以添加一个支柱(我使用 来完成此操作\rule
):
\documentclass{article}
\usepackage{amsmath,amssymb,amsthm}
\newtheorem{defn}{Definition}
\begin{document}
\begin{defn}
An \emph{affine combination} of points $x_1, x_2, \dots, x_k$
is given by $\sum_{i=1}^k \lambda_{i}x_{i}$, where
$\lambda_1,\dots, \lambda_k \in \mathbb{R}$ and $\sum_{i=1}^k\rule[-1.25ex]{0pt}{1pt} \lambda_{i} = 1$.
A set of points is said to be \emph{affinely independent} if no point is
an affine combination of the others.
\end{defn}
\end{document}
答案2
必要时进行组合,并对包\smash
进行局部轻微修改:\baselineskip
setspace
\documentclass[a4paper]{article}
\usepackage{amsmath, amsfonts}
\usepackage{nccmath}
\setlength\parindent{1em}
\usepackage[thmmarks, amsmath, thref]{ntheorem}
\theoremstyle{plain}
\theoremheaderfont{\upshape\bfseries}
\theorembodyfont{\itshape}
\theoremseparator{.}
\newtheorem{defn}{Definition}
\usepackage{setspace}
\setstretch{1.2}
\begin{document}
\setcounter{defn}{3}
\begin{defn} An \emph{affine combination} of points $x_1, x_2, \ldots, x_k$ is given by $\smash[b]{\sum\limits_{i=1}^k} \lambda_{i}x_{i}$, where $\lambda_1,\ldots, \lambda_k \ \in \mathbb{R}$ and $ \sum\limits_{i=1}^k \lambda_{i} = 1$. A set of points is said to be \emph{affinely independent} if no point is an affine combination of the others.
\end{defn}
\end{document}