회고록: 섹션 번호를 건너뛰고, 장 내에서 하위 섹션 번호를 연속적으로 만듭니다.

회고록: 섹션 번호를 건너뛰고, 장 내에서 하위 섹션 번호를 연속적으로 만듭니다.

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

특히 나는 다음을 원한다:

  1. section본문과 목차 모두에서 숫자를 억제합니다 .
  2. subsection에서 숫자를 연속적으로 만듭니다 chapter.
  3. = 장 번호 형식 subsection으로 번호를 표시합니다 .X.YYYX
  4. 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}

관련 정보