0

I have a report type file (my thesis). I have no problems with the numbering in sections and subsections (the get enumerated by itself and appear correctly in the table of contents), but for the subsubsections, the numbering begins from 0 instead of 1 and also these are not getting shown in the table of the contents. In the following picture, we can see that the subsubsection begins his numbering from 0 (7.1.0) instead of 7.1.1 and also this is not getting shown in the table of contents.

Picture_bad_numbering

Picture_bad_table_of_contents

I have recompiled my code several times, so the problem is not about refreshing or updates in the code. Any ideas?, thanks in advance and greetings from Chile.

\documentclass[letterpaper,openright,12pt]{report}
%\usepackage[spanish]{babel} %Defino idioma como español
\usepackage{graphicx} % Para Añadir imagenes
\usepackage{subfigure} %Para las subfiguras
\usepackage{caption}
\usepackage{enumitem}
\usepackage{multicol}
\usepackage{float}
\usepackage{xcolor}
\usepackage{setspace}
\usepackage{tikz}
%\usepackage[spanish]{babel}
\usepackage[english]{babel}
%\selectlanguage{spanish}
\usepackage[utf8]{inputenc}
%\usepackage[usenames, dvipsnames]{color}
\usepackage{hyperref} % Para que el pdf referencie directamente las referencias
\usepackage{amssymb,amsmath,amsfonts} %para \textbf y otras cosas
\usepackage{setspace} %sirve para espaciado del documento entre otras cosas
%\usepackage{dsfont}% para conjunto entero, reales.
\usepackage{stackrel}%paquete matematico para algunos simbolos
\usepackage{comment}
\renewcommand{\thesection}{\thechapter.\number\numexpr\value{section}-1\relax}
\renewcommand{\thesubsection}{\thesection.\number\numexpr\value{subsection}-1\relax}
\renewcommand{\thesubsubsection}{\thesubsection.\number\numexpr\value{subsubsection}-1\relax}
\setcounter{secnumdepth}{3}
% nombre y ano
%\usepackage[latin1]{inputenc} 
%\usepackage[sort&compress]{natbib}
 % citations
%%%%%%%%% TABLAS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage{longtable}
\usepackage{multirow} % para las tablas
\usepackage{multicol}% Para separar columnas
\usepackage{booktabs}
%\usepackage{babelbib} %para que las referencias esten en español

\renewcommand{\thesection}{\arabic{section}}
\renewcommand{\thesubsection}{\arabic{section}.\arabic{subsection}}


%FORMATOS ESPECIFICOS MEMORIA
\setlength{\parindent}{0cm} %0 sangria
\spacing{1.5} %Espaciado
\usepackage{times} %Letra times new Roman
\usepackage{anysize}% Para definir margenes
\marginsize{3.5cm}{2cm}{2cm}{2cm}% Controla los márgenes {izquierda}{derecha}{arriba}{abajo}

%%%%%%%%%%%%%%%%%%%%%%INICIO: IMAGEN DE FONDO DE TODO EL DOCUMENTO%%%%%%%%%%%%%%%%%%%%%%%%%%%
%La opción pages puede ser all (para todo el documento) o some, para algunas partes del documento
%\usepackage[pages=all]{background}
% configuración
%\backgroundsetup{
%   scale=.2, %escala de la imagen, es recomendable que sea del mismo tamaño que el pdf
%   color=black, %fondo a usar para transparencia
%   opacity=0.2, %nivel de transparencia
%   angle=0, %en caso de querer una rotación
%   contents={
%       \includegraphics[width=\paperwidth,height=\paperheight]{escudo.png} %nombre de la imagen a utilizar como fonbfseries dasdasd \thecontentslabeldo
%   }
%}

\usepackage{titletoc}% http://ctan.org/pkg/titletoc
%\titlecontents{chapter}% <section-type>
%[0pt]% <left>
%%{\vspace{.08cm}}% <above-code>
%{}%{ \bfseries Cap\'itulo \thecontentslabel . \quad}% <numbered-entry-format>
%{\bfseries}% <numbered-entry-format>
%{\hfill \vfill}% <numberless-entry-format>
%{\bfseries \hfill \contentspage \vfill}% <filler-page-format>

\titlecontents{section}
    [0em] % Indentation
    {\addvspace{0em}\bfseries}
    {\normalsize CAP\'ITULO \thecontentslabel. \hspace*{0em} }
    {}
    {\titlerule*[0.3pc]{.}\contentspage}

\titlecontents{subsection}
    [1em] % Indentation
    {}
    {\hspace*{1em}\thecontentslabel \hspace*{1em}}
    {}
    {\titlerule*[0.3pc]{.}\contentspage}

\titlecontents{figure}
    [0em] % Indentation
    {}
    {\thecontentslabel \hspace*{1em}}
    {}
    {\titlerule*[0.3pc]{.}\contentspage}

\titlecontents{table}
    [0em] % Indentation
    {}
    {\thecontentslabel \hspace*{1em}}
    {}
    {\titlerule*[0.3pc]{.}\contentspage}


\setlength\abovedisplayskip{0pt}


%%%%%%%%%%%%%%%%%%%%%%FIN: IMAGEN DE FONDO DE TODO EL DOCUMENTO%%%%%%%%%%%%%%%%%%%%%%%%%%%
%\begin{comment}
%Formato del titulo de los capitulos
\usepackage{titlesec} %paquete para cambiar el formato de los titulos
%Formato secciones
\titleformat{\section}
{
%\vspace{.8ex}%
\bfseries
\Large}
{\thesection.}{.5em}{}
%formato capitulos
\newcommand{\bigrule}{\titlerule[0.5mm]}
{\vspace{-2cm}
\titleformat{\chapter}[block] % cambiamos el formato de los capítulos
{\vspace{-2.6cm}\bfseries\Huge} % por defecto se usarán caracteres de tamaño \Huge en negrita
{% contenido de la etiqueta
%\titlerule % línea horizontal
%\filright % texto alineado a la derecha
%\vspace{-2cm}
%\chaptertitlename % "Capítulo" o "Apéndice" en tamaño \Large en lugar de \Huge
%\chaptername 
%\hspace{.07cm} 
%\thechapter 
%\text{. }
} % número de capítulo en tamaño \Large
{2mm} % espacio mínimo entre etiqueta y cuerpo
{\filright} % texto del cuerpo alineado a la derecha
[\vspace{-9mm} ] % después del cuerpo, dejar espacio vertical y trazar línea horizontal gruesa

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%Numeracion de paginas en esquina superior derecha
\usepackage{fancyhdr}
% primera pagina de un capitulo
\fancypagestyle{plain}{
    \fancyhead[L]{}
    \fancyhead[C]{}
    \fancyhead[R]{}
    \fancyfoot[L]{}
    \fancyfoot[C]{Mag\'ister en Ingenier\'ia Industrial, Direcci\'on de Postgrado - Universidad de Concepci\'on}
    \fancyfoot[R]{\thepage}
    \renewcommand{\headrulewidth}{0pt}
    \renewcommand{\footrulewidth}{0pt}
}
\fancyhead[R]{}
\fancyhead[L]{}
\fancyhead[C]{}
\fancyfoot[L]{}
\fancyfoot[C]{Mag\'ister en Ingenier\'ia Industrial, Direcci\'on de Postgrado - Universidad de Concepci\'on}
\fancyfoot[R]{\thepage}
\renewcommand{\headrulewidth}{0 pt}
\pagestyle{fancy}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\makeatletter
\newcommand{\figsourcefont}{\footnotesize}
\newcommand{\figsource}[1]{%
  \addtocontents{lof}{%
    {\leftskip=\cftfigurenumwidth
    \advance \leftskip \cftfigureindent
    \rightskip=\@tocrmarg
     \figsourcefont\noindent#1\protect\par}%
  }%
 }
\makeatother
\begin{comment}

%%%%%%%%%%%%%%%%%%%%%% PARA MODIFICAR EL INDICE %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%5
\newcommand{\mychapter}[1]{
    \setcounter{chapter}{#1}
    \setcounter{section}{0}
    \setcounter{secnumdepth}{1}
    \chapter*{#1}
    \addcontentsline{toc}{chapter}{#1}
    \setcounter{tocdepth}{3}

}
\end{comment}
\usetikzlibrary{shadows,matrix}
\usepackage{tikz}
\usepackage{hyperref}
\setcounter{secnumdepth}{3}
\setcounter{section}{0}
\setcounter{tocdepth}{3}
  • 1
    Welcome to TeX.SE..Instead of providing image, please provide a MWE of your code what you tried. – MadyYuvi Sep 30 '19 at 4:58
  • It is too long, is almost my entire thesis and the problem is almost in the middle, that is why I did not want to post the code. – Hctor Alonso Hormazbal Vildsol Sep 30 '19 at 5:05
  • Make short (new) example of document, which reproduce your document. Without it we can't help you This document should contain part of your real document preamble which is related to section numbering. Instead of real text you can use text generated by lipsum package. – Zarko Sep 30 '19 at 5:55
  • Thanks for the advice, I am new in LaTex. I have edited my question. – Hctor Alonso Hormazbal Vildsol Sep 30 '19 at 6:34
  • As Zarko advised, we need a MWE, i.e., a small piece of code that can be copied and pasted and compiles. Your code does not end with a \end{document]. – Denis Sep 30 '19 at 6:53
0

Here is an example of a MWE (small and compilable)

\documentclass[12pt]{report}
\usepackage{lipsum}
\setcounter{secnumdepth}{3}
\begin{document}
\chapter{Ch1}
\lipsum[1]
\section{Se1}
\lipsum[1]
\subsection{SUb1}
\lipsum[1]
\subsubsection{SUb2}
\lipsum[1]
\end{document}

If you compile it, subsubsections will be numbered as desired.

In your code, the appearance of section numbers are redefined several times, whereas the default settings seems to give what you are looking for.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.