# White space when adding text to equations

I have typed several equations after each other. Now I want to add text to these equations to explain them. However, when I do this a random huge white space shows between the equations. I have attached a picture of what is happening. Does anybody know how to fix this.

Update: Reduced code is added. As can be seen (when compiled) this white space is random, as it is appearing now before the last equation (with some code removed).

\documentclass[a4paper,12pt]{article}

\usepackage{cite}               % To cite bibliography
\usepackage{graphicx}           % Insert figures
\usepackage{chngcntr}           % Avoiding counter reset per chapter
\usepackage[toc,page]{appendix} % To use appendix
\usepackage{hhline}             % For \hhline
\usepackage{hyperref}           % For \url{}
\usepackage{amsmath}            % Equations
\usepackage{floatrow}           % Caption of Table top and figure placements
\usepackage{bm}
\usepackage{listings,multicol}

\newcommand\tab[1][1cm]{\hspace*{#1}}
\graphicspath{ {images/} }              % Location of figures
\floatsetup[table]{capposition=top}     % Caption of Table top
\setlength{\abovedisplayshortskip}{-1pt}% Equation spacing
\setlength{\belowdisplayshortskip}{0pt} % Equation spacing

\begin{document}

\setcounter{tocdepth}{4}
\setcounter{secnumdepth}{4}
\renewcommand{\thesection}{\arabic{section}}    % fix section numbering
\setlength{\belowdisplayskip}{3cm}

\cleardoublepage
\pagenumbering{gobble}
\tableofcontents
\cleardoublepage
\pagenumbering{arabic}

\section{Question 1}
\subsection{a)}
The far-field phasor-domain magnetic field pattern of the antenna is given in Eq. \ref{eq:h}.

$$\bm{\tilde{H}} = (\frac{jI_0}{2\pi}\frac{e^{-j\beta r}}{r})(\frac{cos(\frac{\beta L}{2}cos\theta)-cos(\frac{\beta L}{2})}{sin\theta})\bm{\hat{\phi}} \label{eq:h}$$

$$\bm{\hat{r}} \times \bm{\hat{\phi}} = -\bm{\hat{\theta}} \label{eq:r}$$

The derived far-field electric field is shown in Eq. \ref{eq:e}.

$$\begin{split} \bm{\tilde{E}} & = -\eta_0\bm{\hat{r}}\times \bm{\tilde{H}} \\ & = \eta_0(\frac{jI_0}{2\pi}\frac{e^{-j\beta r}}{r})(\frac{cos(\frac{\beta L}{2}cos\theta)-cos(\frac{\beta L}{2})}{sin\theta})\bm{\hat{\theta}} \label{eq:e} \end{split}$$

\subsection{b)}
The time-averaged power density radiated in the far-field is derived in Eq. \ref{eq:p}.

$$\begin{split} \bm{P_{av}} & = 0.5Re\{\bm{\tilde{E}} \times \bm{\tilde{H^*}}\} \\ & = 0.5Re\{-\eta_0\bm{\hat{r}}(\frac{jI_0}{2\pi}\frac{e^{-j\beta r}}{r})^2(\frac{cos(\frac{\beta L}{2}cos\theta)-cos(\frac{\beta L}{2})}{sin\theta})^2\} \\ & = \frac{15I_0^2}{\pi r^2}(\frac{cos(\frac{\beta L}{2}cos\theta)-cos(\frac{\beta L}{2})}{sin\theta})^2\bm{\hat{r}} \label{eq:p} \end{split}$$

$$\text{where } \eta_0 = \sqrt{\frac{\mu_0}{\varepsilon_0}} \cong 120\pi \text{ (free space)}$$

\end{document}

• Welcome to TeX SX! Could you post a full compilable code, so we can test what's happening? – Bernard May 4 '17 at 12:44
• I did not add the code, because it is rather long and has many dependencies on files and images. I'll try to mimize this and add it. – Matthias May 4 '17 at 12:49
• Never leave a blank line before any displayed equation (equation, align etc) the spacing will be completely wrong with a spurious white one-line paragraph before the display – David Carlisle May 4 '17 at 12:59
• Also better to use the geometry package to change the layout, there are many parameters that needs to dance together, adjusting some may require readjusting others, geometry does this automatically. – daleif May 4 '17 at 13:01
• Hehe, what is that change to \belowdisplayskip doing there? – daleif May 4 '17 at 13:04

There should never be a blank line before a displayed equation, or two succesive displays, however the main cause of the weird spacing was your settings of the space around equations which varied between excessively large (3cm) and negative (-1pt).

Also \cos and \sin not cos and sin.

\documentclass[a4paper,12pt]{article}

\usepackage{cite}               % To cite bibliography
\usepackage{graphicx}           % Insert figures
\usepackage{chngcntr}           % Avoiding counter reset per chapter
\usepackage[toc,page]{appendix} % To use appendix
\usepackage{hhline}             % For \hhline
\usepackage{hyperref}           % For \url{}
\usepackage{amsmath}            % Equations
\usepackage{floatrow}           % Caption of Table top and figure placements
\usepackage{bm}
\usepackage{listings,multicol}

\newcommand\tab[1][1cm]{\hspace*{#1}}
\graphicspath{ {images/} }              % Location of figures
\floatsetup[table]{capposition=top}     % Caption of Table top
%NO!! \setlength{\abovedisplayshortskip}{-1pt}% Equation spacing
%NO!!\setlength{\belowdisplayshortskip}{0pt} % Equation spacing

\begin{document}

\setcounter{tocdepth}{4}
\setcounter{secnumdepth}{4}
\renewcommand{\thesection}{\arabic{section}}    % fix section numbering
% ?????\setlength{\belowdisplayskip}{3cm}

\cleardoublepage
\pagenumbering{gobble}
\tableofcontents
\cleardoublepage
\pagenumbering{arabic}

\section{Question 1}
\subsection{a)}
The far-field phasor-domain magnetic field pattern of the antenna is given in Eq. \ref{eq:h}.
\begin{gather}
\bm{\tilde{H}} = (\frac{jI_0}{2\pi}\frac{e^{-j\beta r}}{r})(\frac{\cos(\frac{\beta L}{2}\cos\theta)-\cos(\frac{\beta L}{2})}{\sin\theta})\bm{\hat{\phi}}
\label{eq:h}\\
\bm{\hat{r}} \times \bm{\hat{\phi}} = -\bm{\hat{\theta}}
\label{eq:r}
\end{gather}

The derived far-field electric field is shown in Eq. \ref{eq:e}.
$$\begin{split} \bm{\tilde{E}} & = -\eta_0\bm{\hat{r}}\times \bm{\tilde{H}} \\ & = \eta_0(\frac{jI_0}{2\pi}\frac{e^{-j\beta r}}{r})(\frac{\cos(\frac{\beta L}{2}\cos\theta)-\cos(\frac{\beta L}{2})}{\sin\theta})\bm{\hat{\theta}} \label{eq:e} \end{split}$$

\subsection{b)}
The time-averaged power density radiated in the far-field is derived in Eq. \ref{eq:p}.
\begin{gather}
\begin{split}
\bm{P_{av}} & = 0.5Re\{\bm{\tilde{E}} \times \bm{\tilde{H^*}}\} \\
& = 0.5Re\{-\eta_0\bm{\hat{r}}(\frac{jI_0}{2\pi}\frac{e^{-j\beta r}}{r})^2(\frac{\cos(\frac{\beta L}{2}\cos\theta)-\cos(\frac{\beta L}{2})}{\sin\theta})^2\} \\
& = \frac{15I_0^2}{\pi r^2}(\frac{\cos(\frac{\beta L}{2}\cos\theta)-\cos(\frac{\beta L}{2})}{\sin\theta})^2\bm{\hat{r}}
\label{eq:p}
\end{split}\\
\text{where } \eta_0 = \sqrt{\frac{\mu_0}{\varepsilon_0}} \cong 120\pi \text{ (free space)}
\end{gather}

\end{document}


Here is another variant. The white space was a consequence of the redefinition of \belowdisplayskip (3cm!).

You should not have a series of consecutive equation environments. For such cases, you should use align or gather. Also note the usual functions require a backslash to be properly typeset since they're maths operators. I defined Re as an operator (\Rre, as \Re is already defined) to have a correct interletter spacing, otherwise, it is typed as the producr of the two variables R and e.

\documentclass[a4paper,12pt]{article}

\usepackage{cite} % To cite bibliography
\usepackage{graphicx} % Insert figures
\usepackage{chngcntr} % Avoiding counter reset per chapter
\usepackage[toc,page]{appendix} % To use appendix
\usepackage{hhline} % For \hhline
\usepackage{amsmath} % Equations
\usepackage{floatrow} % Caption of Table top and figure placements
\usepackage{bm}
\usepackage{listings,multicol}

\usepackage{hyperref} % For \url{}

\newcommand\tab[1][1cm]{\hspace*{#1}}
\graphicspath{ {images/} } % Location of figures
\floatsetup[table]{capposition=top} % Caption of Table top
\setlength{\abovedisplayshortskip}{-1pt}% Equation spacing
\setlength{\belowdisplayshortskip}{0pt} % Equation spacing
\DeclareMathOperator{\Rre}{Re}

\begin{document}

\setcounter{tocdepth}{4}
\setcounter{secnumdepth}{4}
\renewcommand{\thesection}{\arabic{section}} % fix section numbering
%\setlength{\belowdisplayskip}{3cm}

\cleardoublepage
\pagenumbering{gobble}
\tableofcontents
\cleardoublepage
\pagenumbering{arabic}

\section{Question 1}
\subsection{a)}
The far-field phasor-domain magnetic field pattern of the antenna is given in Eq. \ref{eq:h}.
\begin{gather}
\bm{\tilde{H}} =\biggl (\frac{jI_0}{2\pi}\frac{e^{-j\beta r}}{r}\biggr)\biggl(\frac{\cos(\frac{\beta L}{2}\cos\theta)-\cos(\frac{\beta L}{2})}{\sin\theta}\biggr)\bm{\hat{\phi}}
\label{eq:h}\\
\bm{\hat{r}} \times \bm{\hat{\phi}} = -\bm{\hat{\theta}}
\label{eq:r}\\
\intertext{The derived far-field electric field is shown in Eq. \ref{eq:e}.}
\begin{aligned}
\bm{\tilde{E}} & = -\eta_0\bm{\hat{r}}\times \bm{\tilde{H}} \\
& = \eta_0\biggl(\frac{jI_0}{2\pi}\frac{e^{-j\beta r}}{r}\biggr)\biggl(\frac{\cos(\frac{\beta L}{2}\cos\theta)-\cos(\frac{\beta L}{2})}{\sin\theta}\biggr)\bm{\hat{\theta}}
\label{eq:e}
\end{aligned}
\end{gather}

\subsection{b)}
The time-averaged power density radiated in the far-field is derived in Eq. \ref{eq:p}.
\begin{align}
& \begin{aligned}
\bm{P_\mathrm{av}} & = 0.5\Rre\bigl\{\bm{\tilde{E}} \times \bm{\tilde{H^*}}\bigr\} \\
& = 0.5 \Rre\biggl\{-\eta_0\bm{\hat{r}}\biggl(\frac{jI_0}{2\pi}\frac{e^{-j\beta r}}{r}\biggr)^{\!\!2}\biggl(\frac{\cos(\frac{\beta L}{2}\cos\theta)-\cos(\frac{\beta L}{2})}{\sin\theta}\biggr)^{\!\!2}\biggr\} \\
& = \frac{15I_0^2}{\pi r^2}\biggl(\frac{\cos(\frac{\beta L}{2}\cos\theta)-\cos(\frac{\beta L}{2})}{\sin\theta}\biggr)^{\!\!2}\bm{\hat{r}}
\label{eq:p}
\end{aligned}\\
&\rlap{where $\eta_0 = \sqrt{\dfrac{\mu_0}{\varepsilon_0}} \cong 120\pi$ (free space)}\notag
\end{align}

\end{document}


• you've still a blank line before gather – David Carlisle May 4 '17 at 13:48
• Oh! yes. Thanks for pointing it! 'Tis fixed now. – Bernard May 4 '17 at 14:07

You have the following (too many) settings for spacing around equations:

\setlength{\abovedisplayshortskip}{-1pt}% Equation spacing
\setlength{\belowdisplayshortskip}{0pt} % Equation spacing
\setlength{\belowdisplayskip}{3cm}


the last of which is responsible for that too much space after the equation. I also fixed some issues like size of parentheses using \bigl, \biggl, ..., \bigr, \biggr and sin, cos, and Re

\documentclass[a4paper,12pt]{article}

\addtolength{\oddsidemargin}{-1.cm}

\usepackage{cite}               % To cite bibliography
\usepackage{graphicx}           % Insert figures
\usepackage{chngcntr}           % Avoiding counter reset per chapter
\usepackage[toc,page]{appendix} % To use appendix
\usepackage{hhline}             % For \hhline
\usepackage{hyperref}           % For \url{}
\usepackage{amsmath}            % Equations
\usepackage{floatrow}           % Caption of Table top and figure placements
\usepackage{bm}
\usepackage{listings,multicol}

\newcommand\tab[1][1cm]{\hspace*{#1}}
\graphicspath{ {images/} }              % Location of figures
\floatsetup[table]{capposition=top}     % Caption of Table top
%\setlength{\abovedisplayshortskip}{-1pt}% Equation spacing
%\setlength{\belowdisplayshortskip}{0pt} % Equation spacing

\begin{document}

\setcounter{tocdepth}{4}
\setcounter{secnumdepth}{4}
\renewcommand{\thesection}{\arabic{section}}    % fix section numbering
%\setlength{\belowdisplayskip}{3cm}

\cleardoublepage
\pagenumbering{gobble}
\tableofcontents
\cleardoublepage
\pagenumbering{arabic}

\section{Question 1}
\subsection{a)}
The far-field phasor-domain magnetic field pattern of the antenna is given in Eq. \ref{eq:h}.

$$\bm{\tilde{H}} = \biggl(\frac{jI_0}{2\pi}\frac{e^{-j\beta r}}{r}\biggr)\biggl(\frac{\cos(\frac{\beta L}{2}\cos\theta)-\cos(\frac{\beta L}{2})}{\sin\theta}\biggr)\bm{\hat{\phi}} \label{eq:h}$$
%
$$\bm{\hat{r}} \times \bm{\hat{\phi}} = -\bm{\hat{\theta}} \label{eq:r}$$
%
The derived far-field electric field is shown in Eq. \ref{eq:e}.
%
$$\begin{split} \bm{\tilde{E}} & = -\eta_0\bm{\hat{r}}\times \bm{\tilde{H}} \\ & = \eta_0\biggl(\frac{jI_0}{2\pi}\frac{e^{-j\beta r}}{r}\biggr)\biggl(\frac{\cos(\frac{\beta L}{2}\cos\theta)-\cos(\frac{\beta L}{2})}{\sin\theta}\biggr)\bm{\hat{\theta}} \label{eq:e} \end{split}$$

\subsection{b)}
The time-averaged power density radiated in the far-field is derived in Eq. \ref{eq:p}.
%
$$\begin{split} \bm{P_{av}} & = 0.5\,\mathrm{Re}\bigl\{\bm{\tilde{E}} \times \bm{\tilde{H^*}}\bigr\} \\ & = 0.5\,\mathrm{Re}\biggl\{-\eta_0\bm{\hat{r}}\biggl(\frac{jI_0}{2\pi}\frac{e^{-j\beta r}}{r}\biggr)^2\biggl(\frac{\cos(\frac{\beta L}{2}\cos\theta)-\cos(\frac{\beta L}{2})}{\sin\theta}\biggr)^2\biggr\} \\ & = \frac{15I_0^2}{\pi r^2}\biggl(\frac{\cos(\frac{\beta L}{2}\cos\theta)-\cos(\frac{\beta L}{2})}{\sin\theta}\biggr)^2\bm{\hat{r}} \label{eq:p} \end{split}$$
%
where $\eta_0 = \sqrt{\frac{\mu_0}{\varepsilon_0}} \cong 120\pi$ \text{ (free space)}

\end{document}


Bp.png