2

Is it possible to have hyperlinked entries in the ToC, while hyperlink is disabled in minitoc?

1 Answer 1

3

Yes. Load the minitoc package before hyperref. Immediately after loading minitoc save the definition of \contentsline, the macro that prints the entries, in another macro. Via the command \beforeminitoc, restore the definition of \contentsline from the stored value. The small catch is that in the meantime, hyperref has changed the number of arguments required by \contentsline from 3 to 4, so you have to take that in to account in the code.

Table of contents:

Sample toc

Chapter:

Sample chapter

\documentclass{book}

\usepackage{minitoc}
\let\stdcontentsline\contentsline
\usepackage{hyperref}

\renewcommand{\beforeminitoc}{\renewcommand{\contentsline}[4]{\stdcontentsline{##1}{##2}{##3}}}

\begin{document}

\dominitoc
\tableofcontents

\chapter{One}
\minitoc

\section{First section}

\section{Second section}

\end{document}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .