[Tex/LaTex] How to globally number pages automatically in LaTeX

page-numbering

I am new to LaTeX so definitely naïve in this topic. How do I number each pages automatically in LaTeX. The current page numbering is carried out on a chapter basis. It would restart the counter in next chapter and begin numbering again. So, how can I maintain a global counter that counts page from the first page all the way to the last? My document class is report.

\documentclass[pdftex,12pt,a4paper]{report}

———————I am update line ———————–

\usepackage[top=3cm, bottom=3cm, left=3.5cm, right=3cm]{geometry}

% graphics images
\usepackage[pdftex]{graphicx}

% 1.5 line spacing
\usepackage{setspace}
\onehalfspacing

% maths symbols
\usepackage{amsmath}

% table package
\usepackage{multirow}

% source code listing
\usepackage{listings}
\usepackage{color}
\usepackage{xcolor}

\usepackage{caption}


% citation style
\usepackage{apacite}
\DeclareCaptionFont{white}{\color{white}}
\DeclareCaptionFormat{listing}{\colorbox{gray}{\parbox{\textwidth}{#1#2#3}}}

\begin{document}


% cover
\input{cover_report.tex}

% title page
\input{title_report.tex}

% abstract
\setcounter{page}{1}
\pagenumbering{roman}
\input{abstract.tex}

% acknowledgement
\input{acknowledgements.tex}

% table of content
\tableofcontents
\addcontentsline{toc}{chapter}{Contents}

% list of tables
\listoftables
\addcontentsline{toc}{chapter}{List of Tables}

% list of figures
\listoffigures
\addcontentsline{toc}{chapter}{List of Figures}

% intro chapter
\cleardoublepage
\pagenumbering{arabic}
\input{intro.tex}

% intro chapter
\cleardoublepage
\pagenumbering{arabic}
\input{background.tex}

% intro chapter
\cleardoublepage
\pagenumbering{arabic}
\input{design.tex}

% intro chapter
\cleardoublepage
\pagenumbering{arabic}
\input{implementation.tex}

% intro chapter
\cleardoublepage
\pagenumbering{arabic}
\input{analysis.tex}

% intro chapter
\cleardoublepage
\pagenumbering{arabic}
\input{limit_future.tex}

% intro chapter
\cleardoublepage
\pagenumbering{arabic}
\input{conclusion.tex}

% references
\bibliographystyle{apacite}
\bibliography{my_ref}

% appendix
\end{document}

Best Answer

This is a minimal working example (MWE) that shows the problem:

\documentclass{report}
\usepackage{lipsum}
\begin{document}

\pagenumbering{roman}
\lipsum

\clearpage
\pagenumbering{arabic}
\lipsum

\clearpage
\pagenumbering{arabic}           %this causes the page numbering reset
\lipsum

\end{document}

The solution is to load \pagenumbering only once, when you want to switch between roman and arabic numbering.

Related Question