There are two things you need to change:
the \sffamily
commands should be removed from those title formats where they are not relevant. \sffamily
switiches to sans serif
to get italics, add \itshape
to the format for subsection
Here is your example with these changes and each style made hang
:
\documentclass[b5paper, 11pt]{article} % Use this line for a4
\usepackage[T1]{fontenc}
\usepackage{mathptmx}
\usepackage{titlesec}
\titleformat{\section}[hang]
{\normalfont\fontsize{12}{15}\bfseries}
{\thesection}
{1em}
{\MakeUppercase}
\titleformat{\subsection}[hang]
{\normalfont\fontsize{12}{15}\itshape}
{\thesubsection}
{1em}
{}
\titleformat{\subsubsection}[hang]
{\normalfont\normalsize}
{\thesubsubsection}
{1em}
{}
\begin{document}
\section{Section one}
\subsection{Subsection one}
\subsubsection{Subsubsection one}
\end{document}
\bfseries
is producing the bold fonts. The specification \fontsize{12}{15}
tells LaTeX to choose a font of size 12pt
and set the baselineskip (the space from the base one line to the base of the next line) to 15pt
.
See fntguide
[texdoc fntguide
] for definitions of the font changing commands and the documentation of titlesec
[texdoc titlesec
] for further formatting commands for the titles.
Spacing around titles is specified using a different command. E.g.
\titlespacing{\section}{0pt}{*4}{*1.5}
means that sections are
- left indented
0pt
- have space
4ex
(four times the height an x) before them
- and space
1.5ex
after them
Actually the spacings are not 100%, but have some stretchability, to allow LaTeX to fit material in to pages nicely. If do not want that variablity then you can write
\titlespacing{\section}{0pt}{4ex}{1.5ex}
or use other units such as
\titlespacing{\section}{0pt}{20pt}{8pt}
although I would not recommend it.