latex 目录相关设置

问题

使用 latex 模板,目录设置有诸多不如意的地方。经过一番学习,记录下常用见问题与解决命令

创建目录

分别创建了 目录,图目录,表目录。 由于 摘要等放在目录前,罗马数字编号也是从摘要编码,所以此处 \pagenumbering{roman} \setcounter{page}{1} 被注释掉了。

\cleardoublepage %\pagenumbering{roman} \setcounter{page}{1}    % Page number is set before
      \tableofcontents
\cleardoublepage \listoffigures
\cleardoublepage \listoftables

目录没有“摘要”等未编号的章节

在“摘要”这一章后面添加 \addcontentsline{toc}{chapter}{Abstract} 。在之前添加会导致点击目录“摘要”项链接到前一页。

\chapter*{Abstract}
\addcontentsline{toc}{chapter}{Abstract}          % show the "abstract" in contents, place this line after the chapter/section created

解决目录页中添加条目后,链接到错误页码的问题

使用 \addcontentsline{toc}{chapter}{Contents} 可以添加 “目录”这一项到目录页,但是会导致点击“Contents”这一项会链接到前一页。这个问题可以使用 \phantomsection 解决,注意必须把 \phantomsection 放到 \addcontentsline{toc}{chapter}{Contents}前面。

\cleardoublepage %\pagenumbering{roman} \setcounter{page}{1}    % Page number is set before
      \phantomsection            % use \phantomsection before \addcontentsline for content hyperlink to wrong pages
      \addcontentsline{toc}{chapter}{Contents}
      \tableofcontents
\cleardoublepage \listoffigures
\cleardoublepage \listoftables

目录页中章标题后面没有点延续到页码

使用 \renewcommand\cftchapdotsep{\cftdotsep} 给目录的章标题后面添加点延续到页码。需要头文件 \usepackage[subfigure]{tocloft},注意如果有报错,尝试加载 subfigure这个选项。

% add dotted line to the chapter without numbering, must "Load the tocloft package with the option subfigure."
\usepackage[subfigure]{tocloft}
\renewcommand\cftchapdotsep{\cftdotsep}

书签

书签导航栏可以快速定位到文章具体位置,也需要设置。此处设置 标题页 书签。

  • 只设置书签,不在目录中显示。
\pdfbookmark[0]{Title Page}{*}
或者
\pdfbookmark[0]{Title Page}{title}
  • 需要标题页出现在目录,使用前面提到的添加到目录的方法。
  % \phantomsection            % use \phantomsection before \addcontentsline for content hyperlink to wrong pages
  % \addcontentsline{toc}{chapter}{Title Page}

参考

备注

可能缺少部分头文件,相应查询上述命令的头文件并添加,没法提供模板。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值