目录页不使用与文档其余部分相同的标题

目录页不使用与文档其余部分相同的标题

我有以下类代码(motion.cls),它们基本上重新定义了目录并自定义了标题。

\ProvidesClass{motion}[2017/10/11 Moutain Motion class attempt]
\NeedsTeXFormat{LaTeX2e}

\LoadClass[a4paper, twoside]{article}

\DeclareOption*{\PassOptionsToClass{\CurrentOption}{article}}
\ProcessOptions\relax

%----------------------------------------
% Package
%----------------------------------------

\RequirePackage[utf8]{inputenc}
\RequirePackage[T1]{fontenc}
\RequirePackage{lmodern}                                  % Table of contents looks
\RequirePackage{biolinum}                                 % Table of contents looks
\RequirePackage{etoolbox}                                 % Used in table of contents
\RequirePackage{titletoc}
\usepackage[colorlinks,linktoc=none]{hyperref}            % Colorlinks & linktoc=none for table of contents
\RequirePackage{fancyhdr}                                 % Headers & footers
\RequirePackage[explicit]{titlesec} 
\RequirePackage{tocloft}
\RequirePackage{longtable}                                % Tabu
\RequirePackage{sectsty}                                  % Change section colors
\RequirePackage[style=verbose, backend=biber]{biblatex}

%----------------------------------------
% Headers & footers
%----------------------------------------

\pagestyle{fancy}
\fancyhf{}
\fancyhead[LE,RO]{\thepage}
\fancyhead[RE,LO]{\leftmark}
%\fancyfoot[CE,CO]{\leftmark}
%\fancyfoot[LE,RO]{\thepage}
\renewcommand{\headrulewidth}{0pt}              % Remove header bar

%----------------------------------------
% Table of contents
%----------------------------------------

% Source:
% https://tex.stackexchange.com/questions/162846/how-to-imitate-great-looking-motion-mountain-toc-including-hyperlinks/165338

\newcounter{numSubSection}
    \setcounter{numSubSection}{0}

\gpreto{\subsection}{%
    \refstepcounter{numSubSection}}%


\titlecontents{section}[0pt]%
    {\addvspace{6pt}\sffamily\scshape
        \makebox[18pt][r]{%
            \hyperlink{page.\thecontentspage}{\textbf{\thecontentspage}}%
            \hspace{6pt}}}%
    {\makebox[30pt][r]{\thecontentslabel\hspace{12pt}}}%
    {\makebox[30pt][r]{\null}}%
    {}%


\makeatletter

\newlength{\TOCleftSkip}
    \setlength{\TOCleftSkip}{66pt}%66
\newlength{\TOCrightSkip}
    \setlength{\TOCrightSkip}{18pt} % Length of subsubsection before line return 

\newtoggle{ifSub}
    \togglefalse{ifSub}%
\newtoggle{ifSection}
    \toggletrue{ifSection}%
\newcounter{RefSubSection}%
    \setcounter{RefSubSection}{0}%
    \renewcommand*\theRefSubSection{\@arabic\c@RefSubSection}%

\renewcommand*{\tableofcontents}{%
    \section*{\contentsname}%
    \addcontentsline{toc}{section}{\contentsname}%
    \toggletrue{ifSection}%
    \setcounter{RefSubSection}{0}%
    \@starttoc{toc}}%

\gpreto{\l@section}{%
    \nottoggle{ifSection}
        {\par%
            \addtolength{\leftskip}{-\TOCleftSkip}%
            \addtolength{\rightskip}{-\TOCrightSkip}%
            \togglefalse{ifSub}}{}%
    \toggletrue{ifSection}}%

\renewcommand*{\l@subsection}[2]{%
    \stepcounter{RefSubSection}%
    \toggletrue{ifSub}%
    \iftoggle{ifSection}
        {\togglefalse{ifSection}%
            \addtolength{\leftskip}{\TOCleftSkip}%
            \addtolength{\rightskip}{\TOCrightSkip}%
            \noindent}%
        {\unskip\begingroup\upshape\small\ \textbullet~\endgroup}%
    \begingroup%
        \upshape\small#1\ \hyperlink{numSubSection.\theRefSubSection}{\textbf{#2}}%
    \endgroup}%

\renewcommand*{\l@subsubsection}[2]{%
    \iftoggle{ifSection}
        {\togglefalse{ifSection}%
            \addtolength{\leftskip}{\TOCleftSkip}%
            \addtolength{\rightskip}{\TOCrightSkip}%
            \noindent}%
        {\iftoggle{ifSub}
            {\togglefalse{ifSub}\relax%
                \unskip\begingroup\upshape\small:\ \endgroup}%
            {\unskip\begingroup\itshape\small,\ \endgroup}}%
    \begingroup\itshape\small#1\endgroup}%

\renewcommand*{\numberline}[1]{}%

\makeatother

小型 MVE:

    \documentclass{motion}

    \begin{document}

    \pagenumbering{roman}
        \clearpage
        \tableofcontents

        \clearpage
        \section*{Preface}
        \addcontentsline{toc}{section}{Preface}

        \clearpage
        \section*{Another Preface}
        \addcontentsline{toc}{section}{Another Preface}

        \clearpage
        \addtocontents{toc}{\protect\vspace{18pt}}
        \pagenumbering{arabic}
        %\clearpage
        \section{First}
            \subsection{Australia}
                \subsubsection{Alpha}
                \subsubsection{Beta}
                \subsubsection{Charlie}
                \subsubsection{Delta}
                \subsubsection{Echo}
                \subsubsection{Foxtrot}
            \subsection{Brazil}
                \subsubsection{Golf}
                \subsubsection{Hotel}
                \subsubsection{India}
            \subsection{Canada}

        \clearpage
        \section{Second}

        \clearpage
        \section{Third}
            \subsection{Denmark}
                \subsubsection{Juliet}
                \subsubsection{Kilo}
                \subsubsection{Lima}
                \subsubsection{Mike}
                \subsubsection{November}
            \subsection{Egypt}
                \subsubsection{Oscar}
                \subsubsection{Papa}
                \subsubsection{Quebec}
                \subsubsection{Romeo}

        \clearpage
        \section{Fourth}
            \subsection{Georgia}
                \subsubsection{Sierra}
            \subsection{Haiti}
                \subsubsection{Tango}
                \subsubsection{Uniform}
                \subsubsection{Victor}
                \subsubsection{Whiskey}
            \subsection{Iceland}
            \subsection{Japan}
                \subsubsection{X-ray}
                \subsubsection{Yankee}
                \subsubsection{Zulu}
                \subsubsection{Alpha}
                \subsubsection{Beta}
                \subsubsection{Charlie}
                \subsubsection{Delta}
                \subsubsection{Echo}
            \subsection{Kenya}
                \subsubsection{Foxtrot}
            \subsection{Laos}
                \subsubsection{Golf}
                \subsubsection{Hotel}
                \subsubsection{India}
                \subsubsection{Juliet}
                \subsubsection{Kilo}

        \clearpage
        \addtocontents{toc}{\protect\vspace{18pt}}
        \hypersetup{linktoc=page}
        \section*{References}
        \addcontentsline{toc}{section}{References}

        \clearpage
        \section*{List of Figures}
        \addcontentsline{toc}{section}{List of Figures}

        \clearpage
        \section*{Index}
        \addcontentsline{toc}{section}{Index}

    \end{document}

输出:

目录 第一页

我们可以看到,目录的页眉和页脚与下一页的页眉和页脚不同。我该如何更改?即使\pagestyle{fancy}在文档开头添加页眉和页脚也无法解决这个问题。

提前感谢您的帮助。

相关内容