0

When I don't reference a question, a blank space appeared after the equation.

MWE:

\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}
8
  • 2
    Possibly related: Vertical spacing in mathtools
    – leandriis
    Jan 17 '20 at 7:52
  • Note that this does not happen if article is used instead of amsart
    – daleif
    Jan 17 '20 at 8:58
  • @daleif Yes, it does: the space is not as evident as with amsart but it's there.
    – campa
    Jan 17 '20 at 9:08
  • @campa an entire blank line actually (try setting below/abovedisplayskip to zero). Where on earth is that coming from
    – daleif
    Jan 17 '20 at 9:14
  • 2
    The mathtools dtx literally says Have to watch out for \TeX\ inserting a blank line so do not let the tag have width zero.
    – daleif
    Jan 17 '20 at 9:33
2

Until the next mathtools version is released (version 1.23) here is a patch that seems to work

\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 with the patch (I've removed irrelevant packages from the preamble)

\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}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.