2

The following MCE points out that \substack doesn't honor the horizontal spaces around its argument:

\documentclass[fleqn]{article}
\usepackage{mathtools}
\begin{document}
\begin{gather*}
  (ab=0)                        \iff                     (a=0\text{ or } b=0)\\
  (ab=0) \substack{\displaystyle\iff\\\displaystyle\iff} (a=0\text{ or } b=0)
\end{gather*}
\end{document}

enter image description here

Why is it the case and how to retrieve the original spaces?

1 Answer 1

3

You should first look at the definition of \iff in amsmath.sty, namely

\renewcommand{\iff}{\DOTSB\;\Longleftrightarrow\;}

Now you can define a \doubleiff command along the same lines, rather than abusing \substack.

\documentclass{article}
\usepackage{amsmath}

\newcommand{\Doublelongleftrightarrow}{%
  \mathrel{%
    \vcenter{%
      \offinterlineskip
      \mathsurround=0pt
      \ialign{%
        ##\cr
        \noalign{\vspace{0.25ex}}
        $\Longleftrightarrow$\cr
        \noalign{\vspace{0.5ex}}
        $\Longleftrightarrow$\cr
      }%
    }%
  }%
}

\newcommand{\doubleiff}{\DOTSB\;\Doublelongleftrightarrow\;}

\begin{document}

\begin{gather*}
  (ab=0) \iff       (a=0\text{ or } b=0)\\
  (ab=0) \doubleiff (a=0\text{ or } b=0)
\end{gather*}

\end{document}

enter image description here

Note. The \vspace instructions are needed because of the peculiar bounding boxes of arrows in the Computer Modern fonts. Different math fonts may not need them or need different spacings.

3
  • Indeed but I probably oversimplified my MCE: my use case doesn't involve the same symbol in the two lines of the stack (sorry for that!). I have edited my question. Sep 6, 2022 at 9:44
  • 1
    @DenisBitouzé You shouldn't change your question as to invalidate the existing answers. Please roll back and ask a new question.
    – egreg
    Sep 6, 2022 at 9:45
  • Eventually, no need for a new question! :) Sep 6, 2022 at 10:16

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .