[Tex/LaTex] Controlling properties of sections and subsections

formattingsectioning

\documentclass[12pt, a4paper]{article}
\usepackage[
top=3.5cm, 
bottom=2cm, 
left=3.5cm, 
right=2cm, 
headsep=1.5cm,
]{geometry}
\usepackage{fancyhdr}
\usepackage{sectsty}
\pagestyle{fancy}
\renewcommand{\headrulewidth}{0pt}
\fancyhf{}
\fancyhead[R]{\thepage}
\usepackage{mathptmx}
\begin{document}
\section{INTRODUCTION}
\subsection{Background}
LOREM IPSUM is a graphical bla bla bla and is a bla bla bla that starts with nothing but that.
\subsubsection{Background}
LOREM IPSUM is a graphical bla bla bla and is a bla bla bla that starts with nothing but that.
\end{document}

Some of the points I need to fulfill are:

  1. A paragraph must be separated
    from the preceding and succeeding paragraphs by (2xCR). Here 2 * CR is a 2 * Carriage Return
  2. Main Heading such as 1, 2: They must precede the following text material or second heading by (3xCR).
  3. The number of the headings will be followed by a period and two spaces, where spaces mean two normal whitespaces.
  4. Second headings such as 1.1 must be (2xCR) below preceding text and (2xCR) of succeeding text, but need not a new page.
  5. Section should be 14pt. Subsequent subsections, paragraphs are to be 12pt.

I want these done in most generic way as possible. Pointers to how I could achieve them will be of great help.

Best Answer

What you're asking is not quite clear. What is a space? A half quad? You didn't specify the vertical spacing above section heading and nothing about subsubsections. The following code is a possibility, with the titlesec package and its companion titleps (so don't load fancyhdr), that lets me redefine very simply the plain style.

\documentclass[12pt, a4paper]{article}
\usepackage[
top=3.5cm,
bottom=2cm,
left=3.5cm,
right=2cm,
headsep=1.5cm,
]{geometry}

\usepackage{mathptmx}

\parskip=1\baselineskip
\parindent = 0pt

\usepackage{titlesec, titleps}

\titleformat{\section}[hang]{\bfseries\large}{\thesection.}{1em}{\MakeUppercase}
\titlespacing*{\section}{0pt}{1\baselineskip}{1\baselineskip}

\titleformat{\subsection}[hang]{\bfseries}{\thesubsection}{1em}{}
\titlespacing*{\subsection}{0pt}{1\baselineskip}{1\baselineskip}

\renewpagestyle{plain}{%
\sethead{}{\itshape\sectiontitle}{\thepage}
\setfoot{}{}{}
}

\pagestyle{plain}

\begin{document}

Text text text text text text text text text text text text text text text text text text text text text text text text text.

Text text text text text text text text text text text text text text text text text text text text text text text text text.

\section{Introduction}

\subsection{Background}
LOREM IPSUM is a graphical bla bla bla and is a bla bla bla that starts with nothing but that.

\subsubsection{Background}
LOREM IPSUM is a graphical bla bla bla and is a bla bla bla that starts with nothing but that.

\end{document} 

In the titleformat command, [hang]is the shape of the section title; hang is the default. The next argument is for general formatting of label + title. Then (4th argument) commands for the label.The fifth argument is the distance between label and title. Sixth argument is made upof commands for the title; the very last command can take an argument, which is the title; with option explicit, you can use #1 as an explicit argument for complex formattings.

The \titlespacing command has 3 arguments: the first is to increase (or decrease) the left margin. Secong argument is for the vertical separation between preceding text and section title. Third argument is vertical distance between section title and following text. The star version kills indentation at the beginning of the next paragraph.

enter image description here

Related Question