找回密码
 快速注册
搜索
查看: 73|回复: 2

请教索引时第1页跳到目录页要怎么解决?

[复制链接]

413

主题

1558

回帖

1万

积分

积分
11498

显示全部楼层

abababa 发表于 2023-5-25 16:54 |阅读模式
如题,代码如下:
  1. \documentclass[12pt]{book}
  2. \usepackage{amsmath,bm,yhmath,amssymb,etoolbox,esvect,stmaryrd,cite,enumitem,extarrows,mathtools,ifthen}
  3. \usepackage[amsmath, thmmarks]{ntheorem}
  4. {
  5.         \theoremstyle{nonumberplain}
  6.         \theoremheaderfont{\indent\bfseries}
  7.         \theorembodyfont{\normalfont}
  8.         \theoremsymbol{\ensuremath{\Box}}
  9.         \newtheorem{proof}{证明}
  10. }
  11. %使用索引
  12. \usepackage{makeidx}
  13. \usepackage[pdfencoding=auto,psdextra,colorlinks,linkcolor=red,anchorcolor=blue,citecolor=blue]{hyperref}
  14. \makeindex
  15. \begin{document}
  16. \tableofcontents
  17. \mainmatter
  18. \chapter{First}
  19. \section{First of First}
  20. some text.\index{some text}
  21. \newpage
  22. aaa\index{aaa}
  23. \backmatter
  24. \addcontentsline{toc}{chapter}{索引}
  25. \renewcommand{\indexname}{索引}
  26. \printindex
  27. \end{document}
复制代码


用xelatex my,然后用makeindex my,最后再用xelatex my,生成my.pdf文件。文件的末尾是两个索引,对于aaa的索引,点击页码2后能正确跳到第2页,但是some text的索引就不能正确跳转,它跳到了第1页,就是目录页,请教这个要怎么解决呢?是不是我哪里写得不对?

68

主题

434

回帖

4269

积分

积分
4269

显示全部楼层

hejoseph 发表于 2023-5-26 10:47
本帖最后由 hejoseph 于 2023-5-26 11:46 编辑 \addcontentsline{toc}{chapter}{索引}这行前面再加这行:
\phantomsection
能修点pdf和目录页到索引的不正确,至于那个1不能正确暂时不知道怎么修改

413

主题

1558

回帖

1万

积分

积分
11498

显示全部楼层

 楼主| abababa 发表于 2023-5-26 15:08
hejoseph 发表于 2023-5-26 10:47
\addcontentsline{toc}{chapter}{索引}这行前面再加这行:
\phantomsection
能修点pdf和目录页到索引的不正 ...

是的,我也发现这个了,开始以为和主楼的是同一个问题,主楼的对了这个也能对,看起来不是这样。

主楼的那个,我暂时在\tableofcontents前面加了一个\frontmatter,用罗马数字来给目录页编号,这样从整个pdf看,就只有一个第一页了,就不会错了。

手机版|悠闲数学娱乐论坛(第3版)

GMT+8, 2025-3-4 12:27

Powered by Discuz!

× 快速回复 返回顶部 返回列表