
ドキュメントクラスでは、book
パート レベルの目次に表示される付録が必要です。目次は次のようになります。
Preface
Part title
Chapter title
Chapter title
Part title
Chapter title
Chapter title
Appendix: Some title
Bibliography
Index
参考文献と索引を追加する方法も知っていますし、 PDF 内の適切な場所を指すようにするコツ\addcontentsline{toc}{part}{...}
も知っています。\phantomsection
しかし、付録をpart
目次のレベルまで到達させるにはどうしたらよいでしょうか? 付録はchapter
最後の部分の下にあります。
\appendix を使用せずに「手動で」付録を作成してもかまいません。ちなみに、私は\titlesec
章とパートの書式設定をカスタマイズするために を使用しています。
答え1
付録は 1 つしかないので、「ワンショット ハック」で十分なはずです。
\documentclass{book}
\usepackage{etoolbox}
\makeatletter
\newcommand{\appchapter}[1]{%
\begingroup
\patchcmd{\@chapter}
{\addcontentsline{toc}{chapter}}
{\addcontentsline{toc}{part}}
{}{}
\patchcmd{\@chapter}
{\addcontentsline{toc}{chapter}}
{\addcontentsline{toc}{part}}
{}{}
\chapter{#1}
\endgroup
}
\makeatother
\begin{document}
\frontmatter
\tableofcontents
\mainmatter
\chapter{Preface}
\part{Part title}
\chapter{Chapter title}
\chapter{Chapter title}
\part{Part title}
\chapter{Chapter title}
\chapter{Chapter title}
\backmatter
\appendix
\appchapter{Appendix: Some title}
\chapter{Bibliography}
\end{document}