latex - LaTeX - 带有 hyperref 包的两页“1”
问题描述
编译 LaTeX 文档时,我得到两页编号为“1”的页面:首页和目录的第一页。这是一个MWE:
\documentclass[12pt,a4paper]{report}
\usepackage[english]{babel}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{hyperref}
\title{Title}
\begin{document}
\maketitle
\tableofcontents
\chapter{Chapter one}
\end{document}
编译时(简单地使用pdflatex file.tex
),我得到这个:
但是当我删除 line 时\usepackage{hyperref}
,页码很好。请注意,我需要这个包来链接到我的目录中的页面,但也许有更好的方法可以做到这一点。这里发生了什么?如何获得正常的页码?
提前致谢。
解决方案
\maketitle
在report
该类下将页码设置为1
标题页上的页码,但也将其从 1 重新启动为下一页。这就是为什么您为标题实现了虚拟页码 1,然后是 ToC 的实际页码 1。我在这里强调虚拟,因为\maketitle
在页面样式上设置标题,empty
以便在页眉/页脚中不打印任何内容。但是,在 Adobe Acrobat 中查看时,这些页码仍显示在工具栏中。
一种解决方法是手动将页面显示更改为更适合标题页的内容。例如,让我们调用标题页T
:
\documentclass{report}
\usepackage{hyperref}
\title{Title}
\author{Author}
\begin{document}
\begingroup
\renewcommand{\thepage}{T}
\maketitle % Page T
\endgroup
\tableofcontents % Page 1
\chapter{A chapter} % Page 2
\end{document}
推荐阅读
- r - Shinyapps.io 只加载帧,不加载图表
- javascript - 递归数独算法有效但返回错误
- vitess - 如何在 Vitess 代理上转发 Mysql 查询?
- android - Android Groovy Gradle 重构代码以避免重复
- python - 是否可以使用 RANSAC(随机样本一致性算法)对两个参数数据进行线性回归相关分析?
- java - 如何在 jar 的构建过程中从 'src/main/java' 中排除类?
- css - Material ui 将元素置于移动设备、台式机、平板电脑的底部响应式
- r - 具有多个输入的 R Shiny ObserveEvent
- kubernetes - 查找以前 pod 的日志
- sql - PostgreSQL — 选择 column1 where MIN(column2)