# How to set all titles levels of a document following strict rules?

I'm writing a document with very specific rules:

• Section: 14 pt, bold, uppercase
• Subsection: 12 pt, bold, uppercase
• Subsubsection: 12 pt, bold
• Paragraph: 12 pt
• Document spacing: 1.5
• Space between paragraphs: a line
• Space after titles: a line
• Numbering: Up to level 4 (paragraph)
• Numbering: space-space (1 - Text)

Here is an example:

Until now, I changed the titles font and size with sectsty package, the document spacing with linespread{1.3}, the numbering up to level 4.

I still need

• to add the hyphen in the numbering
• to set the space between paragraphs, and titles and paragraphs
• to add a line break after level 4 (paragraph)

How can I do this using the least amount of packages

\documentclass[12pt,a4paper]{article}
\usepackage{blindtext}
\usepackage[brazil]{babel}
\usepackage{mathptmx}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}%
\usepackage[
left=3.00cm,
right=2.00cm,
top=3.00cm,
bottom=2.00cm
]{geometry}
\usepackage{graphicx}
%%%%%%%%%%
\usepackage{sectsty}
\partfont{\centering}
\chapterfont{\raggedright\Large\MakeUppercase}
\sectionfont{\raggedright\large\MakeUppercase}
\subsectionfont{\raggedright\normalsize\MakeUppercase}
\subsubsectionfont{\raggedright}
\paragraphfont{\raggedright\normalfont}
%%%%%%%%%%
\setcounter{secnumdepth}{4}
\setcounter{tocdepth}{4}

\begin{document}
\blinddocument
\end{document}

• I suggest you take a look at the titlesec package. – Bernard Jun 27 at 18:39
• Related: tex.stackexchange.com/questions/60209/…. I think you'd be better served with KOMA-Script (see on of the answers at the link above). – Joseph Jun 27 at 20:48
• Every time I see something like this, I know it's the dreaded ABNT-customization challenge. – Joseph Jun 27 at 20:52

You wrote,

I still need
to add the hyphen in the numbering
to set the space between paragraphs, and titles and paragraphs
to add a line break after level 4 (paragraph)


I will assume that you will be using the article document class.

For the first item, I suggest you insert the following instructions in the preamble:

\makeatletter
\def\@seccntformat#1{\csname the#1\endcsname\space- }
\makeatother


Incidentally, should you need to insert an "en-dash" rather than a hyphen, simply replace - with -- in the preceding code block.

For the second item, I suggest you load the parskip package with the options skip=1\baselineskip and indent. (Specifying the latter option preserves the non-zero default indentation of paragraphs.

Before turning to the third item, I would like to suggest that you

• replace \usepackage{mathptmx} with \usepackage{newtxtext,newtxmath} (the mathptmx package is really olde,

• replace \linespread{1.3} with \usepackage[nodisplayskipstretch]{setspace} \setstretch{1.3} (don't manipulate a low-level parameter such as \linespread directly), and

• replace \sectionfont{\raggedright\large\MakeUppercase} with \sectionfont{\raggedright\fontsize{14}{16.8}. (If the main document font size is 12pt, then \large corresponnds to 14.4pt, not 14pt.)

Finally, regarding the objective of having a line break after \paragraph-level headers: I suggest you add the following code to the preamble:

\usepackage{etoolbox}
\makeatletter
\renewcommand\paragraph{\@startsection{paragraph}{4}%
{\z@}{-3.25ex\@plus -1ex \@minus -.2ex}%
{1.5ex \@plus .2ex}{\normalfont\normalsize}}
\makeatother


A full MWE (minimum working example):

\documentclass[12pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[left=3cm,right=2cm,top=3cm,bottom=2cm]{geometry}
\usepackage[brazil]{babel}

\usepackage{graphicx}
\usepackage{lipsum} % for filler text

%%\usepackage{mathptmx}
\usepackage{newtxtext,newtxmath}

\usepackage{sectsty}
\partfont{\centering}
%%\chapterfont{\raggedright\Large\MakeUppercase} % not needed
%%\sectionfont{\raggedright\large\MakeUppercase}
\sectionfont{\raggedright\fontsize{14}{16.8}\selectfont\MakeUppercase}
\subsectionfont{\raggedright\normalsize\MakeUppercase}
\subsubsectionfont{\raggedright}
\paragraphfont{\raggedright\normalfont}

\setcounter{secnumdepth}{4}
\setcounter{tocdepth}{4}

%%\linespread{1.3} % don't manipulate this macro directly
\usepackage[nodisplayskipstretch]{setspace}
\setstretch{1.3} % BTW: why not "1.5"?

%% And here's the all-new code:
\makeatletter

% Extra space between paragraphs:
\usepackage[indent,skip=1\baselineskip]{parskip}

% Insert "-" (dash) between sectioning numbers and text:
\def\@seccntformat#1{\csname the#1\endcsname\space- }

% Line break after \paragraph-level headers:
\usepackage{etoolbox}
\renewcommand\paragraph{\@startsection{paragraph}{4}%
{\z@}{-3.25ex\@plus -0.75ex \@minus -.1ex}%
{1ex \@plus .2ex}{\normalfont\normalsize}}

\makeatother  % end of new-code block

\begin{document}