# How to handle unnecessary whitespace leading to widows/orphans?

I'm working on my paper using TexMaker and this is what's happening:

I'm getting unnecessary whitespace before paragraph 'B'. As a result of the unnecessary whitespace I have a widow/orphan of an equation reference at the start of the next page. I'm pretty much at my wits end wondering what is the problem here.

Here is the LaTeX code for the paragraph and the corresponding equation section:

\subsection{Computing Tester/Developer Payoffs}
\label{subsec:payoffs}

In a security game defenders may employ mixed strategies i.e., selecting a
particular action with some probability as opposed to a deterministic
choice. This distribution decreases predictability of choice of
actions that may be exploited by an adversary. For our testing game we
refer to the set of distributions as a \textit{coverage vector}, $C$
that gives the probability, $c_t$, that a particular test suite $t$,
covering a particular requirement will be executed. We then compute
the expected payoffs for the testers and developers as shown in
Equations~\eqref{eqn:tC-EU} through ~\eqref{eqn:attack-set}

\begin{IEEEeqnarray}{c}
\label{eqn:tC-EU} U_\tester(t,C) = c_t \cdot \testercovered + (1-c_t)\cdot \testeruncovered \\
\label{eqn:CA-EU} U_\tester(C,\reqvector) = \sum_{t \in T} \attackprob \cdot (c_t \cdot \testercovered + (1-c_t)\cdot \testeruncovered) \\
\label{eqn:attack-set} \Gamma (C) = \{t:U_\dev(t,C) \geq U_\dev(t',C)\, \forall t' \in T\}
\end{IEEEeqnarray}
%...remaining text


There is nothing out of the ordinary in the code IMO. Why does this happen and how should I fix it (whitespace + widow/orphan)? This abruptly started happening after editing the paper. I'm guessing it's something to do with auto layout of LaTeX and not really something in the code.

PS: If it's of any use, here's the code for the table in the screenshot above:

{\begin{table*}[!t]
\caption{Compact representation of game showing tester and developer utilities}
\label{table:game}
\renewcommand\arraystretch{1.5}
\begin{tabular}{*{11}{|c}|}
\cline{2-11}
\multicolumn{1}{c|}{}& \multicolumn{2}{c|}{Requirement 1} & \multicolumn{2}{c|}{Requirement 2} & \multicolumn{2}{c|}{Requirement 3} & \multicolumn{2}{c|}{Requirement 4} & \multicolumn{2}{c|}{Requirement 5}\\ \cline{2-11}
\multicolumn{1}{c|}{}& Covered & Uncovered                & Covered & Uncovered                & Covered & Uncovered                & Covered & Uncovered                & Covered & Uncovered               \\ \hline
Tester's utility     & 2 & -10                            & 7 & -4                             & 6 & -1                             & 9 & -9                             & 9 & -9                            \\ \hline
Developer's utility  & -7 & 4                             & -1 & 3                             & -6 & 5                             & -3 & 7                             & -10 & 3                           \\ \hline
\end{tabular}
\end{table*}}

• This is because the equations inside IEEEeqnarray is unbreakable, meaning that the entire block either has to fit on one page or another. In this case, there's just not enough space left on the "upper" page, so it goes to the "lower" page. As a result, in order to maintain a flush bottom, TeX inserts a gap in the paragraphs preceding the awful break. Not sure whether \raggedbottom (in the preamble) would help. Alternatively, set each equation in the IEEEeqnarray on its own; this would allow the contents to break mid-structure, which would be better visually. – Werner Aug 22 '13 at 2:02
• \raggedbottom adds whitespace after the paragraph. I'll have to check with the editors if it's okay though. – PhD Aug 22 '13 at 2:06

Since you're not really aligning elements within the IEEEeqnarray environment with one another, one option is to use separate equation environments for each equation, allowing TeX to naturally break between them, if needed:

\documentclass{IEEEtran}% http://ctan.org/pkg/IEEEtran
\usepackage{amsmath,lipsum}% http://ctan.org/pkg/{amsmath,lipsum}
\newcommand{\tester}{\tau}
\newcommand{\testercovered}{U_\tester^c(t)}
\newcommand{\testeruncovered}{U_\tester^\omega(t)}
\newcommand{\reqvector}{R}
\newcommand{\attackprob}{r_t}
\newcommand{\dev}{d}

\begin{document}

\subsection{Introduction}
\vspace{10\baselineskip}
\lipsum[1-8]

\subsection{Computing Tester/Developer Payoffs}
\label{subsec:payoffs}

In a security game defenders may employ mixed strategies i.e., selecting a
particular action with some probability as opposed to a deterministic
choice. This distribution decreases predictability of choice of
actions that may be exploited by an adversary. For our testing game we
refer to the set of distributions as a \textit{coverage vector}, $C$
that gives the probability, $c_t$, that a particular test suite $t$,
covering a particular requirement will be executed. We then compute
the expected payoffs for the testers and developers as shown in
Equations~\eqref{eqn:tC-EU} through~\eqref{eqn:attack-set}
%\begin{IEEEeqnarray}{c}
%  \label{eqn:tC-EU} U_\tester(t,C) = c_t \cdot \testercovered + (1-c_t)\cdot \testeruncovered \\
%  \label{eqn:CA-EU} U_\tester(C,\reqvector) = \sum_{t \in T} \attackprob \cdot (c_t \cdot \testercovered + (1-c_t)\cdot \testeruncovered) \\
%  \label{eqn:attack-set} \Gamma (C) = \{t:U_\dev(t,C) \geq U_\dev(t',C)\, \forall t' \in T\}
%\end{IEEEeqnarray}
$$\label{eqn:tC-EU} U_\tester(t,C) = c_t \cdot \testercovered + (1-c_t)\cdot \testeruncovered$$
$$\label{eqn:CA-EU} U_\tester(C,\reqvector) = \sum_{t \in T} \attackprob \cdot (c_t \cdot \testercovered + (1-c_t)\cdot \testeruncovered)$$
$$\label{eqn:attack-set} \Gamma (C) = \{t:U_\dev(t,C) \geq U_\dev(t',C)\, \forall t' \in T\}$$
%...remaining text
\end{document}


Uncomment the IEEEtran environment contents above to recreate the original problematic layout.

• i'd just like to note that in general, it's not a great idea to enter adjacent display equations separately -- the spacing can get really fouled up. (in a situation like the present one, it can be reasonable as a last resort.) since amsmath is being used, the gather environment might be appropriate, with \allowdisplaybreaks in the preamble. – barbara beeton Aug 22 '13 at 12:24

Note that the markup ugh ~\eqref{eqn: is incorrect at best it leads to a double space or if you are unlucky (as here) it can lead to the number ending on a line on its own. You need

ugh~\eqref{eqn:


with no space before the ~

Also you should not as a rule have a blank line before a displayed math environment (I'm not sure if the IEEE version of eqnarray avoids that issue, certainly it is wrong to precede a standard eqnarray or display math environment with a blank line.

(Please always post complete small documents that show the problem, not just fragments, it makes testing possible answers much easier)

So taking Werner's example but putting your eqnarray back, with and without the bad white space:

\documentclass{IEEEtran}% http://ctan.org/pkg/IEEEtran
\usepackage{amsmath,lipsum}% http://ctan.org/pkg/{amsmath,lipsum}
\newcommand{\tester}{\tau}
\newcommand{\testercovered}{U_\tester^c(t)}
\newcommand{\testeruncovered}{U_\tester^\omega(t)}
\newcommand{\reqvector}{R}
\newcommand{\attackprob}{r_t}
\newcommand{\dev}{d}

\begin{document}

\subsection{Introduction}
\vspace{10\baselineskip}
\lipsum[1-8]

\subsection{Computing Tester/Developer Payoffs}
\label{subsec:payoffs}

In a security game defenders may employ mixed strategies i.e., selecting a
particular action with some probability as opposed to a deterministic
choice. This distribution decreases predictability of choice of
actions that may be exploited by an adversary. For our testing game we
refer to the set of distributions as a \textit{coverage vector}, $C$
that gives the probability, $c_t$, that a particular test suite $t$,
covering a particular requirement will be executed. We then compute
the expected payoffs for the testers and developers as shown in
Equations~\eqref{eqn:tC-EU} through~\eqref{eqn:attack-set}
\begin{IEEEeqnarray}{c}
\label{eqn:tC-EU} U_\tester(t,C) = c_t \cdot \testercovered + (1-c_t)\cdot \testeruncovered \\
\label{eqn:CA-EU} U_\tester(C,\reqvector) = \sum_{t \in T} \attackprob \cdot (c_t \cdot \testercovered + (1-c_t)\cdot \testeruncovered) \\
\label{eqn:attack-set} \Gamma (C) = \{t:U_\dev(t,C) \geq U_\dev(t',C)\, \forall t' \in T\}
\end{IEEEeqnarray}
%...remaining text
\end{document}