GeneralTable of contents cannot compile with hypperref

LaTeX specific issues not fitting into one of the other forums of this category.
Tissie
Posts: 32
Joined: Wed Feb 18, 2009 9:40 pm

Table of contents cannot compile with hypperref

Post by Tissie »

Hi all,

I have a problem with my thesis document in LaTeX. I have written some chapters and included the hyperref package to get easy clickable links between sections and citations (This works). However, when I want to compile the table of contents (\tableofcontents) it wont create the pdf output.

If I then remove hypperref (%\usepackage{hyperref}) then it will compile with the ToC. But then I of course have no links.

Any suggestions on how to get both to play nicely together? OR why this happens?

Thanks!

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

User avatar
Stefan Kottwitz
Site Admin
Posts: 10321
Joined: Mon Mar 10, 2008 9:44 pm

Re: Table of contents cannot compile with hypperref

Post by Stefan Kottwitz »

Hi Tissie,

it would be good if you would post the error message here, or the complete .log file as attachment to a post.

Stefan
LaTeX.org admin
Tissie
Posts: 32
Joined: Wed Feb 18, 2009 9:40 pm

Re: Table of contents cannot compile with hypperref

Post by Tissie »

I have attached the log. Thanks for the fast reply.

I stress that if dont use either hyperrref or ToC, then it works fine. Only the combination of the two that mess it up
Attachments
Thesis_Main.log
Log file
(18.67 KiB) Downloaded 209 times
User avatar
Stefan Kottwitz
Site Admin
Posts: 10321
Joined: Mon Mar 10, 2008 9:44 pm

Table of contents cannot compile with hypperref

Post by Stefan Kottwitz »

This is the relevant part of the log:

Code: Select all

(E:\Dropbox\Thesis\Thesis\Thesis_Main.toc
! Argument of \contentsline has an extra }.
<inserted text> 
                \par 
l.2 \contentsline
                  {chapter}{\numberline {1}Growth \& Properties of Gold Nano...

? 
! Emergency stop.
<inserted text> 
                \par 
Since hyperref changes the way the ToC works, I recommend to delete the old .toc file and then compile again, twice: one time for generating the new .toc file, and another time for reading that in.

Stefan
LaTeX.org admin
Tissie
Posts: 32
Joined: Wed Feb 18, 2009 9:40 pm

Table of contents cannot compile with hypperref

Post by Tissie »

Thanks for your suggestion, however, it did not work. I get a similar error as before, but not identical

Code: Select all

(E:\Dropbox\Thesis\Thesis\Thesis_Main.toc
! Argument of \contentsline has an extra }.
<inserted text> 
                \par 
l.2 \contentsline
                  {part}{I\hspace {1em}Background \& Self-Assembly}{1}{part.1}
? 
! Emergency stop.
<inserted text> 
                \par 
l.2 \contentsline
                  {part}{I\hspace {1em}Background \& Self-Assembly}{1}{part.1}
End of file on the terminal!
User avatar
Stefan Kottwitz
Site Admin
Posts: 10321
Joined: Mon Mar 10, 2008 9:44 pm

Re: Table of contents cannot compile with hypperref

Post by Stefan Kottwitz »

Perhaps your thesis style file is not compatible with hyperref. Perhaps it can be fixed. I see you use mygrthesis.sty, could you post this as attachment? I would check it.

Stefan
LaTeX.org admin
Tissie
Posts: 32
Joined: Wed Feb 18, 2009 9:40 pm

Re: Table of contents cannot compile with hypperref

Post by Tissie »

Thanks Stefan, see attachment
Attachments
mygrthesis.sty
Style file
(4.38 KiB) Downloaded 243 times
User avatar
Stefan Kottwitz
Site Admin
Posts: 10321
Joined: Mon Mar 10, 2008 9:44 pm

Re: Table of contents cannot compile with hypperref

Post by Stefan Kottwitz »

No problem with this file - could you also attach your file macros.tex? It's also possible that the cause is there.

Stefan
LaTeX.org admin
Tissie
Posts: 32
Joined: Wed Feb 18, 2009 9:40 pm

Re: Table of contents cannot compile with hypperref

Post by Tissie »

Here you go
Attachments
macros.tex
(7.86 KiB) Downloaded 232 times
User avatar
Stefan Kottwitz
Site Admin
Posts: 10321
Joined: Mon Mar 10, 2008 9:44 pm

Table of contents cannot compile with hypperref

Post by Stefan Kottwitz »

Also this file doesn't cause it. We had to check since those files are customized, not standard LaTeX.

So the problem could still be in the main document. I guess we need to check that, even though I thought it could be sufficient to test your customized files together with a small document containing part and chapter, which are relevant for the problem here. But that's not enough.

So, we need a code which produces the error. Once the problem can be verified, I'm sure that can be fixed. But we need to verify it. For this, please post a minimal example which brings that error when compiled. This could be a hacked down copy of your original document, a very reduced copy. Just follow the link to know why and how.

Once we have a test file here, we could run that together with the already posted customized files. Just if there are further non-standard files, we might need them too, if they are related to the problem.

Well, I'm really sure it can be fixed easily, I just don't have your files here. ;-)

Stefan
LaTeX.org admin
Post Reply