我需要我的目录条目、索引中的条目和词汇表来将 PDF 阅读器导航到适当的位置。但是,加载包hyperref
会产生致命错误。我猜这与我自定义目录外观的方式有关,但我还没有足够的经验来弄清楚我在哪里以及如何混淆了程序。如何解决这个问题?
我的 MWE 是这个main.tex
文件:
\documentclass[10pt, paper=156mm:235mm, BCOR=12mm, headings=optiontotocandhead, headings=openany]{scrbook}
\usepackage[utf8]{inputenc}
\usepackage{lipsum}
\usepackage[dutch,british,UKenglish]{babel}
\KOMAoptions{headings=small}
\usepackage{typearea}
\usepackage{xcolor}
\usepackage{fnpct}
%commands re the ToC
\DeclareTOCStyleEntry[
linefill={},
]{tocline}{chapter}
\makeatletter
\newcommand \Dotfill {\leavevmode \leaders \hb@xt@ 0.75em{\hss .\hss }\hfill \kern \z@}
\makeatother
\newcommand{\toclineinsert}[3][14mm]{%
\Dotfill #2\makebox[#1][l]{#3\Dotfill}%
}
\title{MWE}
\author{name}
\date{now}
%everything re the glossary
\usepackage[toc]{glossaries}
\makeglossaries
\newglossaryentry{ips}
{
name=\emph{lorem},
description={Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Ut purus elit, vestibulum ut, placerat ac, adipiscing vitae, felis}
}
%commands relating to footnote formatting:
\KOMAoptions{footnotes=multiple}
\interfootnotelinepenalty=10000
\deffootnote{1em}{1em}{\color{lightgray}\thefootnotemark\ \ }
\setkomafont{footnote}{\sffamily}
\renewcommand*{\raggeddictumtext}{\raggedleft}
\usepackage{etoolbox}
\makeatletter
\pretocmd{\@schapter}{\setcounter{footnote}{0}}{}{}
\pretocmd{\@chapter}{\setcounter{footnote}{0}}{}{}
\makeatother
\usepackage[splitindex]{imakeidx}%Indexing package
\makeindex[intoc,options= -s index_style.ist,name=m,title=\mbox{Index},columns=2]
\makeindex[options= -s index_style.ist, intoc,name=p,title=\mbox{List of names},columns=2]
%enabling the entry of numberless footnotes that don't mess up the numbering
\makeatletter
\def\blfootnote{\xdef\@thefnmark{}\@footnotetext}
\makeatother
\usepackage[T1]{fontenc}
\usepackage{Alegreya,AlegreyaSans}
\renewcommand*\oldstylenums[1]{{\AlegreyaOsF #1}}
%hyphenation
\pretolerance=9000
\tolerance=2000
\emergencystretch=8pt
%\usepackage{hyperref}
\begin{document}
\frontmatter
\tableofcontents
\addchap[tocentry={\emph{Preface}}, head={\textsc{preface}}]
{Preface}
\lipsum[1-6]
\mainmatter
\setchapterpreamble[o]{%
\dictum[]{Location\\ Date}}
\addchap[tocentry={Lecture title \toclineinsert{\normalfont{ lecture date}}},head={}]{Lecture title}\index[m]{aaa|(}
\blfootnote{\newline \lipsum[1]
\newline}
Nam arcu libero, nonummy eget, consectetuer id, vulputate a,
magna. Donec vehicula augue eu neque. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Mauris ut leo. Cras viverra metus rhoncus sem\footnote{Lorem ipsum dolor sit amet}\index[m]{bbb!aaa}Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Ut purus elit, vestibulum ut, placerat ac, adipiscing vitae, felis. Curabitur dictum gravida
mauris.\index[m]{ccc!aaa|(}
Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Mauris ut leo. \index[m]{ddd}\index[m]{ddd!aaa} Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Mauris ut leo.\footnote{Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas.} Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas.\index[m]{eee}\index[m]{fff!aaa} Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas.\footnote{Mauris ut leo} Curabitur dictum gravida
mauris.\index[m]{ggg|(}.
Curabitur dictum gravida mauris\index[m]{hhh}\index[m]{hhh!aaa}. \lipsum[1] \index[m]{ggg|)}\index[m]{iii!aaa} \lipsum[1] \index[m]{jjj!kkk} \lipsum[1] \index[m]{kkk!jjj}. \lipsum[1] Mauris ut leo.\footnote{Curabitur dictum gravida
mauris}\footnote{Curabitur auctor semper nulla}\lipsum[1]\index[m]{ccc!aaa|)}
\index[m]{lll!aaa|(} Nam dui ligula, fringilla a, euismod sodales, sollicitudin vel, wisi. Morbi
auctor lorem non justo. Nam lacus libero, pretium at, lobortis vitae, ultricies et, tellus.\footnote{Sed diam turpis, molestie vitae, placerat a, molestie nec, leo. Maecenas lacinia} \lipsum[1]\index[m]{lll!aaa|)} \footnote{ Donec bibendum quam in tellus.
Nullam cursus pulvinar lectus}
\lipsum[1-2]\index[m]{mmm!aaa} \lipsum[1] \index[m]{nnn!aaa} Nam dui ligula, fringilla a, euismod sodales, sollicitudin vel, wisi. Morbi auctor lorem non justo\index[m]{ppp!aaa}, dui ligula, fringilla a, euismod sodales, sollicitudin vel, wisi. Morbi auctor lorem non justo.
\lipsum[1] \index[m]{ppp!bbb}.
\Gls{ips} ipsum. \lipsum[1]
\addsec*{Nam dui ligula}
Lorem ipsum dolor sit amet,\index[m]{ppp!ccc} consectetuer adipiscing elit. Ut purus elit, vestibulum ut, placerat ac, adipiscing vitae, felis. Curabitur dictum gravida mauris. Nam arcu libero, nonummy eget, consectetuer id, vulputate a, magna. Donec vehicula augue eu neque\index[m]{qqq!aaa}. Curabitur auctor semper nulla. Donec varius orci eget risus. Duis nibh mi, congue eu, accumsan eleifend, sagittis quis, diam. Duis eget orci sit amet orci dignissim rutrum.\index[m]{rrr!aaa} \lipsum[1] \index[m]{sss!aaa} Proin tempus nibh sit amet nisl. Vivamus quis tortor vitae
risus porta vehicula. \index[m]{aaa|)}
\printindex[m]
\printglossary
\end{document}
与此index_sty.ist
文件一起:
heading_prefix "\n\\raggedright\\large\\sffamily\\normalfont%
\\noindent\\textbf{"heading_suffix "}\\par\\nopagebreak\n"
item_0 "\n \\item \\small "
delim_0 " \\Dotfill "
delim_1 " \\Dotfill "
delim_2 " \\Dotfill "