4

I want to disable hyperlink on only one entry of the table of contents. Actually, I have added a line of text in the table, corresponding to no real section, so I don't want any internal link on this text…

I know there is specific macros to disable hyperlink on references, but I have found nothing about entries of the ToC ?

Here's a MWE :

\documentclass{memoir}
\usepackage{hyperref}
\begin{document}
\tableofcontents*
\chapter{Chapter one}
\chapter{Chapter two}
\appendix
\cftaddtitleline{toc}{chapter}{Text that don't have to be clickable}{}
\chapter{Appendix}
\end{document}
  • Have you tried \chapter*? – Mico Mar 29 '16 at 23:19
3

One possibility is to use the original \addtocontents and \contentsline before hyperref transforms them to make hyperlinks possible -- those original versions are stored to \orig... using the \let primitive.

I've not used the memoir version right now.

\documentclass{memoir}
\let\origcontentsline\contentsline
\let\origaddtocontents\addtocontents
\usepackage{hyperref}
\begin{document}
\tableofcontents*
\chapter{Chapter one}
\chapter{Chapter two}
\appendix
\origaddtocontents{toc}{\protect\origcontentsline{chapter}{Text that don't have to be clickable}{}}
\chapter{Appendix}
\end{document}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.