目次内のページ番号を削除しますが、ページ上では削除しません

目次内のページ番号を削除しますが、ページ上では削除しません

目次のページ番号を削除したいのですが、ページ上では削除できません。 答えを探していろいろ試してみましたが、何も機能しません。\thispagestyle{plain}ページの番号付けには を使用する必要がありますが、これによりページが自動的に目次に追加されます。{empty}代わりに を使用すると、ページ上のページ番号が削除されます...

助けてください!

newpage
\thispagestyle{plain}
\setcounter{page}{1}
%\pagenumbering{gobble} (this supresses the page numbers on the page which is not what I want)

\addcontentsline{toc}{chapter}{Appendices}
\chapter*{Appendix 1: Room Temperature}

\noindent\makebox[\textwidth][c]{\raisebox{-0.9\height}[10pt][10pt]{\includegraphics[page=1,scale=0.6]{Room-Code}}}\par

\addcontentsline{toc}{chapter}{Appendix 1: Room Temperature}

これが目次であり、付録の横に番号が表示されていないことを除いて、すべて正しいです。

答え1

質問に MWE (ドキュメント クラス、TOC 関連パッケージなど) が含まれていない場合、推測しかできません。

パッケージを使用しtocloft\cftpagenumbersoff{chapter}TOC に追加することができます。

例:

\documentclass{report}
\usepackage{blindtext}% only for dummy text

\usepackage{tocloft}

\begin{document}
\tableofcontents
\blinddocument

\cleardoublepage
\setcounter{page}{1}
\addtocontents{toc}{\protect\cftpagenumbersoff{chapter}}% <- added
\addcontentsline{toc}{chapter}{Appendices}
\chapter*{Appendix 1: Room Temperature}
\addcontentsline{toc}{chapter}{Appendix 1: Room Temperature}

\blindtext
\end{document}

ここに画像の説明を入力してください

またはパッケージの提案tocbasic:

\documentclass{report}
\usepackage{blindtext}% only for dummy text

\usepackage{tocbasic}
\newcommand\gobble[1]{}

\begin{document}
\tableofcontents
\blinddocument

\cleardoublepage
\setcounter{page}{1}
\addtocontents{toc}{\DeclareTOCStyleEntry[pagenumberformat=\protect\gobble]{tocline}{chapter}}
\addcontentsline{toc}{chapter}{Appendices}

\chapter*{Appendix 1: Room Temperature}
\addcontentsline{toc}{chapter}{Appendix 1: Room Temperature}

\blindtext
\end{document}

ここに画像の説明を入力してください

または、以下を使用します\appendix:

\documentclass{report}
\usepackage{blindtext}% only for dummy text

\usepackage{tocbasic}
\newcommand\gobble[1]{}
\newcommand\appendixprefixintoc[1]{\appendixname~#1:\hfill}

\begin{document}
\tableofcontents
\blinddocument

\cleardoublepage
\appendix
\setcounter{page}{1}
\addtocontents{toc}{\DeclareTOCStyleEntry[pagenumberformat=\protect\gobble]{tocline}{chapter}}
\addcontentsline{toc}{chapter}{Appendices}
\addtocontents{toc}{\DeclareTOCStyleEntry[entrynumberformat=\protect\appendixprefixintoc,dynnumwidth]{tocline}{chapter}}
\chapter{Room Temperature}
\blindtext
\end{document}

ここに画像の説明を入力してください

ここに画像の説明を入力してください

関連情報