\part が目次に表示されない (回想録)

\part が目次に表示されない (回想録)

授業でmemoir、自分の本に含めたい内容があります\part。タイトルの外観を変更するために、Memoir マニュアルの 78 ページのコードを少し変更して使用しました\part。しかし、何かのせいで\part情報が目次に含まれません。 の間のコードが%問題のようです。では、パート タイトルのテキストに必要な書式設定を行い、パートを目次に含めるにはどうすればよいのでしょうか。

\documentclass[letterpaper]{memoir}
\usepackage[utf8]{inputenc}
\usepackage{lipsum}

%%%%%%%%%%%

\renewcommand{\part}[1]{%
    \cleardoublepage % start a new recto page
    \beforepartskip % space before Name and Number
    \midpartskip % space after Name and Number
    \renewcommand*{\parttitlefont}{\centering\HUGE\normalfont}
    \printparttitle{#1} % print the title
    \partpageend
} % finish off

%%%%%%%%%%%  

\renewcommand{\partpageend}{%
    \afterpartskip
    \normalsize
}

\begin{document}
\tableofcontents

\part{Test Part 1}
\chapter{Name}
\lipsum*[1] 

\part{Test Part 2}

\lipsum*[1]

\end{document}

答え1

パートページから「パート I」を削除し、目次から番号を削除したいようです。

\documentclass[letterpaper]{memoir}
\usepackage[utf8]{inputenc}
\usepackage{lipsum}

%%%%%%%%%%%
\renewcommand*{\parttitlefont}{\centering\HUGE\normalfont}
\renewcommand{\mempreaddparttotochook}{%
  \global\chardef\keepsecnumdepth=\value{secnumdepth}%
  \setcounter{secnumdepth}{-1000}%
}
\renewcommand{\mempostaddparttotochook}{%
  \setcounter{secnumdepth}{\keepsecnumdepth}%
}
\renewcommand{\printpartname}{}
\renewcommand{\partnamenum}{}
\renewcommand{\printpartnum}{}
%%%%%%%%%%%  

\begin{document}

\tableofcontents*

\part{Test Part 1}
\chapter{Name}
\lipsum*[1] 

\part{Test Part 2}

\lipsum*[1]

\end{document}

TOC 関連の作業を実行するコードの前に、secnumdepth非常に大きな負の値を設定します。これにより番号付けは抑制されますが、その部分は目次に追加されます。その後、カウンターは以前の値にリセットされます。

次に、「パート I」を印刷するマクロを何も実行しないように再定義します。

関係ないですが、次のことも付け加えました*\tableofcontents「Contents」というタイトルのすぐ下に「Contents」という行があるのが我慢できません。

関連情報