[Tex/LaTex] Wrong roman numbering in toc

page-numberingroman numeralstable of contents

I have two types on numbering, roman for toc tof and tables and arabic for the document.

I'm using

\usepackage[hidelinks]{hyperref}
\usepackage{bookmark}

and the code is written this way.

\setcounter{page}{1}
\pagenumbering{roman}

\tableofcontents
\providecommand\phantomsection{}
\addcontentsline{toc}{chapter}{Contents}

\clearpage\thispagestyle{empty}\phantom{a}\mbox{}\clearpage

\listoffigures
\providecommand\phantomsection{}
\addcontentsline{toc}{chapter}{List of Figures}


\clearpage\thispagestyle{empty}\phantom{a}\mbox{}\clearpage

\listoftables
\providecommand\phantomsection{}
\addcontentsline{toc}{chapter}{List of Tables}

\clearpage\thispagestyle{empty}\phantom{a}\mbox{}\clearpage

enter image description here

As you can see in the index they are not correctly numbered. The numbers on toc correspond to the last page of each section.

Best Answer

With your current settings, the \addcontentsline commands are too late in the code (once the lists have been typeset). The correct order should be something like

\clearpage
\phantomsection
\addcontentsline{toc}{chapter}{Contents}
\tableofcontents

And similarly for the other lists.

Also, remove these lines:

\providecommand\phantomsection{}