General ⇒ Table of contents cannot compile with hypperref
Re: Table of contents cannot compile with hypperref
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.
And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p
- Stefan Kottwitz
- Site Admin
- Posts: 10324
- Joined: Mon Mar 10, 2008 9:44 pm
Table of contents cannot compile with hypperref

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
Re: Table of contents cannot compile with hypperref
- Attachments
-
- Minimalexample.rar
- (57.34 KiB) Downloaded 277 times
- Stefan Kottwitz
- Site Admin
- Posts: 10324
- Joined: Mon Mar 10, 2008 9:44 pm
Table of contents cannot compile with hypperref
\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
Table of contents cannot compile with hypperref
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: 10324
- Joined: Mon Mar 10, 2008 9:44 pm
Table of contents cannot compile with hypperref
\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
Re: Table of contents cannot compile with hypperref
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