Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- documentclass{book}
- usepackage{blindtext}
- usepackage{xparse}
- makeatletter
- letlatex@chapterchapter
- defcurrentchaptername{}
- NewDocumentCommand{notocchapter}{om}{%
- IfValueTF{#1}{%
- defcurrentchaptername{#1}
- }{%
- defcurrentchaptername{#2}
- }%
- begingroup
- renewcommand{addcontentsline}[3]{}% Do nothing for this chapter
- IfValueTF{#1}{%
- latex@chapter[#1]{#2}
- }{%
- latex@chapter{#2}
- }%
- endgroup
- }
- NewDocumentCommand{lookslikeachapterentrybutpointstosomewhereelse}{o}{%
- phantomsection
- IfValueTF{#1}{%
- addcontentsline{toc}{chapter}{protectnumberline{thechapter}#1}%
- }{%
- addcontentsline{toc}{chapter}{protectnumberline{thechapter}currentchaptername}
- }%
- }
- makeatother
- usepackage[linktocpage]{hyperref}
- begin{document}
- tableofcontents
- notocchapter{Some chapter}
- blindtext[20]
- lookslikeachapterentrybutpointstosomewhereelse
- chapter{Some other chapter}
- notocchapter{Another chapter}
- blindtext[40]
- lookslikeachapterentrybutpointstosomewhereelse[And now for something completely different]
- end{document}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement