General ⇒ Table of contents cannot compile with hypperref
Re: Table of contents cannot compile with hypperref
Alright, I prepared a minimal example, please see attached .rar file
If you pdftexify it should work now. But if you remove the % in front of \tableofcontents on line 128 in Thesis_Main_Error.tex I get the error again.
I appreciate the help.
If you pdftexify it should work now. But if you remove the % in front of \tableofcontents on line 128 in Thesis_Main_Error.tex I get the error again.
I appreciate the help.
- Attachments
-
- Minimalexample.rar
- (30.99 KiB) Downloaded 219 times
NEW: TikZ book now 40% off at Amazon.com for a short time.
- Stefan Kottwitz
- Site Admin
- Posts: 10321
- Joined: Mon Mar 10, 2008 9:44 pm
Table of contents cannot compile with hypperref
As I said in my second post - it produces the error, but after I removed the Thesis_Main_Error.toc it worked. You can try. 
The .toc file originally contains:
You can see, in the first line there's a parameter missing, which means the hyperref anchor. This line is generated in a wrong way, perhaps by calling or redefining \addcontentsline or \addtocontents incorrectly.
Perhaps check your document for that. Or, modify the minimal example in a way that it brings the error also when the .toc file has been deleted, i.e. would be generated again.
Stefan

The .toc file originally contains:
Code: Select all
\contentsline {chapter}{Introduction}{{\pageref {chap:Introduction}}}
\contentsline {part}{I\hspace {1em}Testpart}{1}{part.1}
\contentsline {chapter}{\numberline {1}TestChapter}{3}{chapter.1}
\contentsline {section}{\numberline {1.1}Introduction}{3}{section.1.1}
\contentsline {subsection}{\numberline {1.1.1}blabla}{3}{subsection.1.1.1}
Perhaps check your document for that. Or, modify the minimal example in a way that it brings the error also when the .toc file has been deleted, i.e. would be generated again.
Stefan
LaTeX.org admin
Re: Table of contents cannot compile with hypperref
Okay, it does not work with deleting the ToC file in my real document. I reproduced this error in the minimal example by including a chapter where I call \addtocontents (see line 150 in the new Thesis_main_error)
- Attachments
-
- Minimalexample.rar
- (57.34 KiB) Downloaded 276 times
- Stefan Kottwitz
- Site Admin
- Posts: 10321
- Joined: Mon Mar 10, 2008 9:44 pm
Table of contents cannot compile with hypperref
Yes, that's the line where you use
Add another argument, which can be taken by
As guessed, a simple correction fixes it. I just guessed such a problematic line would be in your style file, not in the main document. Such things should be macros, not used repeatedly in the author part of a document.
Stefan
\contentsline
without the argument which is added by hyperref:Code: Select all
\addtocontents{toc}{\protect \contentsline
{chapter}{List of Publications}{{\protect \pageref{mypubs}}}}
\contentsline
, such as simply {}
:Code: Select all
\addtocontents{toc}{\protect \contentsline
{chapter}{List of Publications}{{\protect \pageref{mypubs}}}{}}
Stefan
LaTeX.org admin
Table of contents cannot compile with hypperref
Awesome, we are getting close, now I can compile. But my bibliography entrance in the ToC displays the page on which the bibliography ends.
My code for this is:
In the ToC it says that Biblio is on page 56 (the last page of the Biblio), but it actually starts on page 49.
Can I get it to read it correctly?
My code for this is:
Code: Select all
\bibliographystyle{bibgen}
\footnotesize{\bibliography{library}}
\addcontentsline{toc}{chapter}{Bibliography}
Can I get it to read it correctly?
- Stefan Kottwitz
- Site Admin
- Posts: 10321
- Joined: Mon Mar 10, 2008 9:44 pm
Table of contents cannot compile with hypperref
That's because you made the entry after the bibliography. Make it before, and insert
Note,
Stefan
\cleardoublepage
or \clearpage
also before to ensure that you don't make the entry too early.Code: Select all
\cleardoublepage
\addcontentsline{toc}{chapter}{Bibliography}
{
\footnotesize
\bibliography{library}
}
\footnotesize
and similar font size commands are declarations and don't have arguments. They work like switches. The effect can be limited by an environment, or a group or braces, respectively, as I did here.Stefan
LaTeX.org admin
Re: Table of contents cannot compile with hypperref
Super, it works now.
Thank you very much for your help, Stefan - I really appreciate it
Now with this solved I can focus on the actual writing.. hehe
Kind regards,
Tissie
Thank you very much for your help, Stefan - I really appreciate it

Now with this solved I can focus on the actual writing.. hehe
Kind regards,
Tissie