\documentclass{article}
\usepackage{etoc}
\begin{document}
\addtocontents{toc}{\hfill Page\par}
% The first TOC
\tableofcontents
\section{first part}
\subsection{first part}
% The second TOC
%%%% I don't want the text "Page" to appear in the second TOC %%%%
% What shall I do for this?
\tableofcontents
\section{second part}
\subsection{second part}
\end{document}
答案1
我不确定这是否是你“应该”做的方式,但你可以使用自定义命令代替文字“Page”,然后稍后重新定义该命令。你必须添加一个\protect
以防止它在写入 .toc 文件时扩展:
\documentclass{article}
\usepackage{etoc}
\newcommand{\Page}{\hfill Page\par}
\begin{document}
\addtocontents{toc}{\protect\Page}
% The first TOC
\tableofcontents
\section{first part}
\subsection{first part}
% The second TOC
\renewcommand{\Page}{}
\tableofcontents
\section{second part}
\subsection{second part}
\end{document}