这个问题是我上一个问题的后续隐藏目录中的部分但在 pdfbookmark 中显示它。
当我在 XeLaTeX 中编译我的代码时,它在 TeXworks 中完美地显示出来。只有一组 pdfbookmarks。请参见下图右侧部分。
当我在 Preview 或 Adobe Reader 中打开该文件时,突然出现了一组额外的书签,这些书签来自\section{}
我的代码中的命令。请参见图片左侧。
当我删除\section{}
命令并随意摆弄时,\setcounter{section}{0}
我的\firsttitlemarks\thesubsection
标题变得一团糟。1:1-2:4 变成 1:2-2:4等。
关于如何在不破坏标题标记的情况下删除这些额外书签,有什么想法吗?
\documentclass[paper=a5,pagesize=pdftex]{scrbook}
\usepackage[top=2cm,bottom=1.5cm, left=1.5cm, right=1.5cm]{geometry}
\usepackage[pagestyles]{titlesec}
\usepackage{lettrine}
\usepackage{xltxtra}
\usepackage{tocloft}
\usepackage{etoolbox}
\usepackage[toc]{multitoc}
\usepackage{setspace}
\renewcommand{\thesection}{\arabic{section}}
\renewcommand{\thesubsection}{\arabic{subsection}}
\newcommand\Text{And every plant of the field before it was in the earth, and every herb of the field before it grew: for the LORD God had not caused it to rain upon the earth, and there was not a man to till the ground.}
\setcounter{tocdepth}{0}
\defaultfontfeatures{Mapping=tex-text}
\setmainfont{Cardo}
% definition of the page style with required headers
\newpagestyle{Biblestyle}{
\setheadrule{.02pt}
\sethead[\thepage][\chaptertitle][\firsttitlemarks\thesection:\ifthesubsection{\firsttitlemarks\thesubsection}{1}---\bottitlemarks\thesection:\bottitlemarks\thesubsection]{\firsttitlemarks\thesection:\ifthesubsection{\firsttitlemarks\thesubsection}{1}---\bottitlemarks\thesection:\bottitlemarks\thesubsection}{\chaptertitle}{\thepage}
}
% sets the marks to be used (section and subsection)
\setmarks{section}{subsection}
% sections and subsections formatting
\titleformat{\section}{}{\lettrine{\thesection}}{0em}{}[\vskip-1\baselineskip]
\titleformat{\subsection}[runin]
{\small\bfseries}{\thesubsection}{1em}{}
\titlespacing{\section}{1em}{-1pt}{0pt}
\titlespacing{\subsection}{0pt}{0pt}{1em}
\setlength{\parindent}{0pt}
\newlength\NumLen
\newlength\LinLen
% indents one line of text. Indentation= width of section number + 1em
\newcommand\IndOne{%
\settowidth\NumLen{\thesection}
\addtolength\NumLen{1em}
\setlength\LinLen{\dimexpr\textwidth-\NumLen}%\the\NumLen\the\LinLen
\parshape 2 \NumLen \LinLen 0pt \textwidth}
% indents two lines of text. Indentation= width of section number + 1em
\newcommand\IndTwo{%
\settowidth\NumLen{\thesection}
\addtolength\NumLen{1em}
\setlength\LinLen{\dimexpr\textwidth-\NumLen}%\the\NumLen\the\LinLen
\parshape 3 \NumLen \LinLen \NumLen \LinLen 0pt \textwidth}
\usepackage[none]{hyphenat}
\sloppy
\usepackage{hyperref}
\hypersetup{
bookmarksdepth=1,
unicode=true,
colorlinks=true,
citecolor={black},
linkcolor={black},
urlcolor={black},
pdffitwindow=true,
}
\addtokomafont{disposition}{\rmfamily\mdseries}
\renewcommand{\contentsname}{Table of Contents}
\renewcommand*\cfttoctitlefont{\huge\hfill}
\renewcommand*\cftaftertoctitle{\hfill}
\renewcommand{\cftchapdotsep}{\cftdot}
\renewcommand{\cftpartfont}{\hfill\bfseries}
\renewcommand{\cftchapfont}{\mdseries}
\renewcommand{\cftpartpagefont}{\hfill\footnotesize\bfseries}
\renewcommand{\cftchappagefont}{\mdseries}
\setlength{\cftbeforetoctitleskip}{-4em}
\setlength{\cftaftertoctitleskip}{3em}
\setlength{\cftbeforechapskip}{.3em}
\setlength{\cftbeforepartskip}{.3em}
\setlength{\columnsep}{2pc}
\setlength\columnseprule{.4pt}
\begin{document}
\frontmatter
% Titlepage
\pdfbookmark[0]{Titlepage}{title}
\title{}
\subject{
\vspace{3cm}
\textbf{\Large{THE}\\\vspace{-0.3cm}
\Huge{HOLY}\\\vspace{0.05cm}
\Huge{BIBLE}}\\\vspace{0.5cm}
\author{} \date{}
}
\maketitle
\cleardoublepage
\pdfbookmark[0]{\contentsname}{tofcontents}
\begin{spacing}{0.01}
\tableofcontents
\end{spacing}
\cleardoublepage
\mainmatter
\pagestyle{Biblestyle}
\newlength{\myIndent}
\begin{center}
\phantomsection
\addcontentsline{toc}{part}{Old Testament}\noindent
\phantomsection
\addcontentsline{toc}{chapter}{Genesis}\noindent
THE FIRST BOOK OF MOSES, CALLED\\
\vspace{0.15cm}\textbf{\Huge{GENESIS}}\vspace{0.00cm}\\
\end{center}
\renewcommand{\chaptertitle}{Genesis}
\setcounter{section}{0}
\pdfbookmark[1]{1}{01O1}
\section{}\settowidth{\myIndent}
{\IndOne \Text}
\ifdimless{\the\myIndent}
{.99\textwidth}
{\IndOne \Text \stepcounter{subsection} \subsection{} \IndOne \Text}
{\IndTwo \Text \stepcounter{subsection} \subsection{} \Text}
\subsection{} \Text
\subsection{} \Text
\subsection{} \Text
\subsection{} \Text
\subsection{} \Text
\pdfbookmark[1]{2}{01O2}
\section{}\settowidth{\myIndent}
{\IndOne \Text}
\ifdimless{\the\myIndent}
{.99\textwidth}
{\IndOne \Text \stepcounter{subsection} \subsection{} \IndOne \Text}
{\IndTwo \Text \stepcounter{subsection} \subsection{} \Text}
\subsection{} \Text
\subsection{} \Text
\subsection{} \Text
\subsection{} \Text
\subsection{} \Text
\begin{center}
\cleardoublepage
\phantomsection
\addcontentsline{toc}{chapter}{Exodus}\noindent
THE SECOND BOOK OF MOSES, CALLED\\
\vspace{0.15cm}\textbf{\Huge{EXODUS}}\vspace{0.00cm}\\
\end{center}
\renewcommand{\chaptertitle}{Exodus}
\setcounter{section}{0}
\pdfbookmark[1]{1}{02O1}
\section{}\settowidth{\myIndent}
{\IndOne \Text}
\ifdimless{\the\myIndent}
{.99\textwidth}
{\IndOne \Text \stepcounter{subsection} \subsection{} \IndOne \Text}
{\IndTwo \Text \stepcounter{subsection} \subsection{} \Text}
\subsection{} \Text
\subsection{} \Text
\subsection{} \Text
\subsection{} \Text
\subsection{} \Text
\end{document}
答案1
之后使用以下代码hyperref
:
\makeatletter
\def\toclevel@section{2}
\makeatother
通常\toclevel@section
为 1。
\tocleve@<structure element>
被 所使用。因此书签中bookmarksdepth
每个的级别都发生了变化。现在与 处于同一级别。section
section
subsection
答案2
添加
\addtocounter{chapter}{1}
并删除自定义书签
\pdfbookmark[1]{1}{02O1}
从每本chapter
或圣经书名后第一个解决了它。
\addtocounter{chapter}{1}
\renewcommand{\chaptertitle}{Exodus}
\setcounter{section}{0}
%\pdfbookmark[1]{1}{02O1}