Document Classes ⇒ hyperref | Issue with custom Document Class
-
jibberalan
- 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 451 times
-
- macros.tex
- (865 Bytes) Downloaded 442 times
-
- thesis.cls
- (40.64 KiB) Downloaded 612 times
Learn LaTeX easily with newest books:
The LaTeX Beginner's Guide: 2nd edition and perfect for students writing a thesis
The LaTeX Cookbook: 2nd edition full of practical examples for mathematics, physics, chemistry, and more
LaTeX Graphics with TikZ: the first book about TikZ for perfect drawings in your LaTeX thesis
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 thebookclass 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