0

This question already has an answer here:

I´m trying and trying and the results are bad.

Sometimes, \tableofcontents use red text, other point to a page that is incorrect. If a part is in page 3, the TOC point to page 2.

Are there any package that runs well?, or.. how can I use \tableofcontents with good results?

TEX PDF

-------------- edited after Crhistopher comments -----

In this image you can see what I obtain and what I would like to obtain

enter image description here

Inm this code I view in TOC that 3 last items poit to page 4, when in reality they are in page 5.

\documentclass[12pt,a4paper]{article}
\usepackage[top=2.5cm, left=3.5cm, bottom=2.5cm, right=2.5cm]{geometry}  % Margenes de la normativa TFG

\usepackage{setspace} % para que no afecte el interlineado a las notas de pié de página
\usepackage{blindtext}  % para usar un texto-tipo de ejmplo Lore.... sin teclear a boleo, con \blindtext
\setstretch{1.5}

\usepackage{lipsum,blindtext}
\usepackage{hyperref}
\hypersetup{colorlinks=true, urlcolor=blue}

\usepackage[x11names]{xcolor}  % otra opcion sería \usepackage{xcolor}
%\usepackage{xcolor}
\usepackage{mathpazo}       % Fuente MathPazo
\usepackage{datetime}       % paquete para configurar formato de fecha y hora
\settimeformat{ampmtime}
\renewcommand*{\noon}{\pmname}

% ----------------------  PSTRICKS ---------------
\usepackage{pstricks}
\usepackage{pst-node}


\begin{document}

\tableofcontents


\part{Introducción General}


\part{Esquema de Funcionamiento}
\blindtext

\section{Búsqueda Tabú (Tabu Search)}
\blindtext
\section{Enfriamiento Simulado}
\blindtext
\section{Algoritmos Genéticos}


\part{Ejemplos de Aplicaciones Simples}
\blindtext
\section{Búsqueda Tabú (Tabu Search)}
\blindtext
\section{Enfriamiento Simulado}
\blindtext
\section{Algoritmos Genéticos}

\part{Análisis de su funcionamiento}

\section{Búsqueda Tabú (Tabu Search)}
\section{Enfriamiento Simulado}

\section{Algoritmos Genéticos}


\end{document}

marked as duplicate by jub0bs, Heiko Oberdiek, Masroor, Adam Liter, Jesse Apr 26 '14 at 15:44

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 4
    Please help us to help you and add a minimal working example (MWE) that illustrates your problem. It will be much easier for us to reproduce your situation and find out what the issue is when we see compilable code, starting with \documentclass{...} and ending with \end{document}. – user31729 Apr 26 '14 at 10:07
  • 1
    Perhaps, there are missing \phantomsection statements. And the answer to your question whether there are any packages, that run well, is yes. – user31729 Apr 26 '14 at 10:08
  • In addition to my first comment: The .tex file you provided in your dropbox is not working due to some \input statements for files not being available. – user31729 Apr 26 '14 at 12:36
  • @christian-hupfer, what is phantomsection for? – Mika Ike Apr 26 '14 at 15:52
  • If you set \setstretch{1.5} there is no wonder why you obtain such large vertical distances. – user31729 Apr 26 '14 at 17:03
1

the TOC generated by \tableofcontents 1st need to be twice compiled, if after that the links are wrong check your chapter/section/subsection's labels maybe they all are labeled the same that causes links to be bad, also the place you put labels must be right after chapter/section/subsection is declare:

\section[Section 1]{ Section 1 some Book}\labe{Sec-1}
\section[Section 2]{ Section 2 some Book}\labe{Sec-1}

if that doesn't work also try load this pack in the preamble:

\usepackage[pdftex=true,colorlinks=true,plainpages=true]{hyperref} %PDFLaTex
\hypersetup{linkcolor=blue} 
  • Yes, It´s possible that the solution to avoid problems is compile twice. :-)) increible!!! – Mika Ike Apr 26 '14 at 15:57

Not the answer you're looking for? Browse other questions tagged or ask your own question.