[Tex/LaTex] How to remove spaces between paragraph and lines

spacing

enter image description here

In given below text, I want to remove space between "diverse areas" to "2.1.1 Brief…".

Best Answer

Based on my answer at Spacing before and after section titles, but with space removed rather than added. Here, I use \sectionprelude and if needed, \sectionpostlude to modify the default space before and after section headings. However, they can also be used to add ruled lines and other such stylistic modifications to the section head appearance.

Obviously, similar things can be done for subsections, etc.

\documentclass{article}
\usepackage{lipsum}
\makeatletter
\let\origsection\section
\renewcommand\section{\@ifstar{\starsection}{\nostarsection}}

\newcommand\nostarsection[1]
{\sectionprelude\origsection{#1}\sectionpostlude}

\newcommand\starsection[1]
{\sectionprelude\origsection*{#1}\sectionpostlude}

\newcommand\sectionprelude{%
  \vspace{-4ex}% STUFF TO DO PRIOR TO THE SECTION HEADING
}

\newcommand\sectionpostlude{%
%  \vspace{-2.5ex}% STUFF TO DO FOLLOWING THE SECTION HEADING
}
\makeatother
\begin{document}
\lipsum[4]
\section{Section Title}
\lipsum[1]
\end{document}

enter image description here