# Controlling properties of sections and subsections

\documentclass[12pt, a4paper]{article}
\usepackage[
top=3.5cm,
bottom=2cm,
left=3.5cm,
right=2cm,
]{geometry}
\usepackage{fancyhdr}
\usepackage{sectsty}
\pagestyle{fancy}
\fancyhf{}
\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.

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,
]{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}{%
\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.

• I do have to use fancyhdr since I have another formatting to follow for the pagenumbers.These numbers need to be at the right top corner with 2 cm distance from the edges of the paper. – tilaprimera Nov 20 '14 at 3:24
• What is the 0pt? and What is 1em? Could you give comments on the codes that you have put together? I have edited my question based on your queries, please take a look at it. – tilaprimera Nov 20 '14 at 3:26
• @tilaprimera: x pt is a length of x typographical points (~ 1/72 inch ~ 0.35 mm); em is another typographical length unit, which depends on the font that is used: it is the length of a capital M in the current font, so it is approximately twice the length of a lowercase letter such as a. – Bernard Nov 20 '14 at 10:03
• @tilaprimera: it's up to you to choose which package you want to use for headers and footers. Just be aware that everything fancyhdr can do can also be done by titleps. The main difference is that titleps doesn't have a predefined fancy style, so that you won't have any rule by default. – Bernard Nov 20 '14 at 10:07