LaTeX 中的超链接不正确

发布于 2024-07-14 02:27:22 字数 188 浏览 6 评论 0原文

到目前为止,LaTeX 中的 hyperref 包已经自动正确链接了我报告中的所有项目。 但有一个没有正确链接,可能是因为我手动将其添加到目录中,如下所示:

\addcontentsline{toc}{chapter}{Bibliography}

如何修复此问题?

So far the hyperref package in LaTeX has automatically linked all the items in my report correctly. But there is one that did not get linked properly, possibly because I manually added it to the table of contents like this:

\addcontentsline{toc}{chapter}{Bibliography}

How do I fix this?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

北方。的韩爷 2024-07-21 02:27:22

您必须在 \addtocontentsline 之前或之后使用 \phantomsection 宏。 这指示 hyperref 在该点添加锚点。 另外,请考虑到您必须运行 LaTeX 多次才能使该锚点位于准确的位置。

You have to use the \phantomsection macro just before or after the \addtocontentsline. This instructs hyperref to add an anchor at that point. Also, take into account that you have to run LaTeX several times to make this anchor to be in the exact place.

另类 2024-07-21 02:27:22

如果您使用标准 LaTeX 文档类,例如 report,则可以使用 tocbibind 包,然后您将不需要 \addcontentsline 命令,超链接应该可以正常工作。 从文档中:

tocbibind 软件包可以将目录标题、图表列表、表格列表、参考书目和索引全部添加到目录中。

我还建议查看 memoir 课程,这也解决了这个问题。 它旨在替代标准的 reportbook 类,并提供大量用于自定义的选项和命令。

If you're using a standard LaTeX document class, such as report, you can use the tocbibind package, and then you won't need the \addcontentsline command and the hyperlinks should work correctly. From the documentation:

The tocbibind package enables the titles of the Table of Contents, the List of Figure, the List of Tables, the Bibliography and the Index all to be added to the Table of Contents.

I'd also suggest looking at the memoir class, which also solves this problem. It's intended to be a replacement for the standard report and book classes, and provides lots of options and commands for customisation.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文