5

I am using the subequations environment and observe non-uniform vertical spacing between subequations. Specifically, the space between the first and second equation is larger than the other spaces. Here is the code snippet:

\documentclass[12pt,fleqn,letterpaper]{article}
\usepackage[latin1]{inputenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\begin{document}

\begin{subequations}
\label{eq:omegai}
%
\begin{equation}
\label{eq:omega0}
\Omega_0 
\end{equation}
%
\begin{equation}
\label{eq:omega1}
\Omega_1 
\end{equation}
%
\begin{equation}
\label{eq:omega2}
\Omega_2 
\end{equation}
%
\begin{equation}
\label{eq:omega3}
\Omega_3 
\end{equation}
%
\end{subequations}

\end{document}

After doing some debugging I found that the offending command appears to be fleqn in the call to \documentclass[12pt,fleqn,letterpaper]{article}. If I remove fleqn the spacing is uniform. Any ideas how to get uniform vertical spacing and still use fleqn?

okj
  • 657
  • 2
  • 7
  • 18

3 Answers3

8

i really hate to say this, but i think it'a a bug in amsmath. (consider it reported.)

the "official dogma" about grouped formulas is that it's better to use one of the multi-line environments provided by amsmath than to separately enter \begin{equation} ... \end{equation}, and in fact, by adopting such an environment, the uneven spacing goes away, at least under some conditions.

here is a possibility that gets rid of the uneven vertical spacing -- but only if the block of subequations is preceded by some text. (but that's likely to be true.)

observe that the gather environment appears only once, and encompasses all the lines in the block, while successive lines are separated by double backslashes. (the amsmath multline environments are meant to be used only with displays that contain more than one line. if applied to single lines, the spacing will always be wrong.)

\documentclass[12pt,fleqn,letterpaper]{article}
\usepackage[latin1]{inputenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\begin{document}

\noindent
MMMMMM\hfill MMMMMM%
\begin{subequations}
\label{eq:omegai}
%
\begin{gather}
\label{eq:omega0}
\Omega_0 
\\
%
\label{eq:omega1}
\Omega_1 
\\
%
\label{eq:omega2}
\Omega_2 
\\
%
\label{eq:omega3}
\Omega_3 
\end{gather}
%
\end{subequations}
{MMMMMM\hfill MMMMMM\parfillskip=0pt\par}

\end{document}

output of example code

if only the display block is present in the file, the uneven spacing between the first and second lines may recur, but it's much less likely.

there are quite a few bugs associated with fleqn in amsmath; we dutifully test for them and record them as they are reported. unfortunately, a full review and overhaul hasn't yet been scheduled, and i can't predict when it might happen.

  • Thank you for the workaround, changing from equation environments to either align or gather, as you suggested. However, instead of getting a larger space between the first and second equations I get uniformly large spacing between all of the equations (unnecessarily large). This doesn't happen with your MWE, but in my actual application it does: – okj Mar 25 '15 at 21:31
  • \documentclass[12pt,fleqn,letterpaper]{article} \usepackage[latin1]{inputenc} \usepackage{amsmath} \usepackage{amsfonts} \usepackage{amssymb} \begin{document}

    \noindent MMMMMM\hfill MMMMMM% \begin{subequations} \label{eq:designobjectives} % \begin{align} \label{eq:sy11} \max \overline{\sigma_{y1}} \end{align} % \begin{align} \label{eq:s1111} \overline{S_{1111}} = S_{1111}^{sub} \end{align} % \begin{align} \label{eq:d} \min \overline{D} \end{align} % \end{subequations} {MMMMMM\hfill MMMMMM\parfillskip=0pt\par}

    \end{document}

    – okj Mar 25 '15 at 21:31
  • sorry, not sure how to post latex code in a comment... – okj Mar 25 '15 at 21:33
  • @okj -- don't use multiple align environments. that will always insert (unwanted) extra space between lines. just one \begin{align} at the beginning (see how gather is used in the example in the answer), with \\ between the lines, and a single \end{align} at the end. you might want to take a look at the documentation -- texdoc amsmath on a tex live system. – barbara beeton Mar 25 '15 at 21:41
  • \noindent even works on its own! – davyjones Aug 17 '17 at 15:48
  • @davyjones -- if you mean the row of "M"s isn't needed at the beginning, it put that there to show the location of the left margin; neither that "text" nor the \noindent are necessary for any other reason. – barbara beeton Aug 17 '17 at 16:12
  • @barbarabeeton but i do encounter a large vertical space before begin{subequations} and after begin{block} in beamer, which cannot be solved by merely adding \addtobeamertemplate{block begin}{\setlength\abovedisplayskip{0pt}} (from another post). The vertical space seems to be reserved for some words which i did not intend to insert. whereas adding \noindent (or \indent, except it does not actually indent even if some words are present) solves the problem! – davyjones Aug 17 '17 at 16:26
  • @davyjones -- aha! beamer is an entirely different kettle of fish. and amsmath was never tested exhaustively in beamer, so it's a good thing you have qualified that. i will put on the "requested" list for amsmath to give it a workout with beamer and document the results in the manual. – barbara beeton Aug 17 '17 at 16:31
2

There are \abovedisplayskip and \belowdisplayskip around the first equation but there are \abovedisplayshortskip and \belowdisplayshortskip around other equations. Because these registers have set different values, you see the uneven spacing. TeX internal algorithm uses \*short* registers for vertical spacing if there is a horizontal space between the last word of the previous paragraph and the beginning of the equation. Something like this:

last word
                equation

but it uses no "short" registers in other cases, like this

last last lats last word
            equation

wipet
  • 74,238
0

I just ran into this problem and did not want to change what I already have much. Here is a workaround by adding an empty row to the top and setting a negative vertical distance for the line-break. It is based on the answer at https://tex.stackexchange.com/a/223999/150849 .

Some paragraph.
\begin{subequations}\label{eq:exampleNLP}
  \begin{align}
    & \nonumber \\[-30pt]
    & some equations \\
  \end{align}
\end{subequations}
Some other paragraph.
burkay
  • 111
  • 2