0

I'm writting my dissertation and have found a problem with my table of contents: all sections are numbered zero

enter image description here

How can I number the sections without the zeros? Below is a minimum working version of my code

\usepackage{graphicx}
\usepackage[a4paper,top=3cm,left=3cm,right=2cm,bottom=2cm]{geometry}
\usepackage{times}
\usepackage[utf8]{inputenc}
\usepackage[brazilian]{babel}
\usepackage{amsmath}
\DeclareMathOperator\arctanh{arctanh}
\DeclareMathOperator\diag{diag}
\DeclareMathOperator\sign{sign}
\usepackage{hyperref}
\usepackage[rawfloats=true]{floatrow}
\graphicspath{{Figuras/}}
\usepackage[utf8]{inputenc}
\usepackage{mathrsfs}
\usepackage{mathtools}
\usepackage{color}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{mathrsfs}
\usepackage[small,bf]{caption}
\usepackage{setspace}
\usepackage{natbib}
\usepackage{subfig}
\usepackage{MnSymbol}
\usepackage{dsfont}
\usepackage{scalerel,stackengine}
\stackMath
\newcommand\reallywidehat[1]{%
\savestack{\tmpbox}{\stretchto{%
  \scaleto{%
    \scalerel*[\widthof{\ensuremath{#1}}]{\kern-.6pt\bigwedge\kern-.6pt}%
    {\rule[-\textheight/2]{1ex}{\textheight}}%WIDTH-LIMITED BIG WEDGE
  }{\textheight}% 
}{0.5ex}}%
\stackon[1pt]{#1}{\tmpbox}%
}
\usepackage{multirow}
\usepackage{mathbbol}
\usepackage[toc,page]{appendix}

\usepackage{amsthm} \newtheorem{resumindo}{Resumindo} \newtheorem{definicao}{Definição} \newtheorem{propriedade}{Propriedade} \newtheorem{proposicao}{Proposição} \newtheorem{provaprop}{Prova da Proposição} \newtheorem{teorema}{Teorema} \newtheorem{prova}{Prova}

\title{} \author{ } \date{}

\renewcommand{\baselinestretch}{1.4} \linespread{1.3} \begin{document} \pagestyle{empty} \begin{center}

{\fontsize{16}{16} \selectfont Universidade de S\~ao Paulo \\}
\vspace{0.1cm}
{\fontsize{16}{16} \selectfont Instituto de F\'{i}sica}
\vspace{3.3cm}

{\fontsize{22}{22}\selectfont Titulo\par}
\vspace{2cm}


{\fontsize{18}{18}\selectfont Nome\par}

\vspace{2cm}

\end{center}

\leftskip 6cm \begin{flushright}
\leftskip 6cm Orientador(a): Prof. Dr.

\underline{ \hskip 5cm } \leftskip 6cm

\end{flushright}

\vspace{0.8cm}    



\par \leftskip 6cm \noindent {Disserta\c{c}~{a}o de mestrado apresentada ao Instituto de F'{i}sica da Universidade de S~{a}o Paulo, como requisito parcial para a obten\c{c}~{a}o do t'{i}tulo de Mestre em Ci^{e}ncias.} \par \leftskip 0cm \vskip 2cm

\noindent Banca Examinadora: \ Prof(a). Dr(a). Nome do(a) Professor(a) (institui\c{c}~{a}o de trabalho) \ Prof(a). Dr(a). Nome do(a) Professor(a) (institui\c{c}~{a}o de trabalho) \ \vspace{2.4cm}

\begin{center} {S~ao Paulo \ 2021} \end{center} \clearpage

\tableofcontents \newpage

\section{AAAAA} aaaa \section{BBBBB}

aa

\subsection{bbbbb} aaaa

\subsection{ccccc}

aaaa \subsubsection{ddddd} aaaaa \section{CCCC} aaaa

\begin{appendices} \section{AAAAA} aaaa

\section{BBBBB} aaaa

\end{appendices}

\end{document}

Rafael
  • 3

1 Answers1

0

In the book (and report) class the section numbers are preceded by the chapter number. As you aren't using \chapter in your MWE then the current value of the chapter number is 0.

If you insist on not using \chapter then change the section number representation by:

\renewcommand{\thesection}{\arabic{section}}

On the other hand, if you are not using chapters then why not use the article class or similar and you won't have to change anything.

Hopefully the following MWE will show you what you might want to do.

% secnumprob.tex  SE 580362
\documentclass{book}
\renewcommand{\thesection}{\arabic{section}} % no chapter number used

\begin{document} \tableofcontents \chapter*{A chapter} % unnumbered, just the title in the text \addcontentsline{toc}{chapter}{A chapter} % add the title to the ToC \section{First section} \section{Second} \subsection{A subsection} \end{document}

enter image description here

Peter Wilson
  • 28,066