新增書籤時,上面的新部分崩潰:缺少操作

新增書籤時,上面的新部分崩潰:缺少操作

\book我在創建上面的部分時遇到問題\part。一切都很順利——ToC 很漂亮——直到我添加了這個bookmark包,然後它在第一次使用時因“缺少操作”而崩潰\book

感謝到目前為止@貢薩洛·梅迪納他們的回答這個問題尋求幫助添加[\subsubsubsection ][1] 和@鎖步對於他們的評論這個問題這讓我找到了chngcntr包裹。

\book由於我在上面進行了操作\part,所以我在文件中讀到了titlesec我應該執行loadonly套件選項titlesec並從頭開始重新定義所有層級。但我真的很喜歡其餘部分的原樣!

我剛發現這個問題使用標準類別的預設格式和節間距(感謝@米奧托\@startsection\subsubsubsection\paragraph\subparagraph\toclevel@這些位子是自己做的嗎?

有人可以幫我解決這個 MWE 或幫我破解\@startsection剛才提到的問題嗎?

微量元素:

\documentclass{book}

% this part breaks the whole thing at the first occurence of \book
\PassOptionsToPackage{bookmarks=true,bookmarksopen=true,bookmarksnumbered=true,
            bookmarksopenlevel=6,
            colorlinks=true,
            linkcolor=blue,
            anchorcolor=blue
            }{hyperref}
\usepackage{bookmark}

\usepackage{titlesec,titletoc}
\usepackage{xparse}

\usepackage{chngcntr} % to change within of counters

% new book sectioning level
\titleclass{\book}[-2]{page}
\newcounter{book}
\renewcommand{\thebook}{\Roman{book}}
\titleformat{\book}{\centering\normalfont\huge\bfseries{}Volume \thebook\\\Huge}{}{0pt}{}
\titlespacing*{\book}{0pt}{3.25ex plus 1ex minus .2ex}{1.5ex plus .2ex}

% attach part counter to book
\titleclass{\part}{page}[\book]
\counterwithin*{part}{book}
\titleformat{\part}{\centering\normalfont\huge\bfseries{}Part \thepart\\\Huge}{}{0pt}{}

% fix chapter -- somehow above broke it?
\counterwithout{chapter}{part}
\counterwithin*{chapter}{part}

% to create a subsubsub section and have it work in between subsubsection
% and paragraph as a TOC placeholder:
\titleclass{\subsubsubsection}{straight}[\subsubsection]
\newcounter{subsubsubsection}[subsubsection]
\renewcommand\thesubsubsubsection{\thesubsubsection.\arabic{subsubsubsection}}
\titleformat{\subsubsubsection}{\normalfont\normalsize\bfseries}{\thesubsubsubsection}{1em}{}
\titlespacing*{\subsubsubsection}{0pt}{3.25ex plus 1ex minus .2ex}{1.5ex plus .2ex}

% attach paragraph counter to subsubsubsection
\renewcommand\theparagraph{\thesubsubsubsection.\arabic{paragraph}} % optional; useful if paragraphs are to be numbered
\counterwithout{paragraph}{subsubsection}
\counterwithin{paragraph}{subsubsubsection}

\makeatletter
\renewcommand\paragraph{\@startsection{paragraph}{5}{\z@}%
  {3.25ex \@plus1ex \@minus.2ex}%
  {-1em}%
  {\normalfont\normalsize\bfseries}}
\renewcommand\subparagraph{\@startsection{subparagraph}{6}{\parindent}%
  {3.25ex \@plus1ex \@minus .2ex}%
  {-1em}%
  {\normalfont\normalsize\bfseries}}
% set toc levels
\def\toclevel@book{-2}
\def\toclevel@subsubsubsection{4}
\def\toclevel@paragraph{5}
\def\toclevel@subparagraph{6}
% set toc line styles
\def\l@book{\@dottedtocline{-2}{0em}{1.5em}}
\def\l@part{\@dottedtocline{-1}{3em}{1.5em}}
\def\l@chapter{\@dottedtocline{0}{6em}{1.5em}}
\def\l@section{\@dottedtocline{1}{9em}{2em}}
\def\l@subsection{\@dottedtocline{2}{12em}{3em}}
\def\l@subsubsection{\@dottedtocline{3}{15em}{3.5em}}
\def\l@subsubsubsection{\@dottedtocline{4}{18em}{4.5em}}
\def\l@paragraph{\@dottedtocline{5}{21em}{5.5em}}
\def\l@subparagraph{\@dottedtocline{6}{24em}{6.5em}}
\makeatother

\setcounter{secnumdepth}{5}
\setcounter{tocdepth}{5}

\begin{document}

\frontmatter
\tableofcontents
\mainmatter

\book{Explore}

\part{Intro}

\chapter{Welcome}
blah
\section{Stuff}
blah
\subsection{Dude}
blah
\subsubsection{Dudette}
blah
\subsubsubsection{Sweet}
blah
\paragraph{Hello}
blah
\subsubsubsection{Nice}
blah
\paragraph{Bye}
blah

\section{Things}
blah
\chapter{Goodbye}
blah
\section{Indeed}
blah

\book{Wander}

\part{Intro Again}

\chapter{Welcome Again}
blah
\section{Hmm}
blah

\end{document}

另外,我已經嘗試過該memoir課程,但它搞亂了太多的間距設置,不值得我花時間。我喜歡我的文件的其餘部分,只是想在仍然使用該類別的同時繼續在新卷中寫作book

感謝您的時間!

[1]:我確實必須使用chngcntr重新連結\paragraph到新的\subsubsubsection,但其他一切都很棒!真的很有幫助的東西!

答案1

(幾乎)所有切片指令都有一個附帶的指令來設定標題的標記。有例如\chaptermark,,\sectionmark\subsectionmarktitlesec設定新的切片指令時,它也定義了一個\...mark 指令。因此,您\book建立了一個與書籤包中的\bookmark命令命令衝突的命令。\bookmark

使用另一個名稱例如\volume可以解決問題。

bookmark加載hyperref,因此通常應該在所有其他包之後(有一些例外)但在定義新計數器之前加載。

相關內容