Document Classes ⇒ hyperref | Issue with custom Document Class
-
- Posts: 9
- Joined: Mon Oct 18, 2010 11:52 pm
hyperref | Issue with custom Document Class
I am currently trying to use my school's thesis document class, however it will not work with the hyperref package. I have contacted the graduate school, but no clue if I'll get any help from them... Anyways, I have attached a minimum code example below that uses their document class and macros file. It will compile great until you add the hyperref package. The error has to do with the \contentsline command... Any help figuring out why this is breaking it would be greatly appreciated!! Thanks!
- Attachments
-
- mythesis.tex
- (1.85 KiB) Downloaded 434 times
-
- macros.tex
- (865 Bytes) Downloaded 424 times
-
- thesis.cls
- (40.64 KiB) Downloaded 596 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
hyperref | Issue with custom Document Class
The solution is simple: search for \addtocontents in thesis.cls and replace each {\protect\relax}} by {\protect\relax}{}}. You should have the lines:
Code: Select all
\addtocontents{lof}{\protect\contentsline {part}
{\protect\figurenameToC}{\protect\relax}{}}
\addtocontents{lot}{\protect\contentsline {part}
{\protect\tablenameToC}{\protect\relax}{}}
\addtocontents{toc}{\protect\contentsline {part}
{\protect\chapternameToC}{\protect\relax}{}}
Code: Select all
\addtocontents{toc}{\protect\contentsline {part}
{\protect\appendixnameToC}{\protect\relax}{}}
If the above code works, contact your school in order to improve thesis.cls.
I also suggest you to treat your macros file as a package. To this end, rename macros.tex to macros.sty, add the line
Code: Select all
\RequirePackage{macros}
hyperref | Issue with custom Document Class
book
class and I don't think I want to change that. So, might there be some other way?Hopeful regards
--schremmer
- localghost
- Site Moderator
- Posts: 9202
- Joined: Fri Feb 02, 2007 12:06 pm
hyperref | Issue with custom Document Class
For an adequate problem description and in order to prevent other from guesswork kindly prepare a self-contained and minimal example that clearly reproduces the undesired behaviour.schremmer wrote:I have the same error with thebook
class and I don't think I want to change that. So, might there be some other way? […]
Thorsten
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10