5

In this MWE, there is additional white space between the line of text and the following subequations environment. It disappears when I unload hyperref, when I remove the wrapping subequations environment, when I shorten the line of text, or when I append % to the line of text.

\documentclass{IEEEtran}
\usepackage{amsmath,hyperref}
\begin{document}
    mmmmmmmmmmmmmmmi 
    mmmmmmmmmmmmmmmi
    \begin{subequations}
        \begin{equation}
            X
        \end{equation}
    \end{subequations}
\end{document}

But why does it appear in the first place, and can this be fixed?

bers
  • 5,404
  • 1
    You might want to have a look at this post: http://tex.stackexchange.com/questions/122343/fleqn-document-class-option-long-text-lines-and-hyperref-package – pluton Feb 07 '17 at 16:30
  • @pluton Thanks again, this led me to an alternative answer. – bers Feb 08 '17 at 09:24

2 Answers2

6

Place \begin{subequations} before starting the paragraph, which is the position it should go to begin with.

\documentclass{IEEEtran}
\usepackage{amsmath,hyperref}
\begin{document}

mmmmmmmmmmmmmmmi
mmmmmmmmmmmmmmmi
\begin{subequations}
\begin{equation}
X
\end{equation}
\end{subequations}

\begin{subequations}
mmmmmmmmmmmmmmmi
mmmmmmmmmmmmmmmi
\begin{equation}
X
\end{equation}
\end{subequations}

mmmmmmmmmmmmmmmi
mmmmmmmmmmmmmmmi
\begin{equation}
X
\end{equation}

\end{document}

enter image description here

egreg
  • 1,121,712
  • 1
    This looks like a good fix. Do you happen to have some documentation that explains that this is "the position it should go to begin with"? Because in the only official example that I can find, it is not in that position: ftp://ftp.fu-berlin.de/tex/CTAN/macros/latex/required/amslatex/math/subeqn.tex – bers Feb 07 '17 at 17:53
  • 1
    @bers Well, it ought to work even in that position, but hyperref adds some hooks that make the break between the “paragraph-so-far” and the equation into something different as usual. It's my opinion that subequation should encompass full paragraphs anyway. – egreg Feb 07 '17 at 18:07
1

Thanks to @pluton's comment, referring me to fleqn document class option, long text lines, and hyperref package, I found @Faekynn's comment referring me futher to Too much space between full paragraph and subequations env and the accepted answer there. So this one also solves my problem without messing with the order of environments:

\documentclass{IEEEtran}
\usepackage{amsmath,hyperref}

\usepackage{etoolbox}
\preto\subequations{\ifhmode\unskip\fi}

\begin{document}
    mmmmmmmmmmmmmmmi 
    mmmmmmmmmmmmmmmi
    \begin{subequations}
        \begin{equation}
        X
        \end{equation}
    \end{subequations}
\end{document}
bers
  • 5,404