如何取消内容页的页码?

如何取消内容页的页码?

我正在尝试取消内容页中的页码。我试过命令\thispagestyle{empty},但没有用!我试过的另一种方法是下面的方法,但第一个内容页上总是显示“2”,这让我很烦恼!有人能帮我解决这个问题吗?

\documentclass[12pt,a4paper,openany,twoside]{book}
\usepackage{fancyhdr}
\begin{document}  
\title{Functional Analysis}
\author{333}
\maketitle

\pagestyle{plain} 
\pagestyle{empty}
\tableofcontents
\newpage
\pagestyle{fancy}
\setcounter{page}{1}

\chapter{BalaBalaBala}  
\section{BalaBalaBala}      
\section{BalaBalaBala}      
\section{BalaBalaBala}  
\section{BalaBalaBala}  
\chapter{BalaBalaBala}  
\section{BalaBalaBala}  
\section{BalaBalaBala}  
\section{BalaBalaBala}  
\section{BalaBalaBala}  
\chapter{BalaBalaBala}  
\section{BalaBalaBala}
\subsection{BalaBalaBala}   
\subsection{BalaBalaBala}
\subsection{BalaBalaBala}   
\section{BalaBalaBala}  
\subsection{BalaBalaBala}   
\section{BalaBalaBala}  
\chapter{BalaBalaBala}
\section{BalaBalaBala}
\section{BalaBalaBala}
\section{BalaBalaBala}  
\section{BalaBalaBala}
\subsection{BalaBalaBala}
\subsection{BalaBalaBala}
\subsection{BalaBalaBala}
\section{BalaBalaBala}
\chapter{BalaBalaBala}
\section{BalaBalaBala}
\subsection{BalaBalaBala}
\subsection{BalaBalaBala}
\subsection{BalaBalaBala}   
\subsection{BalaBalaBala}
\section{BalaBalaBala}
\subsection{BalaBalaBala}   
\subsection{BalaBalaBala}   
\subsection{BalaBalaBala}   
\section{BalaBalaBala}
\subsection{BalaBalaBala}   
\subsection{BalaBalaBala}
\subsection{BalaBalaBala}   
\subsection{BalaBalaBala}   
\subsection{BalaBalaBala}   
\section{BalaBalaBala}  
\subsection{BalaBalaBala}   
\subsection{BalaBalaBala}   
\subsection{BalaBalaBala}
\subsection{BalaBalaBala}
\subsection{BalaBalaBala}
\chapter{BalaBalaBala}
\section{BalaBalaBala}
\subsection{BalaBalaBala}
\section{BalaBalaBala}
\section{BalaBalaBala}
\section{BalaBalaBala}
\section{BalaBalaBala}
\chapter{BalaBalaBala}
\section{BalaBalaBala}
\end{document}

在此处输入图片描述

在此处输入图片描述

答案1

您可以加载该包并在序言中tocloft发出指令。\tocloftpagestyle{empty}

完整的 MWE (最小工作示例):

\documentclass[12pt,a4paper,openany,twoside]{book}
\usepackage{fancyhdr}

\usepackage{tocloft}
\tocloftpagestyle{empty}

\begin{document}  
\frontmatter
\title{Functional Analysis}
\author{333}
\maketitle

\pagestyle{empty}
\tableofcontents

\mainmatter
\pagestyle{fancy}

\chapter{BalaBalaBala}  
\section{BalaBalaBala} 
...
\end{document}

答案2

你可以使用

\AtBeginDocument{\addtocontents{toc}{\protect\thispagestyle{empty}}}

在序言中。

例子:

\documentclass[12pt,a4paper,openany,twoside]{book}
\usepackage{fancyhdr}
\AtBeginDocument{\addtocontents{toc}{\protect\thispagestyle{empty}}}

\usepackage{blindtext}% only for dummy text
\begin{document}
\frontmatter
\pagestyle{empty}
\title{Functional Analysis}
\author{333}
\maketitle
\tableofcontents
\mainmatter
\pagestyle{fancy}
\Blinddocument\Blinddocument\Blinddocument\Blinddocument
\Blinddocument\Blinddocument\Blinddocument\Blinddocument
\Blinddocument\Blinddocument\Blinddocument\Blinddocument
\end{document}

在此处输入图片描述

相关内容