2

MWE:

\documentclass{article}

%font
\usepackage{mathpazo}

\usepackage[english]{babel}

%change TOC header
\addto\captionsenglish{% Replace "english" with the language you use
  \renewcommand{\contentsname}%
    {Table of Contents}%
}

%remove numbering from TOC
\setcounter{secnumdepth}{0}

%omit subsections and lower levels from base TOC
\setcounter{tocdepth}{1}

%make TOC headers links, including minitoc subsections
\usepackage[bookmarks,bookmarksopen,bookmarksdepth=2]{hyperref}
\hypersetup{
    colorlinks,
    citecolor=black,
    filecolor=black,
    linkcolor=blue,
    urlcolor=blue
}


%mini TOCs in each section
\usepackage{minitoc}

\begin{document}
\begin{center}
\textbf{Title}
\end{center}
\dosecttoc
\tableofcontents
\newpage 

\section{Sect1}
\secttoc
\subsection{Sub1}
Stuff
\newpage 
\section{Sect2}
\secttoc
\subsection{Sub2}
Stuff2
\newpage 
\section{Test}
\end{document}

This gives me the following .pdf's first page:

enter image description here

If you were to try to click the links, you'll notice that none of them go to the intended pages. Why is this?

Another point of concern is the bookmark structure it has:

enter image description here

So, for some reason, it thinks that Sect2 is a subsubsection of Sect1, which is obviously not the case.

1

Use \usepackage{minitoc} before \usepackage{hyperref}, which should be the last package in almost any case (Exceptions are cleveref and glossaries), but it's no particular minitoc related issue -- it's valid for many packages dealing with ToC and counters.

minitoc does some changes to ToC and counters which must be made known to hyperref.

\documentclass{article}

%font
\usepackage{mathpazo}

\usepackage[english]{babel}

%change TOC header
\addto\captionsenglish{% Replace "english" with the language you use
  \renewcommand{\contentsname}%
    {Table of Contents}%
}

%remove numbering from TOC
\setcounter{secnumdepth}{0}

%omit subsections and lower levels from base TOC
\setcounter{tocdepth}{1}
%mini TOCs in each section
\usepackage{minitoc}

%make TOC headers links, including minitoc subsections

\usepackage[bookmarks,bookmarksopen,bookmarksdepth=2]{hyperref}
\hypersetup{
    colorlinks,
    citecolor=black,
    filecolor=black,
    linkcolor=blue,
    urlcolor=blue
}





\begin{document}
\begin{center}
\textbf{Title}
\end{center}
\dosecttoc
\tableofcontents
\newpage 

\section{Sect1}
\secttoc
\subsection{Sub1}
Stuff
\newpage 
\section{Sect2}
\secttoc
\subsection{Sub2}
Stuff2
\newpage 
\section{Test}
\end{document}

enter image description here

  • @Clarinetist: It's a common 'error' ;-) – user31729 Nov 17 '15 at 21:34

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.