I need all the numbering aligned left, sections and subsections slightly (0 or 2pt maybe?) on the right of chapter. Chapter and section all caps.
The screenshot will explain better what I need:
And this is my MWE:
\documentclass[a5paper]{abntex2}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[brazil]{babel}
\selectlanguage{brazil}
\usepackage{xcolor}
\usepackage{hyperref}
\hypersetup{
colorlinks = {true}, %Colours links instead of ugly boxes
urlcolor = {black}, %Colour for external hyperlinks
linkcolor = {black}, %Colour of internal links
citecolor = {black} %Colour of citations
}
\usepackage{titlesec}
\titleformat{\chapter}
{\fontfamily{phv}\selectfont\bfseries\LARGE}
{\MakeUppercase{\thechapter}}{15pt}{}
\titleformat{\section}
{\fontfamily{fvs}\selectfont\bfseries}
{\MakeUppercase{\thesection}}{15pt}{}
\begin{document}
\tableofcontents*
\chapter{Introdução}
\section{Objetivos}
\subsection{Objetivos gerais}
\subsection{Objetivos específicos}
\chapter{Exposição do tema}
\section{Tema Geral}
\subsection{Tema específico}
\end{document}
As you can see below, when I add \titleformat
for chapter, it gets an extra space (in red). Whats weird for me is that section has a titleformat but doesn't get buged.
Uppercase is not working for section, but bold is. abntex2
class is based on memoir
, but using memoir returns me chapters without dots and breaks other necessary things on my thesis.
What I get:
I did try etoc
and other packages, but it seems to me that I did something wrong that can be fixed without another package.
Or maybe there is indeed a conflict?
EDIT:
As suggested by cfr, I look at abntex2
manual for the upper case command, and it states doesn't affect ToC.
I also tried the sumario=tradicional
option which should use memoir
default ToC style, but I still get chapters with that weird space:
If I try to set
\makeatletter
\renewcommand*\l@chapter{\@dottedtocline{0}{0em}{3.2em}}
\makeatother
I get a undefined control error. It seems like titlesec is indeed inferring with ToC.
line 4: Undefined control sequence. ...ntrodu\IeC {\c c}\IeC{\~a}o}{3}{chapter.1}
line 8: Undefined control sequence. ...eC {\c c}\IeC{\~a}o do tema}{5}{chapter.2}
Those lines contains:
\contentsline {chapter}{\chapternumberline {1}Introdu\IeC {\c c}\IeC {\~a}o}{3}{chapter.1}
\contentsline {chapter}{\chapternumberline {2}Exposi\IeC {\c c}\IeC {\~a}o do tema}{5}{chapter.2}
titlesec
cannot be expected to work with arbitrary classes. The class you are using handles things in a certain way. Assuming that you can read the documentation, have a look to see how it tells you to do these things. (I can't read Portuguese so I'm just going by the code.)\makeatletter... \makeatother
. But perhaps that's just me.