![回憶錄:跳過章節編號,使章節編號在章節內連續](https://rvso.com/image/281562/%E5%9B%9E%E6%86%B6%E9%8C%84%EF%BC%9A%E8%B7%B3%E9%81%8E%E7%AB%A0%E7%AF%80%E7%B7%A8%E8%99%9F%EF%BC%8C%E4%BD%BF%E7%AB%A0%E7%AF%80%E7%B7%A8%E8%99%9F%E5%9C%A8%E7%AB%A0%E7%AF%80%E5%85%A7%E9%80%A3%E7%BA%8C.png)
全班可以memoir
建立一本目錄如下圖的參考書嗎?
Chapter 1. Animals
Mammals
Cows ................... 1.000
Bulls .................. 1.001
Calves ................. 1.002
Amphibians
Frogs .................. 1.003
Turtles ................ 1.004
Newts .................. 1.005
Chapter 2. Plants
Trees
Pines .................. 2.000
Oaks ................... 2.001
Maples ................. 2.002
Shrubs
Brambles ............... 2.003
Brooms ................. 2.004
Lilacs ................. 2.005
我特別希望:
- 禁止
section
文字和目錄中的數字。 - 使
subsection
數字在chapter
. subsection
以以下格式顯示數字X.YYY
:其中X
= 章節號。- 將
subsection
數字移到頁邊空白處。我們的想法是使用它們而不是頁碼。
答案1
這是一個基本的解決方案。您仍需要修改目錄的參數,以抑制章節頁碼和章節的點。
\documentclass{memoir}
\counterwithout{subsection}{section} % subsection is not reset with section
\counterwithin{subsection}{chapter} % subsection is reset with chapter
% subsection numbers are X.YYY
\renewcommand{\thesubsection}{\thechapter.\threedigits{subsection}}
\newcommand{\threedigits}[1]{%
\ifnum\value{#1}<100 0\fi
\ifnum\value{#1}<10 0\fi
\arabic{#1}%
}
\setsecnumformat{\csname #1secnumformat\endcsname}
% no numbering shown for section titles
\newcommand\sectionsecnumformat{}
% numbering shown for subsection titles
\newcommand\subsectionsecnumformat{\thesubsection.\quad}
% modify the TOC macros not to use the section number
\makeatletter
\let\memoir@l@section\l@section
\def\l@section#1#2{%
\mihai@gobble@number#1\@nil
}
\def\mihai@gobble@number\numberline#1#2\@nil{%
\memoir@l@section{#2}{}%
}
% modify the TOC macros to use the subsection number as the page number
\let\memoir@l@subsection\l@subsection
\def\l@subsection#1#2{%
\mihai@get@number#1\@nil
}
\def\mihai@get@number\numberline#1#2\@nil{%
\memoir@l@section{#2}{#1}%
}
\makeatother
\settocdepth{subsection}
\setsecnumdepth{subsection}
\begin{document}
\frontmatter
\makeatletter\show\l@section
\tableofcontents*
\mainmatter
\chapter{Animals}
x
\section{Mammals}
x
\subsection{Cows}
x
\subsection{Bulls}
x
\subsection{Calves}
x
\section{Amphibians}
x
\subsection{Frogs}
x
\subsection{Turtles}
x
\subsection{Newts}
x
\chapter{Plants}
x
\section{Trees}
\subsection{Pines}
x
\subsection{Oaks}
x
\subsection{Maples}
x
\section{Shrubs}
x
\subsection{Brambles}
x
\subsection{Brooms}
x
\subsection{Lilacs}
x
\end{document}