# Extra Space between equation and line above that

How the distance between first line and equation and last line and equation is different. How to remove the extra space. I am using this code

 According to given assumption that n is a power of 2 or $n=2^k$
\begin{center}
\begin{equation} \label{eq:solve}
2T(n/2) + 1
\end{equation}
\end{center}


MWE

\documentclass{article}

\usepackage{fancyhdr} % Required for custom headers
\usepackage{lastpage} % Required to determine the last page for the footer
\usepackage{extramarks} % Required for headers and footers
\usepackage[usenames,dvipsnames]{color} % Required for custom colors
\usepackage{graphicx} % Required to insert images
\usepackage{listings} % Required for insertion of code
\usepackage{courier} % Required for the courier font
\usepackage{lipsum} % Used for inserting dummy 'Lorem ipsum' text into the template
\DeclarePairedDelimiter\Floor\lfloor\rfloor
\DeclarePairedDelimiter\Ceil\lceil\rceil

% Margins
\topmargin=-0.45in
\evensidemargin=0in
\oddsidemargin=0in
\textwidth=6.5in
\textheight=9.0in

\begin{document}
\begin{section}
According to given assumption that n is a power of 2 or $n=2^k$

\section{equation}
2T(n/2) + 1
\end{equation}

Using Master Theorem where a=2, b=2, d=0;

\end{document}

• Please post a compilable MWE, not just a code snippet.
– Mico
Apr 12, 2015 at 7:04
• what is compatible MWE ? Apr 12, 2015 at 7:05
– Mico
Apr 12, 2015 at 7:06
• Incidentally, where did you "learn" to encase an equation environment inside a center environment? (Remove the center environment code and the excess vertical space will disappear.)
– Mico
Apr 12, 2015 at 7:11
• The supplied MWE clearly does not produce the image shown. Apr 12, 2015 at 9:13

First of all, your MWE doesn't work because you wrote \section{equation} ... \end{equation}. Latex does not recognise these tags to be paired, so change the first one to \begin{equation}.

Delete the \begin{section} and \end{section} tags, they serve no purpose. If you want to start a chapter in your document (for the article class), then write \section{Title here}.

As it has also been suggested to you in the comments, leaving a blank line produces a wider vertical space. So for the following code:

According to given assumption that $n$ is a power of $2$ or $n=2^k$

\begin{equation}
2T(n/2) + 1
\end{equation}

According to given assumption that $n$ is a power of $2$ or $n=2^k$
\begin{equation}
2T(n/2) + 1
\end{equation}


You get this result. The first example shows more distance than the second one (although not that evident, it's still present). Your equation is already centered, so you don't need a center environment, which is what caused the huge space in your case. Also, it's for text anyway, not math, so you have no reason to be using it in this instance. For centering multiple equations, see this question: How do you center equations?