我正在使用memoir
目前支持书籍、部分、章节、节、小节等的...我想在这上面添加一个层(比如“卷”),它表现得更好(编号并出现在目录中)。
我遇到过这个问题更多章节标题?这有助于产生低于默认值的级别,但我正在努力扭转这一过程。
答案1
来自memoir
基本用户手册(部分6.2 部门划分,第 74 页):
命令会从 1 开始
\section
重新对任何部分进行编号\subsections
。对于大多数分区,<title>
会放在发出命令的页面上。\book
、\part
和\chapter
命令的行为略有不同。和命令更简单
\book
,\part
并且两者的行为方式相同。该\book{<title>}
命令将书名(默认Book
)、编号和<title>
单独放在一页上。书籍的编号对\part
s 或\chapter
s 的编号没有影响。
我们可以复制\book
,并调用它\volume
,它会以相同的方式做出反应:
\documentclass{memoir}
\setcounter{tocdepth}{5}% Just for this example
\setcounter{secnumdepth}{5}% Just for this example
\makeatletter
\newcounter{volume} \setcounter{volume}{0}
\renewcommand*{\thevolume}{\@Roman\c@volume}
\newcommand*{\theHvolume}{\arabic{volume}}
\newcommand*{\toclevel@volume}{-3}
\newcommand*{\volume}{%
\@setupvolume
\secdef\@volume\@svolume}
\newcommand*{\beforevolumeskip}{\null\vfil}
\newcommand*{\midvolumeskip}{\par\vskip 2\onelineskip}
\newcommand*{\aftervolumeskip}{\vfil\newpage}
\newcommand{\@setupvolume}{%
\if@openright
\cleardoublepage
\else
\clearpage
\fi
\thispagestyle{volume}%
\if@twocolumn
\onecolumn
\@tempswatrue
\else
\@tempswafalse
\fi
\beforevolumeskip}
\newcommand*{\volumename}{Volume}
\newcommand*{\volumenamefont}{\normalfont\huge\bfseries}
\newcommand*{\volumenumfont}{\normalfont\huge\bfseries}
\newcommand*{\volumetitlefont}{\normalfont\Huge\bfseries}
\newcommand*{\printvolumename}{\volumenamefont \volumename}
\newcommand*{\volumenamenum}{\space}
\newcommand*{\printvolumenum}{\volumenumfont \thevolume}
\newcommand*{\printvolumetitle}[1]{\volumetitlefont #1}
\newcommand{\memvolumeinfo}[3]{}
\newcommand{\memvolumestarinfo}[1]{}
\long\def\@volume[#1]#2{%
\M@gettitle{#1}%
\def\f@rtoc{#1}%
\@nameuse{volume@f@rtoc@before@write@hook}%
\phantomsection
\mempreaddvolumetotochook
\ifnum \c@secnumdepth >-4\relax
\refstepcounter{volume}%
\addcontentsline{toc}{volume}%
{\protect\volumenumberline{\thevolume}\f@rtoc}%
\memvolumeinfo{\thevolume}{\f@rtoc}{#2}%
\else
\addcontentsline{toc}{volume}{\f@rtoc}%
\memvolumeinfo{}{\f@rtoc}{#2}%
\fi
\mempostaddvolumetotochook
\volumepagemark{#1}%
{\centering
\interlinepenalty \@M
\parskip\z@
\normalfont
\ifnum \c@secnumdepth >-4\relax
\printvolumename \volumenamenum \printvolumenum
\midvolumeskip
\fi
\printvolumetitle{#2}\par}%
\@endvolume}
\newcommand\mempreaddvolumetotochook{}
\newcommand\mempostaddvolumetotochook{}
\long\def\@svolume#1{%
\M@gettitle{#1}%
\phantomsection
\memvolumestarinfo{#1}%
{\centering
\interlinepenalty \@M
\parskip\z@
\normalfont
\printvolumetitle{#1}\par}%
\@endvolume}
\newif\ifm@mnovolumenewpage
\m@mnovolumenewpagefalse
\newcommand*{\volumeblankpage}{\m@mnovolumenewpagefalse}
\newcommand*{\novolumeblankpage}{\m@mnovolumenewpagetrue}
\newcommand*{\volumepageend}{\aftervolumeskip
\ifm@mnovolumenewpage
\else
\if@twoside
\if@openright
\null
\thispagestyle{aftervolume}%
\newpage
\fi
\fi
\fi
\if@tempswa
\twocolumn
\fi}
\def\@endvolume{\volumepageend}
\aliaspagestyle{volume}{empty}
\aliaspagestyle{aftervolume}{empty}
\newcommand*{\cftvolumebreak}{\addpenalty{-\@highpenalty}%
\addvspace{\cftbeforevolumeskip}}
\newcommand*{\l@volume}[2]{%
\ifnum\c@tocdepth >-4\relax
\cftvolumebreak
\begingroup
{%
\memRTLleftskip \cftvolumeindent\relax
\memRTLrightskip \@tocrmarg
\parfillskip -\memRTLrightskip
\parindent \cftvolumeindent\relax\@afterindenttrue
\interlinepenalty\@M
\leavevmode
\settowidth{\@tempdima}{\cftvolumefont\cftvolumename}%
\addtolength{\@tempdima}{\cftvolumenumwidth}%
\let\@cftbsnum \cftvolumepresnum
\let\@cftasnum \cftvolumeaftersnum
\let\@cftasnumb \cftvolumeaftersnumb
\advance\memRTLleftskip \@tempdima \null\nobreak\hskip -\memRTLleftskip
{\cftvolumefont {#1}}%
\cftvolumefillnum{#2}}
\nobreak
\global\@nobreaktrue
\everypar{\global\@nobreakfalse\everypar{}}%
\endgroup
\fi}
\newcommand*\volumenumberlinehook[1]{}
\newcommand{\volumenumberline}[1]{%
\volumenumberlinehook{#1}%
\volumenumberlinebox\@tempdima{%
\cftvolumename\@cftbsnum #1\@cftasnum}\@cftasnumb}%%\space}
\newcommand*{\cftvolumename}{}
\newcommand*{\volumepagemark}[1]{}
\let\volumenumberlinebox\mem@cft@hb@xt@
\newlength{\cftbeforevolumeskip}
\setlength{\cftbeforevolumeskip}{2.25em \@plus\p@}
\newdimen\cftvolumeindent
\setlength{\cftvolumeindent}{0em}
\newdimen\cftvolumenumwidth
\setlength{\cftvolumenumwidth}{1.5em}
\newcommand*{\cftvolumefont}{\large\bfseries}
\newcommand*{\cftvolumepresnum}{}
\newcommand*{\cftvolumeaftersnum}{}
\newcommand*{\cftvolumeaftersnumb}{}
\newcommand*{\cftvolumeleader}{%
\large\bfseries\cftdotfill{\cftvolumedotsep}}
\newcommand*{\cftvolumedotsep}{\cftnodots}
\newcommand*{\cftvolumepagefont}{\large\bfseries}
\newcommand{\cftvolumeafterpnum}{}
\newcommand{\cftvolumefillnum}[1]{%
{\cftvolumeleader}%
\cftvolumeformatpnum{#1}%
\cftvolumeafterpnum\par}
\newcommand{\cftvolumeformatpnumhook}[1]{}
\newcommand{\cftvolumeformatpnum}[1]{%
\cftvolumeformatpnumhook{#1}%
\hb@xt@\@pnumwidth{\hss {\cftvolumepagefont #1}}}
\makeatother
\begin{document}
\tableofcontents
\volume{A volume}
\book{A book}
\part{A part}
\chapter{A chapter}
\section{A section}
\subsection{A subsection}
\subsubsection{A subsubsection}
\paragraph{A paragraph}
\subparagraph{A subparagraph}
\end{document}