次のコードを使用するときはいつでも
\appendix
\addcontentsline{toc}{chapter}{9 \enspace Appendices}
\addtocontents{toc}{\protect\setcounter{tocdepth}{-1}}
目次に個々の付録をリストしないようにするため、図表一覧 (lof) は消えます。付録から上記のコマンドを削除すると、lof が表示されることを確認しました。
答え1
tocdepth
付録の後にカウンターを復元する必要があります\addtocontents{toc}{\protect\setcounter{tocdepth}{2}}
:
\documentclass{report}
\begin{document}
\tableofcontents
\listoffigures
\begin{figure}
\caption{figure}
\end{figure}
\appendix
\addcontentsline{toc}{chapter}{9 \enspace Appendices}
\addtocontents{toc}{\protect\setcounter{tocdepth}{-1}}
\chapter{Appendix chapter that is not listed in the TOC}
...
%<end of appendix>
\addtocontents{toc}{\protect\setcounter{tocdepth}{2}}
\end{document}
付録が文書の最後だと仮定すると(ないおそらくそうではないでしょうから、ここは注意してください)文書の末尾を次のように修正することができます
\let\oldenddocument\enddocument
\def\enddocument{%
\addtocontents{toc}{\protect\setcounter{tocdepth}{2}}
\oldenddocument}
次にファイル
\documentclass{report}
\makeatletter
\g@addto@macro\appendix{%
\addcontentsline{toc}{chapter}{9 \enspace Appendices}
\addtocontents{toc}{\protect\setcounter{tocdepth}{-1}}}
\let\ltx@enddocument\enddocument
\def\enddocument{%
\addtocontents{toc}{\protect\setcounter{tocdepth}{2}}
\ltx@enddocument}
\makeatother
\begin{document}
\tableofcontents
\listoffigures
\begin{figure}
\caption{figure}
\end{figure}
\appendix
\chapter{Appendix chapter that is not listed in the TOC}
\end{document}
\appendix
上記と同じ結果になります。文書本体をきれいに保つためにパッチも適用されていることに注意してください。
\g@addto@macro\appendix{%
\addcontentsline{toc}{chapter}{9 \enspace Appendices}
\addtocontents{toc}{\protect\setcounter{tocdepth}{-1}}}
これはいずれにしても行う必要があります。最後に、付録がドキュメントの終了部分でない場合は、付録を環境にラップして終了マーカーを設定し、適切な場所にフックして(たとえば、命令を使用して\def\endappendix{\addtocontents{toc}{\protect\setcounter{tocdepth}{2}}}
)次のようにすることを検討してください。
\documentclass{book}
\makeatletter
\g@addto@macro\appendix{%
\addcontentsline{toc}{chapter}{9 \enspace Appendices}
\addtocontents{toc}{\protect\setcounter{tocdepth}{-1}}}
\def\endappendix{\addtocontents{toc}{\protect\setcounter{tocdepth}{2}}}
\makeatother
\begin{document}
\tableofcontents
\listoffigures
\begin{figure}
\caption{figure}
\end{figure}
\begin{appendix}
\chapter{Appendix chapter that is not listed in the TOC}
...
\end{appendix}
\backmatter
\chapter{After the appendix}
\end{document}
これは標準インターフェースの変更であることに注意してください。