刪除目錄中但不在頁面上的頁碼

刪除目錄中但不在頁面上的頁碼

我在刪除目錄中的頁碼編號而不是頁面上的頁碼時遇到問題。我四處尋找答案並嘗試了幾種方法,但沒有任何效果。我必須使用\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}至目錄。

例子:

\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}

在此輸入影像描述

在此輸入影像描述

相關內容