Search code examples
latex

how to fix report numbering in latex


I am using latex to write my thesis and it has the following numbering structure which is quite confusing when I make reference to previous chapters. For example, if am in chapter 3 and want to reference a subsection in chapter 2, I use section \ref{section 1} and it's not clear which section 1 I want (chapter 1 or 2).

enter image description here

So, how do I change the above like the image below

enter image description here

Below is the code in my header then inside the document I use \chapter, \section and \subsection to distinguish them.

\documentclass[a4paper,11pt]{report}
% Preamble
\usepackage[utf8x]{inputenc}
\setcounter{tocdepth}{3}
\setcounter{secnumdepth}{3}
\usepackage{subfig}
\usepackage{fullpage}
\usepackage{tabularx}
\usepackage{comment}
\usepackage{color, colortbl}
\usepackage{graphicx}
\usepackage{url}
\usepackage{setspace}
\usepackage{float}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{varioref}
\usepackage{multirow}
\usepackage{hhline}
\renewcommand\thesection{\arabic{section}}
\usepackage{parskip}
\usepackage{algorithm}
\usepackage{algpseudocode}
\usepackage{caption}
\usepackage{tikz}
\usetikzlibrary{shapes.geometric, arrows}
\renewcommand{\arraystretch}{1.3}
\usepackage{lscape}
 \usepackage{multirow}
 
\usepackage{hyperref}
\hypersetup{
    colorlinks,
    citecolor=black,
    filecolor=black,
    linkcolor=black,
    urlcolor=black
}


\usepackage{longtable}

\setlength{\parindent}{0pt}

  [1]: https://i.sstatic.net/tsJLC.png
  [2]: https://i.sstatic.net/xNruu.png

\renewcommand\bibname{References}  % change title of references section
\newcommand{\myquote}[2]{\begin{center}\fbox{\begin{minipage}{.95\linewidth}#1\hfill #2\end{minipage}}\end{center}}
\newcommand{\source}[1]{\caption*{{#1}} }

\usepackage{natbib} \input{natbib-add}
\bibliographystyle{named}
\bibpunct{[}{]}{;}{a}{}{}
%\setlength{\skip\footins}{1.5cm}
\setlength{\intextsep}{10pt plus 2pt minus 2pt}

Solution

  • It's this line:

    \renewcommand\thesection{\arabic{section}}
    

    It changes the section numbering to start from 1, like the chapters already are. Just delete the line and the sections are numbered 1.1, 1.2, etc.