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{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}
\begin{subfigure}[b]{0.4\textwidth}
\centering
\includegraphics[width=\textwidth]{logo2.jpg}
\end{subfigure}
\end{figure}


but I have exactly the same problem.

• In the TOC I get pages 3,4,5,6,7,8,9,10 as I would expect given the setup. And you do not get 6,8,20 with the setup you provided. Please be a bit more specific about what your problem is? – daleif Sep 13 '13 at 10:00
• You will need at least 3 runs, did you try 4? – David Carlisle Sep 13 '13 at 10:15
• please try to replace your \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 use – David Carlisle Sep 13 '13 at 12:35
• @sandy.ale91 I get only three pages (but I don't know how big are your pictures). Note that you don't need neither minipage nor figure with [H] to typeset graphic objects that have no caption. – egreg Sep 13 '13 at 12:39
• @sandy.ale91: you can just use the usual \includegraphics; the picture then does not float in the document. BTW: welcome to TeX.SX :) – Claudio Fiandrino Sep 13 '13 at 13:40

I don't know what's wrong with minipage but finally I could solve the problem by always using subfigure and removing all the [H] from the figures and tables.