I have a document of 72 pages and page numbers in the table of contents are completely wrong. I'm trying to review everything step by step, so the first problem I've noticed is the following: I compile only the first part of the document:
% Style
\documentclass[a4paper,12pt]{report}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[english]{babel}
\setlength{\parindent}{0pt}
\usepackage[header]{appendix}
\usepackage[hidelinks]{hyperref}
\usepackage{lipsum}
% Figures
\usepackage{graphicx}
\usepackage{wrapfig}
\usepackage{float}
\usepackage{tikz}
\begin{document}
\begin{titlepage}
My title page
\vfill
\end{titlepage}
\section*{Preface}
\thispagestyle{plain}
\lipsum[1-2]
\begin{minipage}[b]{0.45\textwidth}
\begin{flushleft}
\rule{5cm}{2cm}
\end{flushleft}
\end{minipage}
\hspace{2mm}
\begin{minipage}[b]{0.45\textwidth}
\begin{flushright}
\rule{5cm}{2cm}
\end{flushright}
\end{minipage}
\begin{figure}[H]
\centering
\rule{1cm}{3cm}
\end{figure}
\chapter*{Abstract}
\thispagestyle{plain}
\lipsum[1-3]
\tableofcontents
\chapter{Introduction}
\end{document}
And what I get is
Contents:
1 Introduction p.5
while it should be
Contents
1 Introduction p.4
but when I comment the first two images, I get the right page number.
Does anybody know why this happens? I've compiled 3 times but I still have the same problem.
I've also tried substituting the minipages by
\begin{figure}[H]
\centering
\begin{subfigure}[b]{0.4\textwidth}
\centering
\includegraphics[width=\textwidth]{logo1.jpg}
\end{subfigure} \quad
\begin{subfigure}[b]{0.4\textwidth}
\centering
\includegraphics[width=\textwidth]{logo2.jpg}
\end{subfigure}
\end{figure}
but I have exactly the same problem.
\includegraphics
by\rule{1cm}[2cm}
(for some lengths that make sense) and produce an example that other people without the images can run to check the table of contents., then edit your question so in a single block it has everything from\documentclass
to\end{document}
for people to useminipage
norfigure
with[H]
to typeset graphic objects that have no caption.\includegraphics
; the picture then does not float in the document. BTW: welcome to TeX.SX :)