Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- documentclass{book}
- usepackage[utf8]{inputenc}
- usepackage{tocloft}
- usepackage{hyperref}
- begin{document}
- tableofcontents
- %======== USING REGULAR ENTRIES ========
- chapter{Chapter 1} % properly linked of course
- {LARGE This is chapter 1}
- section{Section 1-1} % well linked as well
- {LARGE This is chapter 1 section 1}
- clearpage
- %======== USING addcontentsline ========
- phantomsection
- addcontentsline{toc}{chapter}{Chapter 2} % works fine
- {LARGE This is chapter 2}
- clearpage
- phantomsection
- addcontentsline{toc}{section}{Section 2-1} % link works
- {LARGE This is chapter 2 section 1}
- clearpage
- %======== USING addtocontents ========
- phantomsection
- addtocontents{toc}{protectcontentsline{chapter} % this link does not work
- {protectnumberline{3}Chapter 3}{thepage}{}}
- {LARGE This is chapter 3}
- clearpage
- phantomsection
- addtocontents{toc}{protectcontentsline{section}{protectnumberline{3-1}Section 3-1}{thepage}{section*.2.4}} % ... neither does this
- {LARGE This is chapter 3 section 1}
- clearpage
- end{document}
- chapter*.thechapter
- chapter*.thepage
- section*.thesection
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement