当项目以公式结尾并后跟 \label 时,枚举和逐项列举中的额外垂直空间

当项目以公式结尾并后跟 \label 时,枚举和逐项列举中的额外垂直空间

enumerateitemize环境中使用标签时,我有时会在项目后获得额外的垂直空间。我已确定当项目中的内容以显示方程式结尾且\label{...}放置在代码中的方程式之后时,会出现额外的空间。

我在下面提供了一个最小工作示例来演示。请注意,第 3 项和第 4 项之间有很大空白。我搜索了相当多其他相关问题,但找不到与此问题相关的问题。

平均能量损失

\documentclass{article}

\usepackage{lipsum}% For generating dummy text.

\begin{document}

\lipsum[1][1]
\begin{enumerate}
    \item This item has a label and does not have extra space.  \lipsum[1][2] \label{item 1}
    \item This item does not have a label and does not have extra space. \[
      e{\theta i} = \cos\theta + i\sin\theta.
    \]
    \item This item has a label after the equation and has extra space.
    \[
      a^2 + b^2 = c^2
    \]\label{item 3}%
    \item This item has a label before the equation and does not have extra space.
    \label{item 4}%
    \[
        \int \arctan(x)\, dx = \frac{1}{1 + x^2}
    \]%
\end{enumerate}%
\lipsum[2][1-4]

\end{document}

输出

MWE 输出的屏幕截图

答案1

解决您的问题的方法是执行命令后立即移动标签\item

\documentclass{article}
\usepackage{lipsum}% For generating dummy text.

\begin{document}

\lipsum[1][1]
\begin{enumerate}
    \item This item has a label and does not have extra space.  \lipsum[1][2] \label{item 1}
    \item This item does not have a label and does not have extra space. 
    \[
      e^{\theta i} = \cos\theta + i\sin\theta.
    \]
    \item\label{item 3} This item has a label after the equation and has extra space.
    \[
      a^2 + b^2 = c^2
    \]%
    \item\label{item 4} This item has a label before the equation and does not have extra space.
    \[
        \int \arctan(x)\, dx = \frac{1}{1 + x^2}
    \]%
\end{enumerate}
Let referenced items: see item \ref{item 3} and \ref{item 3}.
\lipsum[2][1-4]

\end{document}

在此处输入图片描述

显示方程式后的标签实际上指的是垂直空间。这似乎会导致方程式后出现额外的垂直空间。

相关内容