![由于链接指向错误页面,因此覆盖目录中的页码](https://linux22.com/image/303353/%E7%94%B1%E4%BA%8E%E9%93%BE%E6%8E%A5%E6%8C%87%E5%90%91%E9%94%99%E8%AF%AF%E9%A1%B5%E9%9D%A2%EF%BC%8C%E5%9B%A0%E6%AD%A4%E8%A6%86%E7%9B%96%E7%9B%AE%E5%BD%95%E4%B8%AD%E7%9A%84%E9%A1%B5%E7%A0%81.png)
我遇到一个问题,我的目录声明我的文档的词汇表在第 xiv 页,而实际的缩写列表从第 xiii 页开始并在第 xiv 页结束。
TOC相关部分如下:
\tableofcontents
% Print glossary.
\glsaddall
\printglossary[type=acronym,title={List of Abbreviations}]
\addcontentsline{toc}{chapter}{List of Abbreviations}
% \printglossaries%[title={List of abbreviations}]
% Print algorithms.
\clearpage
\phantomsection
\addcontentsline{toc}{chapter}{List of Algorithms}
\listofalgorithms
\setcounter{chapter}{0}
% Print figures.
\clearpage
\phantomsection
\addcontentsline{toc}{chapter}{List of Figures}
\listoffigures
% Print tables.
\clearpage
\phantomsection
\addcontentsline{toc}{chapter}{List of Tables}
\listoftables
% Page headers and other elements in 'fancy' style.
\input{Formatting}
\clearpage
% CONTENTS. ---------------------------------------------------------------------------------------
\pagenumbering{arabic} % Force page numbering in Arabic to exclude the List of Tables.
目录中的所有其他链接都会转到正确的页面。
有人知道这是为什么吗?或者我可以手动设置词汇表的页码吗?
在这种情况下,我无法提供 MWE,尽管我可以说上述内容在虚拟文档中正常运行,但我不明白为什么它在主文档中失败。
答案1
您只需遵循与其他列表相同的模式即可:
\clearpage% \cleardoublepage for two-sided
\phantomsection
\addcontentsline...
\commandwhichprintslist...
所以:
\glsaddall
\clearpage
\phantomsection
\addcontentsline{toc}{chapter}{List of Abbreviations}
\printglossary[type=acronym,title={List of Abbreviations}]
答案2
glossaries
让ToC 中的包生成词汇表的正确方法是不要添加类似这样的行
\addcontentsline{toc}{chapter}{List of Abbreviations}
而只是在加载时将选项添加toc
到包中,例如glossaries
\usepackage[toc,........]{glossaries}