请问如何将文本第一页加入目录和书签

发布于 2021-12-13 23:36:41

想问一下,latex自动生成目录的前提是我添加了'section'或'chapter'等命令。一般文档首页是一些文件名和作者信息等文字,但是不会使用'section'或'chapter'等命令,所以一般首页不会排进目录和书签。

如何让得第一页不用'section'或'chapter'等命令,在目录和书签生成类似于“第一页”的效果?

查看更多

关注者
0
被浏览
1.3k
2 个回答
LaTeXStudio
LaTeXStudio 2021-12-14
这家伙很懒,什么也没写!

参考这里:https://zhuanlan.zhihu.com/p/66434387

% preamble
% \usepackage{bookmark}

\section*{title 2}
% see definition of \Hy@MakeCurrentHref in hyperref.sty
\bookmark[dest=\HyperLocalCurrentHref, level=1]{title 2}

把不编号章节仅加入 PDF 书签

说明

  • 类似地,\bookmark 需要在章节标题命令之后使用。
  • dest 选项接受一个由 hyperref 定义的超链接目标(destination)
  • 带星号的章节标题命令(如\section*)会创建一个新的超链接目标,并将其储存在一系列命令中,\HyperLocalCurrentHref 是其中的一个。(暂不清楚 \HyperGlobalCurrentHref\HyperLocalCurrentHref\@currentHref 在应用上的差异。)
  • level 选项接受一个整数,用于表示书签的(绝对)层级。类似的还有接受相对层级的 rellevel 选项,详见 bookmark 宏包文档 1.2.5 节。

理论上,同样需要用户了解并修改相应命令的定义。
实际上,笔者还没发现提供相关功能的宏包。

雾月
雾月 2021-12-14
这家伙很懒,什么也没写!

使用 \phantomsection\addcontentsline

\documentclass{book}

\usepackage[colorlinks]{hyperref}
\usepackage{bookmark}
\usepackage{lipsum}

\begin{document}

% \hypersetup{pdfview=Fit}
\phantomsection
\addcontentsline{toc}{chapter}{Page One}
\begin{center}
\begin{minipage}{.7\textwidth}
{\hfill\bfseries\large Abstract\hfill}
\medskip

\parindent=2em
\small
\lipsum[11-12]
\end{minipage}
\end{center}


\cleardoublepage
% \hypersetup{pdfview=XYZ}
\phantomsection
\addcontentsline{toc}{chapter}{Contents}
\tableofcontents


\chapter{Chapter One}

\lipsum[1-3]

\section{Section One.One}

\lipsum[4-9]

\section{Section One.Two}

\chapter{Chapter Two}

\lipsum[10-13]

\end{document}

image.png
image.png

撰写答案

请登录后再发布答案,点击登录

发布
问题

分享
好友

手机
浏览

扫码手机浏览