\showonlyrefs 命令在未引用的方程式后留下空白

\showonlyrefs 命令在未引用的方程式后留下空白

当我没有引用某个问题时,等式后面就会出现一个空白。

梅威瑟:

\documentclass[12pt,reqno]{amsart}

\usepackage{graphicx}

\usepackage{amssymb , amsthm}
\theoremstyle{plain}

%This allows for theorems which are not automatically numbered
\newtheorem*{theorem*}{Theorem} 

% The bellow lines are for formatting.  In general, you will not want to change these.
\newtheorem{definition}{Definition}
\newtheorem{theorem}{Theorem}
\newtheorem{lemma}{Lemma}
\newtheorem{example}{Example}
\usepackage{lineno}

% Added packages
\usepackage[utf8]{inputenc}
\usepackage{amsmath , amsfonts}
\usepackage{mathtools}
\mathtoolsset{showonlyrefs=true , showmanualtags=true}
\usepackage{physics}
\usepackage{hyperref , url}

% Title
\title{Vector spaces}
\author{DS}
\date{\today}

\begin{document}

\maketitle

Notice that for sets $A$ and $B$, if $A \not\subset B$, then there exists an element $x$ such that $x \in A$ and $x \notin B$. That is,
%
\begin{equation}\label{1}
    \qty(A \not\subset B) \iff \exists x \qty( x \in A \wedge x \notin B).
\end{equation}
%
We now prove theorem $2.1$. By way of contradiction, suppose that the theorem fails. Let $A$ be a set such that $\emptyset \not\subset A$.

Notice that for sets $A$ and $B$, if $A \not\subset B$, then there exists an element $x$ such that $x \in A$ and $x \notin B$. That is,
%
\begin{equation}\label{2}
    \qty(A \not\subset B) \iff \exists x \qty( x \in A \wedge x \notin B).
\end{equation}
%
We now prove theorem $2.1$. By way of contradiction \eqref{2}, suppose that the theorem fails. Let $A$ be a set such that $\emptyset \not\subset A$.

\end{document}

答案1

在下一个mathtools版本(1.23 版)发布之前,这里有一个似乎有效的补丁

\usepackage{xpatch}

\MHInternalSyntaxOn

\xpatchcmd{\MT_extended_tagform:n}{
  \@ifundefined{MT_r_\df@label}{}
}{%
 \@ifundefined{MT_r_\df@label}{\kern1sp}
}{}{\typeout{patch failed}}

\xpatchcmd{\MT_extended_tagform:n}{
\@ifundefined{MT_r_\df@label}{\global\MH_set_boolean_F:n {manual_tag}}
}{%
\@ifundefined{MT_r_\df@label}{\global\MH_set_boolean_F:n {manual_tag}\kern1sp}
}{}{\typeout{patch failed}}

\MHInternalSyntaxOff

带补丁的 MWE(我从序言中删除了不相关的软件包)

\documentclass[12pt,reqno]{amsart}
\usepackage[utf8]{inputenc}
\usepackage{amsmath , amsfonts}
\usepackage{mathtools}
\mathtoolsset{showonlyrefs=true , showmanualtags=true}

\usepackage{xpatch}

\MHInternalSyntaxOn

\xpatchcmd{\MT_extended_tagform:n}{
  \@ifundefined{MT_r_\df@label}{}
}{%
 \@ifundefined{MT_r_\df@label}{\kern1sp}
}{}{\typeout{patch failed}}

\xpatchcmd{\MT_extended_tagform:n}{
\@ifundefined{MT_r_\df@label}{\global\MH_set_boolean_F:n {manual_tag}}
}{%
\@ifundefined{MT_r_\df@label}{\global\MH_set_boolean_F:n {manual_tag}\kern1sp}
}{}{\typeout{patch failed}}

\MHInternalSyntaxOff



\begin{document}


Notice that for sets $A$ and $B$, if $A \not\subset B$, then there
exists an element $x$ such that $x \in A$ and $x \notin B$. That is,
%
\begin{equation}\label{1}
    (A \not\subset B) \iff \exists x ( x \in A \wedge x \notin B).
\end{equation}
%
We now prove theorem $2.1$. By way of contradiction, suppose that the
theorem fails. Let $A$ be a set such that $\emptyset \not\subset A$.

Notice that for sets $A$ and $B$, if $A \not\subset B$, then there
exists an element $x$ such that $x \in A$ and $x \notin B$. That is,
%
\begin{equation}\label{2}
    (A \not\subset B) \iff \exists x ( x \in A \wedge x \notin B).
\end{equation}
%
We now prove theorem $2.1$. By way of contradiction \eqref{2}, suppose
that the theorem fails. Let $A$ be a set such that
$\emptyset \not\subset A$.

\end{document}

相关内容