梅威瑟:
\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}
这给了我以下 .pdf 的第一页:
如果您尝试点击这些链接,您会发现它们均未转到预期页面。这是为什么呢?
另一个值得关注的点是它的书签结构:
因此,出于某种原因,它认为 Sect2 是subsubsection
Sect1 的,但显然事实并非如此。
答案1
使用\usepackage{minitoc}
before ,它几乎在任何情况下都应该是最后一个包(和\usepackage{hyperref}
除外),但它没有特别相关的问题——它对处理和计数器的许多包都有效。cleveref
glossaries
minitoc
ToC
minitoc
对 ToC 和计数器做了一些必须让其知晓的更改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}