I'm having an issue creating a \book section above \part. All goes well — ToC is beautiful — until I add the bookmark package and then it crashes with a "Missing Action" on the first use of \book.
Thanks go so far to @Gonzalo Medina for their answer to this question for help adding the [\subsubsubsection][1] and to @lockstep for their comment on this question that led me to the chngcntr package.
Since I'm making \book above \part, I've read in the titlesec documentation that I'm supposed to do the loadonly package option on titlesec and redefine all the levels from scratch. But I really like the rest of the sections the way they are!
I just found this question with the default formatting and spacing of sections for standard classes (thanks to @Miotto!) but I'm not sure if I still need the \@startsection bits of the \subsubsubsection bits for changing \paragraph and \subparagraph ToC levels. Do the \toclevel@ bits do that by themselves?
Can someone either help me fix this MWE or help me decipher the \@startsection issue just mentioned?
MWE:
\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}
Also, I've tried the memoir class, but it messes up too many spacing settings to be worth my time. I like the rest of my document as is and just want to continue the writing in a new volume while still using the book class.
Thank you for your time!
[1]: I did have to use chngcntr to relink the \paragraph to the new \subsubsubsection, but all else was great! Really helpful stuff!
\bookdefines also a command\bookmarkand that clashes with the \bookmark command from the bookmark package. The chngctr package is no longer needed in a current latex (but doesn't harm either). – Ulrike Fischer May 05 '22 at 18:55\...markas well. That explains a lot. I'll try calling it volume and see if that does any better! – Craie May 06 '22 at 01:33titlesecmake the\...markmacros? – Craie May 06 '22 at 01:40