OK, so the next question is -- what behavior do you want to see with the section titles? It wasn't clear. Keep in mind that, as usually formatted, the titles are themselves typeset as paragraphs, and hence are affected by spacing commands. Also, the space before and after will be affected by spacing applied to the paragraphs before and after them. But again, I'm not sure what look you're after.
Since you're having trouble tracking what's doing what, let's walk through your code and discuss what each part of it is doing. I'm going to suggest making some changes unrelated to your problems, just to clean things up a bit.
Code: Select all
\documentclass[12pt,a4paper]{article}
\usepackage[british]{babel}
Begins the article with 12pt fonts on A4 paper with British-style hyphenation rules. No problem here.
Code: Select all
\usepackage{microtype,times,pslatex}
The microtype package adds some microtypography rules. It's fine.
The times and pslatex packages are generally considered obsolete (see
l2tabu), though you can still use them. If you want Times fonts, I'd suggest using either
mathptmx or
txfonts packages. However, it would be best to load these after amsmath and after the fontenc package.
Code: Select all
\usepackage[sort&compress]{natbib}
As you probably know, this is for greater citation control.
Code: Select all
\usepackage[small,compact]{titlesec}
This is the package which is affecting the spacing of the titles -- if you don't want to make changes to how the titles are handled, I'd leave this package out altogether. If you do want to make changes to how titles are handled, this is the package to use.
Code: Select all
\newlength{\aftersection}
\setlength{\aftersection}{0pt}
\addtolength{\aftersection}{-1\parskip}
\newlength{\beforesection}
\setlength{\beforesection}{0pt}
\addtolength{\beforesection}{-1\parskip}
%\titlespacing*{\section}{0pt}{\beforesection}{\aftersection}
%\titlespacing*{\subsection}{0pt}{\beforesection}{\aftersection}
%\titlespacing*{\subsubsection}{0pt}{\beforesection}{\aftersection}
Here you define some new lengths, set them to one thing, and them immediately change them to something else. This is all a bit silly. Even sillier given that you've commented out the titlespacing* commands (from titlesec) that use these commands. Hence, as is, these commands do nothing at all. I'd just cut all this out. I'll make some suggestions about using titlesec below if you still want to.
Code: Select all
\setlength\abovedisplayskip{0pt}
\setlength\belowdisplayskip{0pt}
These commands remove the spacing before and after displayed math in your document. However, the \onehalfspacing command also sets these lengths. Since \onehalfspacing comes after these, these commands are overridden and hence have no effect. I think how \onehalfspacing works here is fine, but if you wanted these to do anything at all, you'd have to put them after \onehalfspacing. Personally, I'd just cut them out.
This removes extra space between items in the bibliography. It's fine if you want it that way.
Code: Select all
\usepackage[fleqn]{amsmath}
\usepackage[T1]{fontenc}
\usepackage[top=1.5cm,bottom=1.5cm,left=2.5cm,right=1.5cm]{geometry}
\usepackage{graphicx}
These are pretty standard things, but I'd the first three earlier in the preamble, since they affect the document in kind of a global way, and amsmath tends to cause problems if it's not loaded early.
This package is what provides the \onehalfspacing for changing the spacing for the document.
This is for rotating certain pages of the output when put into landscape. I assume you know why you need this here.
A natbib command for formatting internal citations. I assume you have this the way you want it.
Self-explanatory.
Code: Select all
\setcounter{page}{1}
\pagenumbering{arabic}
These do nothing in this context. The \pagenumbering command always resets the page number, so the first command would do nothing anyway, but since arabic is the default anyway, this is not necessary. But perhaps in your document there is something else before this.
The parindent value sets how far the first line of a paragraph is indented horizontally to the right. 0.3 inches seems like quite a lot to me -- personally I'd stick with the default, but if you like it that way, then fine. The parskip value is extra space added in between one paragraph and another, so here you're adding 1 point of space extra between paragraphs. Did you mean to do that? It does not seem compatible with what you said you wanted, so I'd cut at least the second line out.
A command from the geometry package to undo the effects of a previous \newgeometry command. Since you haven't used any of those, this does nothing.
This is the command from the setspace package which makes for one and a half-spacing.
So, if I were to clean that up, and do it my own way, I'd start with a document like this:
Code: Select all
\documentclass[12pt,a4paper]{article}
\usepackage[top=1.5cm,bottom=1.5cm,left=2.5cm,right=1.5cm]{geometry}
\usepackage{microtype}
\usepackage[UKenglish]{babel}
\usepackage[fleqn]{amsmath}
\usepackage[T1]{fontenc}
\usepackage{txfonts}
%
% put titlesec stuff here if you want
%
\usepackage[sort&compress]{natbib}
\setlength{\bibsep}{0pt}
\bibpunct{(}{)}{;}{a}{,}{;}
\usepackage{graphicx}
\usepackage{setspace}
\usepackage{pdflscape}
\begin{document}
\onehalfspacing
% rest of document
\end{document}
If I wanted to fiddle with the formatting and spacing of the titles, I'd load titlesec. (To me, the natural place to put this would be after loading txfonts but before loading natbib, but probably anywhere in the preamble would be fine.)
For maximal control, I'd skip options like compact and small and do my format with \titleformat and \titlespacing. Perhaps with the comments I put in, you can get a sense how these work. But do read the
titlesec documentation too.
Code: Select all
\usepackage{titlesec}
\titleformat{\section}% applies to section level
[hang]% shape of section title; see p.3 of titlesec doc
{\bfseries\large}% commands applied to whole title
{\thesection.}% the number
{0.5em}% space between number and title
{}% commands applied just to title, not number
\titlespacing*{\section}%
{0pt}% Space to left of section title
{0pt}% extra space before section title
{0pt}% extra space after section title
%
\titleformat{\subsection}% applies to subsection level
[hang]% shape of section title; see p.3 of titlesec doc
{\bfseries}% commands applied to whole title
{\thesubsection.}% the number
{0.5em}% space between number and title
{}% commands applied just to title, not number
\titlespacing*{\subsection}%
{0pt}% Space to left of subsection title
{0pt}% extra space before subsection title
{0pt}% extra space after subsection title
Note, that the spaces can be negative, so if you wanted to undo the effects of \onehalfspacing, you could put in e.g., a negative number for the extra space before a title.