![书签、链接和页码问题](https://linux22.com/image/253906/%E4%B9%A6%E7%AD%BE%E3%80%81%E9%93%BE%E6%8E%A5%E5%92%8C%E9%A1%B5%E7%A0%81%E9%97%AE%E9%A2%98.png)
我的乳胶书有几个问题:
我想将附录书签作为部分级别的额外书签,现在它位于我的第二部分下。在目录中它是正确的,但在 pdf 书签上却不正确。
索引的书签链接不正确,如果我单击它,我会转到表格列表,而不是索引
页码完全错误。我怎样才能在前页使用大罗马字母,在正文中使用普通字母,而不会出现链接问题?我希望每一页都有页码,但现在没有页码或完全错误。
我的 Latex - 代码:
\documentclass{book}
\usepackage{geometry}
\geometry{left=4cm,right=3cm, top=2cm, bottom=2cm}
\usepackage{titlesec}
\titlespacing*{\chapter}{0pt}{-30pt}{20pt}
\titleformat{\chapter}[display]{\normalfont\huge\bfseries}{\chaptertitlename\\
hechapter}{20pt}{\Huge}
\usepackage[ngerman]{babel}
\usepackage{mathptmx}
\usepackage{helvet}
\usepackage{wallpaper}
\usepackage{color}
\usepackage[final]{pdfpages}
%,bookmarksopenlevel={1}
%\usepackage[bookmarks=true,bookmarksopen=true,bookmarksnumbered=true,colorlinks=true,linkcolor=black]{hyperref}
\usepackage[colorlinks,linkcolor=black,bookmarksopen=false]{hyperref}
\hypersetup{
pdftitle={test},
pdfauthor={\textcopyright test},
pdfsubject={test},
pdfkeywords={test},
}
\usepackage{xcolor,bookmark}
\usepackage{scrextend}
\usepackage{titlepic}
\usepackage{shorttoc}
\usepackage{courier}
%
\usepackage{type1cm}
\usepackage{makeidx} % allows index generation
\usepackage{graphicx} % standard LaTeX graphics tool
% when including figure files
\usepackage{multicol} % used for the two-column index
\usepackage[bottom]{footmisc}% places footnotes at page bottom
\usepackage{tocstyle}
\usetocstyle{allwithdot}
\makeindex % used for the subject index
% please use the style svind.ist with
% your makeindex program
\setcounter{tocdepth}{4}
\setcounter{secnumdepth}{4}
\begin{document}
\author{test}
\bookmark[page=\thepage,rellevel=1,keeplevel,view={XYZ},bold,color=blue]{Cover}
\includepdf{cover}
\pagestyle{empty}
\newpage
\section*{}
\newpage
\huge
\textbullet \hspace{0.1cm} test \hspace{-0.1cm} \textbullet\\
\\
\vspace{7cm}
\\
\large
test test\\
\vspace{4cm}
\\
\bookmark[page=\thepage,rellevel=1,keeplevel,view={XYZ},bold,color=blue]{Info}
Die Verlagsseite
\frontmatter
\include{dedic}
\newpage\section*{}
\include{foreword}
\newpage\section*{}
\include{preface}
\newpage\section*{}
\include{acknow}
\newpage\section*{}
\include{acronym}
%
\shorttableofcontents{Inhalts\"ubersicht}{1}
\bookmark[page=15,rellevel=1,keeplevel,view={XYZ},color=red]{Inhalts\"ubersicht}
\bookmark[page=17,rellevel=1,keeplevel,view={XYZ},color=red]{Inhaltsverzeichnis}
\tableofcontents
%
\mainmatter
\include{part1}
\include{chapter1}
\include{chapter2}
\include{part2}
\include{chapter3}
\include{chapter4}
\backmatter
\appendix
\include{appendix}
\listoffigures
\newpage
\listoftables
\backmatter%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%\include{glossary}
%\include{solutions}
\printindex
\addcontentsline{toc}{part}{Index}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\includepdf{ueberautor}
\includepdf{back}
\end{document}
我为此付出了很多努力,但还是找不到解决办法——如果你能帮助我,那就太好了。谢谢
答案1
1. 附录书签
书签包允许在顶层重新启动书签层次结构:
\bookmarksetup{startatroot}
如果附录是这样的
\chapter{Appendix}
那么目录中的条目将被格式化为章节,而不是部分。而不是
\bookmarksetup{startatroot}
\chapter{Appendix}
可以使用如下方法:
\cleardoublepage
\phantomsection
\addcontentsline{toc}{part}{\appendixname}
\chapter*{\appendixname}
解释,见2。
2. 索引书签
\printindex
\addcontentsline{toc}{part}{Index}
然后,您将从目录中索引的末尾获取页码。书签还需要一个可以通过设置的锚点\phantomsection
。
\cleardoublepage
\phantomsection % anchor setting
\addcontentsline{toc}{part}{\indexname}
\printindex
3. 页面书签链接
以下示例显示了如何从标签中获取正确的绝对页码以供使用\bookmark
。我在这里使用包zref
作为标签和参考,因为它提供了绝对页码和可扩展的提取方法。
\documentclass{book}
\usepackage[ngerman]{babel}
\usepackage{xcolor}
\usepackage{titlesec}
\titlespacing*{\chapter}{0pt}{-30pt}{20pt}
\titleformat{\chapter}[display]{\normalfont\huge\bfseries}{\chaptertitlename \thechapter}{20pt}{\Huge}
\usepackage[hidelinks,bookmarksopen=false]{hyperref}[2011/02/05]
\hypersetup{
pdftitle={test},
pdfauthor={\textcopyright test},
pdfsubject={test},
pdfkeywords={test},
}
\usepackage{bookmark}
\usepackage{shorttoc}
\usepackage{makeidx} % allows index generation
\makeindex
\usepackage{tocstyle}
\usetocstyle{allwithdot}
\usepackage{zref-abspage}
\makeatletter
\newcounter{zpage}
\renewcommand*{\thezpage}{pagelabel\the\value{zpage}}
\newcommand*{\pagebookmark}[2][]{%
\stepcounter{zpage}%
\zref@labelbyprops{\thezpage}{abspage}%
\zref@refused{\thezpage}%
\bookmark[{%
page=\zref@extractdefault{\thezpage}{abspage}{1},%
view={XYZ},%
#1%
}]{#2}%
}
\makeatother
\setcounter{tocdepth}{4}
\setcounter{secnumdepth}{4}
\author{test}
\begin{document}
\pagestyle{empty}
\hypersetup{pageanchor=false}
\pagebookmark[rellevel=1,keeplevel,bold,color=blue]{Cover}
\begin{center}
\fbox{\bfseries\Huge Cover}
\end{center}
\newpage
\null\newpage % empty page
% Verlagsseite
\pagebookmark[rellevel=1,keeplevel,bold,color=blue]{Info}
\begingroup
\huge
\textbullet \hspace{0.1cm} test \hspace{-0.1cm} \textbullet
\vspace{7cm}
\large
test test
\vspace{4cm}
Die Verlagsseite
\newpage
\endgroup
\frontmatter
\pagestyle{headings}% or whatever
\hypersetup{pageanchor=true}
\chapter*{Dedication}
\chapter*{Foreword}
\chapter*{Preface}
\chapter*{Acknowlegements}
\cleardoublepage
\pagebookmark[rellevel=1,keeplevel,color=red]{Inhalts\"ubersicht}
\shorttableofcontents{Inhalts\"ubersicht}{1}
\cleardoublepage
\pagebookmark[rellevel=1,keeplevel,color=red]{Inhaltsverzeichnis}
\tableofcontents
\mainmatter
\part{First part}
\chapter{First chapter}
\index{first}
\chapter{Second chapter}
\index{second}
\part{Second part}
\chapter{Third chapter}
\index{third}
\chapter{Fourth chapter}
\index{fourth}
\backmatter
\appendix
\bookmarksetup{startatroot}
\chapter{\appendixname}
\listoffigures
\listoftables
\cleardoublepage
\phantomsection
\addcontentsline{toc}{part}{\indexname}
\printindex
\end{document}
书签窗口:
4.空白页
\section*{}\newpage
不是创建空白页面的最佳方式,因为复杂度带来的副作用风险\section
太大。简单的\null
方式足以在页面上实现一些不可见的内容:
\null\newpage
如果需要的话,还可以抑制页眉/页脚:
\begingroup
\thispagestyle{empty}
\null
\newpage
\endgroup
但在上述情况下,通常一个简单的
\cleardoublepage
就足够了。
5. 隐形链接
由于文档用于打印,因此不可见的链接是有意义的。自2011/02/05 起,为此添加了hyperref
v6.82a 选项。hidelinks