如何清除内容列表中的标题

如何清除内容列表中的标题

我是一个新的 Latex 用户,如果您能帮助我清除内容列表中第二页的页眉,我将不胜感激,我使用\thispagestyle{plain}但不幸的是它无法清除页眉,我的代码是:

\documentclass[12pt]{report}
\usepackage{fancyhdr} 
\pagestyle{fancy}
\fancyhead{} 
\fancyfoot{}
\fancyhead[L]{Chapter \thechapter}
\fancyhead[R]{\leftmark}
\renewcommand{\chaptermark}[1]{\markboth{#1}{}} 
\fancyfoot[C]{\thepage}
\begin{document}
\addcontentsline{toc}{chapter}{Contents}
\tableofcontents
\thispagestyle{plain}
\newpage

\addcontentsline{toc}{chapter}{\listtablename}
\listoftables\thispagestyle{plain}
\newpage

\addcontentsline{toc}{chapter}{\listfigurename}
\listoffigures
\thispagestyle{plain}
\newpage

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

在此处输入图片描述

答案1

也许这能有所帮助:

\documentclass[12pt]{report}
\usepackage{fancyhdr} 
\pagestyle{fancy}
\fancyhead{} 
\fancyfoot{}
\fancyhead[L]{Chapter \thechapter}
\fancyhead[R]{\leftmark}
\renewcommand{\chaptermark}[1]{\markboth{#1}{}} 
\fancyfoot[C]{\thepage}
\pagestyle{plain}
\begin{document}
\addcontentsline{toc}{chapter}{Contents}
\tableofcontents

\newpage

\addcontentsline{toc}{chapter}{\listtablename}

\newpage

\addcontentsline{toc}{chapter}{\listfigurename}
\listoffigures

\newpage

\pagestyle{fancy}
\chapter{test}
\section{test}
\section{test}
\section{test}
\section{test}
\section{test}
\subsection{test}
\chapter{test}
\section{test}
\section{test}
\section{test}
\section{test}
\section{test}
\subsection{test}
\chapter{test}
\section{test}
\section{test}
\section{test}
\section{test}
\section{test}
\subsection{test}
\chapter{test}
\section{test}
\section{test}
\section{test}
\section{test}
\section{test}
\section{test}
\section{test}
\section{test}
\section{test}
\section{test}
\section{test}
\section{test}
\section{test}
\section{test}
\section{test}
\subsection{test}
\chapter{test}
\section{test}
\section{test}
\section{test}
\section{test}
\section{test}
\subsection{test}
\chapter{test}
\section{test}
\section{test}
\section{test}
\section{test}
\section{test}
\subsection{test}
\chapter{test}
\section{test}
\section{test}
\section{test}
\section{test}
\section{test}
\section{test}
\section{test}
\section{test}
\section{test}
\section{test}
\section{test}
\section{test}
\section{test}
\section{test}
\section{test}
\subsection{test}
\end{document}

\thispagestyle 应该设置当前页面的样式。从示例中可以看出,我在文件开头设置了 \pagestyle{plain},然后在 toc 元素之后更改了它。这应该可以解决您的问题。

答案2

只需使用这个:

\documentclass[12pt]{report}
\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyhead{}
\fancyfoot{}
\fancyhead[L]{Chapter \thechapter}
\fancyhead[R]{\leftmark}
\renewcommand{\chaptermark}[1]{\markboth{#1}{}}
\fancyfoot[C]{\thepage}
\usepackage{lipsum}

\begin{document}

\addcontentsline{toc}{chapter}{Contents}
\pagestyle{plain}
\tableofcontents
\newpage

\addcontentsline{toc}{chapter}{\listtablename}
\listoftables
\newpage

\addcontentsline{toc}{chapter}{\listfigurename}
\listoffigures

\clearpage

\pagestyle{fancy}

\chapter{test}
\section{test}
\lipsum
\section{test}
\section{test}
\section{test}
\section{test}
\subsection{test}
\chapter{test}
\section{test}
\section{test}
\section{test}
\section{test}
\section{test}
\subsection{test}
\chapter{test}
\section{test}
\section{test}
\section{test}
\section{test}
\section{test}
\subsection{test}
\chapter{test}
\section{test}
\section{test}
\section{test}
\section{test}
\section{test}
\section{test}
\section{test}
\section{test}
\section{test}
\section{test}
\section{test}
\section{test}
\section{test}
\section{test}
\section{test}
\subsection{test}
\chapter{test}
\section{test}
\section{test}
\section{test}
\section{test}
\section{test}
\subsection{test}
\chapter{test}
\section{test}
\section{test}
\section{test}
\section{test}
\section{test}
\subsection{test}
\chapter{test}
\section{test}
\section{test}
\section{test}
\section{test}
\section{test}
\section{test}
\section{test}
\section{test}
\section{test}
\section{test}
\section{test}
\section{test}
\section{test}
\section{test}
\section{test}
\subsection{test}

\end{document} 

在此处输入图片描述

相关内容