5

I have a document using subequations and the parskip package. If the paragraph before a subequations environment is completely filled up to the last line, then additional vertical whitespace is introduced between this paragraph and the following subequations. I guess this is a bug, but I'm not sure, nor do I have enough TeX knowledge to try and fix it. How can I fix this whitespace issue?

Below is a MWE which shows the behaviour, at least on LaTeX2e <2003/12/01> with pdfeTeX 3.141592-1.21a-2.2 (unfortunately on this machine only an old tetex distribution is installed).

\documentclass[a4paper,11pt]{article}

\usepackage{parskip}
\usepackage{amsmath}

\begin{document}

The subequations environment provides a convenient way to number a foos
\begin{subequations}\label{foo}
  \begin{align}
    x^2 + y^2 &= z^2\\
    a &= b + c
  \end{align}
\end{subequations}

\end{document}
David Carlisle
  • 757,742
Jaap Eldering
  • 1,760
  • 15
  • 20
  • parskip does not seem to have anything to do with it. Remove it and insert a \noindent before the first line and you will get the same result. – daleif Aug 31 '11 at 08:11

3 Answers3

8

The problem is that the space after foos does not disappear at the line break, because of the \begin{subequations} that follows (I don't know exactly why).

Use \begin{subequations} between paragraphs, or say

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

In daleif's example the problem is the same: a space remains and makes a new line in the paragraph. However a \label there is only for \pageref usage, so it must be attached to a word, otherwise the reference can be off by one.

egreg
  • 1,121,712
  • Hi, I am also having the same issue. But this solution is not working for me. any idea how to solve the issue? – cosmicraga Mar 24 '14 at 12:26
  • @cosmicraga Difficult to say without a minimal example; please, make a new question citing this one and showing a bit of code that presents the issue. – egreg Mar 24 '14 at 12:46
  • After removing all other packages and codes, it works fine. So It must be clash between packages in my case. my document is quite big and I do not have time at present to see which package or chunk of code is causing the error. So sorry for not posting the MWE. Thanks. – cosmicraga Mar 24 '14 at 13:51
  • 2
    One can also do \AtBeginEnvironment{subequations}{\ifhmode\unskip\fi}; similarly, \AtBeginEnvironment{equation}{\ifhmode\unskip\fi} and \AtBeginEnvironment{equation*}{\ifhmode\unskip\fi} cure the problem for those two environments. – egreg Dec 28 '15 at 17:18
2

No idea what on earth is going on here. But here is a simpler example

\documentclass[a4paper,11pt]{article}
\usepackage{amsmath}
\begin{document}
\noindent The subequations environment provides a convenient way to
number a foos%
\label{foo}
\begin{align}
  x^2 + y^2 &= z^2\\
  a &= b + c
\end{align}
\end{document}

remove the % and we are back at your problem.

David Carlisle
  • 757,742
daleif
  • 54,450
  • On closer inspection, the problem even occurs without the \noindent as long as the text fills the line. But you were right that it wasn't specific to the parskip package. – Jaap Eldering Aug 31 '11 at 08:56
1

Here is an example which shows that the \mbox is in a new line and we get the same vertical space as with no space before the \mbox

\documentclass[a4paper,11pt]{article}
\usepackage{amsmath}
%\usepackage{microtype}
\begin{document}
\noindent The subequations environment provides a convenient way to
number a foos
\mbox{}\rlap{\rule{1pt}{2ex}\rule{0.6\linewidth}{1pt}}
\begin{align}
  x^2 + y^2 &= z^2\\
  a &= b + c
\end{align}
\end{document}

enter image description here

Moriambar
  • 11,466