\documentclass[twoside,onecolumn,11pt,reqno, a4paper]{amsart}
\usepackage{amsmath}
\usepackage{amsthm}
\usepackage{amssymb}
\usepackage{mathrsfs}
\usepackage{graphicx}
\makeatletter
\def\@tocline#1#2#3#4#5#6#7{\relax
\ifnum #1>\c@tocdepth % then omit
\else
\par \addpenalty\@secpenalty\addvspace{#2}%
\begingroup \hyphenpenalty\@M
\@ifempty{#4}{%
\@tempdima\csname r@tocindent\number#1\endcsname\relax
}{%
\@tempdima#4\relax
}%
\parindent\z@ \leftskip#3\relax \advance\leftskip\@tempdima\relax
\rightskip\@pnumwidth plus4em \parfillskip-\@pnumwidth
#5\leavevmode\hskip-\@tempdima
\ifcase #1
\or\or \hskip 1em \or \hskip 2em \else \hskip 3em \fi%
#6\nobreak\relax
\dotfill\hbox to\@pnumwidth{\@tocpagenum{#7}}\par
\nobreak
\endgroup
\fi}
\makeatother
\usepackage{hyperref}
\begin{document}
\pagenumbering{roman}
\tableofcontents
\cleardoublepage
\maketitle
\begin{abstract}
\end{abstract}
\pagenumbering{arabic}
\setcounter{page}{1} %reset the page counter
\section{Introduction}
\section{Section}
\subsection{Subsection}
\subsection{Subsection}
\subsection{Subsection}
\section{Section}
\section{Section}
\subsection{Subsection}
\subsection{Subsection}
\subsection{Subsection}
\subsubsection{subsub}
\subsubsection{subsub}
\subsubsection{subsub}
\section{Section}
\section{Section}
\appendix
\subsection{Subsection}
\subsection{Subsection}
\subsection{Subsection}
\begin{thebibliography}{3}
\end{thebibliography}
\end{document}
答案1
您可以使用以下方法在任何部分单元周围添加/删除页码:
\documentclass[twoside,onecolumn,11pt,reqno, a4paper]{amsart}
\makeatletter
\def\@tocline#1#2#3#4#5#6#7{\relax
\ifnum #1>\c@tocdepth % then omit
\else
\par \addpenalty\@secpenalty\addvspace{#2}%
\begingroup \hyphenpenalty\@M
\@ifempty{#4}{%
\@tempdima\csname r@tocindent\number#1\endcsname\relax
}{%
\@tempdima#4\relax
}%
\parindent\z@ \leftskip#3\relax \advance\leftskip\@tempdima\relax
\rightskip\@pnumwidth plus4em \parfillskip-\@pnumwidth
#5\leavevmode\hskip-\@tempdima
\ifcase #1
\or\or \hskip 1em \or \hskip 2em \else \hskip 3em \fi%
#6\nobreak\relax
\dotfill\hbox to\@pnumwidth{\@tocpagenum{#7}}\par
\nobreak
\endgroup
\fi}
\let\olddotfill\dotfill
\newcommand{\@notocpagenum}{% Auxiliary definition
\let\dotfill\hfill% Remove dot leader
%\@pnumwidth 0pt% Remove page number box width
\let\@tocpagenum\@gobble}% Remove page number
\newcommand{\notocpagenum}{% Remove page number from ToC
\addtocontents{toc}{\protect\@notocpagenum}}
\newcommand{\@resettocpagenum}{% Auxiliary definition
\let\dotfill\olddotfill% Restore dot leader
\def\@tocpagenum##1{\hss{\mdseries ##1}}}% Reset page number box
\newcommand{\resettocpagenum}{% Reset ToC page numbering
\addtocontents{toc}{\protect\@resettocpagenum}}
\makeatother
\usepackage{hyperref}
\begin{document}
\tableofcontents
\section{Introduction}
\notocpagenum
\section{Section}
\resettocpagenum
\subsection{Subsection}
\subsection{Subsection}
\subsection{Subsection}
\section{Section}
\section{Section}
\subsection{Subsection}
\subsection{Subsection}
\subsection{Subsection}
\subsubsection{subsub}
\subsubsection{subsub}
\subsubsection{subsub}
\section{Section}
\section{Section}
\begin{thebibliography}{3}
\bibitem{abc}
\end{thebibliography}
\end{document}
您可以使用 停止向目录添加页码\notocpagenum
,然后使用 重新添加\resettocpagenum
。您必须将它们环绕在您想要的特定部分周围里面您的文档,因为必须在正确的时间将位置写入目录。