Following the guideline in section 3.9. Creating new levels and changing the class of the titlesec manual, I'm trying to create a new sectioning command \sectionsub under \section, to achieve what was asked in this previous question. My current code is given below.
However, I'm facing two issues:
- The numbering for
subsectionandsubsubsectiondisappears. - There is a warning
bookmark level for unknown sectionsub defaults to 0.
Regarding 1), of course \setcounter{secnumdepth}{4} would work here, but the problem is that I'm not sure if 4 is the appropriate value. Regarding 2), \let\toclevel@sectionsub\toclevel@section works in the MWE given below, but for unknown reason, this does not work in the complete version of my document class (I tried to narrow down the problem for like an hour but it turns out to be fruitless).
How should I properly resolve these two issues?
\documentclass{book}
\usepackage[explicit]{titlesec}
\usepackage{titletoc}
\usepackage{hyperref}
\usepackage{bookmark}
%% \sectionsub
\titleclass{\sectionsub}{straight}[\section]
\newcounter{sectionsub}
\renewcommand{\thesectionsub}{\Alph{sectionsub}}
\titleformat{\sectionsub}
{\large\scshape}
{\thesectionsub}
{1em}
{#1}
\titleformat{name=\sectionsub,numberless}
{\large\scshape}
{}
{1em}
{#1}
\titlespacing{\sectionsub}{0pt}{.8\baselineskip}{.5\baselineskip}
\titlecontents{sectionsub}
[4em]
{\normalfont}
{\contentslabel{1.75em}}
{\hspace{-1.75em}}
{\titlerule[1em]{.}\contentspage}
\begin{document}
\tableofcontents
\section{Test section}
\sectionsub{Test sectionsub}
\subsection{Test subsection}
\subsubsection{Test subsubsection}
\end{document}


articleinstead ofbook, should I change the1in\def\toclevel@sectionsub{1}to0to make it the same level withsection? – Jinwen Jul 04 '22 at 20:22hyperrefandbookmarkdoesn't really matter, one just needs to be careful about option clash. – Jinwen Jul 04 '22 at 20:23