更改目录中的章节标签和章节标题

更改目录中的章节标签和章节标题

我需要帮助,了解如何在附录中创建的章节在目录中进行标记,以及章节标题本身。

现在,我将每个附录作为一个带有大写字母字符的部分。查看目录,我想将“第一章的 A 表”更改为“第一章的附录 A 表”。同样,我希望该部分的标题(最后一页)也做出完全相同的更改。最后,我希望每个表格和图表的标题保持原样,即不包含“附录”一词。

详细信息:我正在使用 msuphddissertation 类文件,其结构为回忆录。类文件的内容位于包含示例论文的 tex 文件下方。

\documentclass{msuphddissertation}
\usepackage{subfig,chngcntr,titlesec}

\begin{document}

\TOC 
\LOT

\newpage
\addcontentsline{toc}{chapter}{APPENDICES}

\appendix

\counterwithin{table}{section}
\counterwithin{figure}{section}
\renewcommand\thesection{\Alph{section}}

\section{Tables for Chapter One}

\begin{table}[h!]
\center
\caption{Intestesting First Table}
\begin{tabular}{l*{4}{c}} \hline\hline
Var1 & 1.00 & 1.00 & 1.00 & 1.00\\
\hline\hline 
\end{tabular}
\end{table}

\end{document}

================================================= 类文件:

% MSU Ph.D Dissertation class file
% Copyright by Clifford E. Weil and MSU Board of Trustees 2010
% This file must not to alter or distributed.
% New users should download the latest distribution from
% http://www.math.msu.edu/~weil/MSU_Ph.D._Dissertation.zip

% Report bugs to Clifford Weil ([email protected]).
% Latest revision 8/12/13 
% Identification
\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{msuphddissertation}

% Bring in the regular book class
\LoadClass[12pt,oneside]{book}

% Bring in needed packages
\RequirePackage{ifthen}
\RequirePackage{setspace}
\RequirePackage[titles,subfigure]{tocloft}
%\RequirePackage{subfig}
\RequirePackage[margin=1in]{geometry}
\RequirePackage{pdflscape}
%\RequirePackage{fancyhdr}
\RequirePackage{rotating}

% Change to double spacing as defined by MS Word
% Redefine the \doublspacing command
\renewcommand{\doublespacing}{%
  \setstretch {1.9}%  default
  \ifcase \@ptsize \relax % 10pt
    \setstretch {1.9}%
  \or % 11pt
    \setstretch {1.9}%
  \or % 12pt
    \setstretch {1.9}%
  \fi
}

% Number all levels of document divisions
\setcounter{secnumdepth}{6}

% Set depth of table of contents
\setcounter{tocdepth}{6}

% Set second level of sub(super) scripts to 10 pt.
% Thanks to Lee Larson for this fix.
\DeclareMathSizes{12}{12}{10}{10}
\DeclareMathSizes{10}{10}{10}{10}
% Set footnote font size to 12pt.

% Define the command \unit 
\newcommand*{\unit}[1]{\def\fromunit{#1}}

%Define the Title Page
\newcommand\maketitlepage{\begin{titlepage}%
    \vspace*{.55in}
          \begin{center}%
          \MakeUppercase{\@title}%
           \begin{doublespace}

           By

           \begin{tabular}[t]{c}%
     \@author
      \end{tabular}%
      \end{doublespace}
      \vspace{\fill}
  {%
  A  DISSERTATION 
\vspace{\baselineskip}%

    Submitted to \\
    Michigan State University \\
   in partial fulfillment of the requirements \\
   for the degree of 

    \vspace{\baselineskip}%
     \fromunit % Inserts unit name and degree type%

    \vspace{\baselineskip}%
     {\number\year}  
      } 
    \vspace{\baselineskip}
  \end{center}
 \end{titlepage}}%

% Define the command \abstractname
 \newcommand{\abstractname}{\textbf{ABSTRACT}}

%Define the abstract environment for the dissertation
  \newenvironment{abstract}{%
    \thispagestyle{empty}
         \pagenumbering{roman}
           \begin{center}%
         \bfseries \abstractname\vspace{\baselineskip}

        \MakeUppercase{\@title}

       \vspace{\baselineskip}

      By 
      \vspace{\baselineskip}

           \begin{tabular}[t]{c}%
     \@author
      \end{tabular}
     \end{center}

      \begin{doublespace}
     \addtocounter{page}{1}
     } 
     {\end{doublespace}\pagestyle{empty}\newpage}

% Define the Copyright Page
      \newenvironment{copyrt}{%
    \newpage
     \thispagestyle{empty}
     \vspace*{\fill}
     \begin{center}
     \begin{tabular}{l}
     Copyright by\\
     \MakeUppercase{\@author}\\
     \number\year
     \end{tabular}
    \end{center}\vfill}
    {\newpage}

% Define the Dedication Page
  \newcommand{\dedname}{DEDICATION}
    \newenvironment{dedication}{%
   \newpage
     \thispagestyle{plain}
      \pagestyle{plain}
      \vspace*{\fill}}
     {
     \vfill}

% Define the Acknowledgement Page
   \newcommand{\ackname}{ACKNOWLEDGMENTS}
    \newenvironment{acknowledgment}{%
      \newpage
      \thispagestyle{plain}
      \pagestyle{plain}
       \begin{center}
     {\bfseries\ackname}
     \vspace{\baselineskip}
     \end{center}
     \begin{doublespace}
      }
     { \end{doublespace}\thispagestyle{plain}
      \pagestyle{plain}}

% Define the Preface Page
    \newcommand{\prefname}{PREFACE}
        \newenvironment{preface}{%
            \newpage
            \thispagestyle{plain}
            \pagestyle{plain}
            \begin{center}
            {\bfseries\prefname}
             \vspace{\baselineskip}
            \end{center}
        \begin{doublespace}
}
        {\thispagestyle{plain}
    \end{doublespace}
            \pagestyle{plain}
}

% Redefine the \chapter command to put "Chapter" 
% before each chapter entry in the ToC and to put
% "Appendix" before each appendix entry in the ToC.
% Move up to top of page.
% Replaced \chaptername by \@chapapp 7-26-12
% Added \singlespacing command after \typeout 2/27/2014
\renewcommand\chapter{\if@openright\cleardoublepage\else\clearpage\fi
                        \thispagestyle{plain}%
                    \global\@topnum\z@
                    \@afterindentfalse
                    \secdef\@chapter\@schapter}
\def\@chapter[#1]#2{\ifnum \c@secnumdepth >\m@ne
                       \if@mainmatter
                         \refstepcounter{chapter}%
                         \vspace*{-4\baselineskip}
                               \typeout{\singlespacing\@chapapp\space\thechapter.}%
                            \addcontentsline{toc}{chapter}%
     {\protect\numberline{\@chapapp\space\thechapter}#1}%
                       \else
                         \addcontentsline{toc}{chapter}{#1}%
                       \fi
                    \else
                      \addcontentsline{toc}{chapter}{#1}%
                    \fi
                    \chaptermark{#1}%
                    \addtocontents{lof}{\protect\addvspace{10\p@}}%
                    \addtocontents{lot}{\protect\addvspace{10\p@}}%
                    \if@twocolumn
                      \@topnewpage[\@makechapterhead{#2}]%
                    \else
                      \@makechapterhead{#2}%
                      \@afterheading
                    \fi}

% Rededefine the table of contents command 
\renewcommand\contentsname{TABLE OF CONTENTS}
 \renewcommand\tableofcontents{\begin{singlespace}%
    \if@twocolumn
      \@restonecoltrue\onecolumn
    \else
      \@restonecolfalse
    \fi
    \chapter*{\vspace{-2.5\baselineskip}\centerline{\large \MakeUppercase\contentsname}
        \@mkboth{%
          \MakeUppercase\contentsname}{\MakeUppercase\contentsname}
          }%
    \@starttoc{toc}%
    \if@restonecol\twocolumn\fi
    \end{singlespace}}

\newcommand{\TOC}{
\clearpage
\pagestyle{plain}
\tableofcontents
\clearpage
\pagestyle{plain}}

    \renewcommand{\cftchapleader}{\cftdotfill{\cftsecdotsep}}
    \renewcommand{\cftaftertoctitle}{\vspace{\baselineskip}}
        \setlength{\cftbeforechapskip}{\baselineskip}
    \renewcommand{\cftchapnumwidth}{6em}  

%  Define the \LOT command to augment the \listofftables command
\renewcommand\listtablename{LIST OF TABLES}
 \renewcommand\listoftables{%
       \if@twocolumn
      \@restonecoltrue\onecolumn
    \else
      \@restonecolfalse
    \fi
   \chapter*{\vspace{-2.5\baselineskip}\centerline{\large \MakeUppercase
   \listtablename}} 
   \addcontentsline{toc}{chapter}{\textbf{LIST OF TABLES}\vspace{\baselineskip}}%
      \@mkboth{\MakeUppercase\listtablesname}%
              {\MakeUppercase\listtablename}%
   \begin{singlespace} 
   \vspace{-1\baselineskip}
   \@starttoc{lot}%
    \if@restonecol\twocolumn\fi
    \end{singlespace}
    }

\newcommand{\LOT}{
\clearpage
\setlength\cftbeforetabskip{\baselineskip}
\listoftables
\clearpage
\pagestyle{plain}}

    \renewcommand{\cftafterlottitle}{\vspace{\baselineskip}}
    \renewcommand{\cfttabnumwidth}{6em}  
    \renewcommand{\cfttabpresnum}{Table }     

% Define the \LOF command to augment the \listoffigures command
\renewcommand\listfigurename{LIST OF FIGURES}
 \renewcommand\listoffigures{%
       \if@twocolumn
      \@restonecoltrue\onecolumn
    \else
      \@restonecolfalse
    \fi
   \chapter*{\vspace{-2.5\baselineskip}\centerline{\large \MakeUppercase\listfigurename}} 
   \addcontentsline{toc}{chapter}{\textbf{LIST OF FIGURES}\vspace{\baselineskip}}%
      \@mkboth{\MakeUppercase\listfigurename}%
              {\MakeUppercase\listfigurename}%
   \begin{singlespace} 
   \@starttoc{lof}%
    \if@restonecol\twocolumn\fi
    \end{singlespace}
    }

\newcommand{\LOF}{
\clearpage
\setlength\cftbeforefigskip{\baselineskip}
\listoffigures
\clearpage
\pagestyle{plain}}

    \renewcommand{\cftafterloftitle}{\vspace{\baselineskip}}
    \renewcommand{\cftfignumwidth}{6em}  
    \renewcommand{\cftfigpresnum}{Figure }     

% Define the Abbreviations Page
    \newcommand{\keyname}{Key to Symboles and Abbreviations}
    \newenvironment{abbreviationskey}{%
    \addcontentsline{toc}{chapter}
        %{\textbf{\keyname}\textmd{\leaders\hbox to 1em{\hss.\hss}\hfill}}
        {\textbf{\keyname}}
        \newpage\thispagestyle{plain}\pagestyle{plain}
    \begin{center}
    {\bfseries{\MakeUppercase{\large\keyname}}}
    \end{center}
        }{\newpage}

% Single space quotation environments.
\renewenvironment{quotation}
               {\begin{singlespace}\list{}{\listparindent 1.5em%
                        \itemindent    \listparindent
                        \rightmargin   \leftmargin
                        \parsep        \z@ \@plus\p@}%
                \item\relax}
               {\endlist\end{singlespace}}
\renewenvironment{quote}
               {\begin{singlespace}\list{}{\rightmargin\leftmargin}%
                \item\relax}
               {\endlist\end{singlespace}}    

% Redefine the \appendix command to replace "Chapter"
% by "Appendix" for appendices in the ToC 
\newcommand{\appname}{APPENDICES}
\renewcommand\appendix{\par
\clearpage\vspace*{\fill}
\begin{center}
\Huge{\textbf{\appname}}
\end{center}
\vfill
\newpage
%%  The next three lines added 8-2-12
%\addcontentsline{toc}{chapter}{\textbf{\appname}\textmd{\leaders\hbox to 1em{\hss.\hss}\hfill}}                
%\thispagestyle{myheadings}
  \setcounter{chapter}{0}%
  \setcounter{section}{0}%
  \gdef\@chapapp{\appendixname}%
  \gdef\thechapter{\@Alph\c@chapter}
   \clearpage
 }

% Single space the bibliography
\renewenvironment{thebibliography}[1]
      {    \clearpage
          \vspace*{\fill}
          \begin{center}
          \Huge \textbf{\MakeUppercase{\bibname}}
            \addcontentsline{toc}{chapter}{\textbf{\bibname}
                    \vspace{\baselineskip}}%
          \end{center}
          \vfill
          \newpage
      \chapter*{\vspace{-2.2\baselineskip}\centerline{\MakeUppercase{\bibname}}}%
          \@mkboth{\MakeUppercase\bibname}{\MakeUppercase\bibname}%
         % \addcontentsline{toc}{chapter}{\textbf{\bibname}\textmd{\leaders\hbox to 1em{\hss.\hss}\hfill}
         %\vspace{\baselineskip}}%
               \begin{singlespace}
                \list{\@biblabel{\@arabic\c@enumiv}}%
                           {\settowidth\labelwidth{\@biblabel{#1}}%
            \leftmargin\labelwidth
            \advance\leftmargin\labelsep
            \@openbib@code
           \usecounter{enumiv}%
            \let\p@enumiv\@empty
            \renewcommand\theenumiv{\@arabic\c@enumiv}}%
            \setlength{\itemsep}{.2in}
      \sloppy
      \clubpenalty4000
      \@clubpenalty \clubpenalty
      \widowpenalty4000%
      \sfcode`\.\@m}
      {\def\@noitemerr
       {\@latex@warning{Empty `thebibliography' environment}}%
     \endlist\end{singlespace}}

% Define the msulandscape environment.
\let\LS@makecol=\@makecol
\let\LS@makefcolumn=\@makefcolumn
\def\LS@rot{%
    \setbox\@outputbox\vbox{\hbox{\rotatebox{90}%
    {\makebox[-4.5in][l]{\raisebox{-.4in}{\the\value{page}}}\box\@outputbox}}}}
\def\msulandscape{%
    \clearpage
    \thispagestyle{empty}
    \begingroup
    \vsize=\textwidth
    \hsize=\textheight
    \linewidth=\hsize
    \columnwidth=\hsize
    \@colroom=\vsize
    \textheight=\vsize
    \@colht=\vsize
    \def\@makecol{\LS@makecol\LS@rot}%
    \def\@makefcolumn##1{\LS@makefcolumn{##1}\LS@rot}}
\def\endmsulandscape{%
    \ifGin@pdftex
    \pdfpageattr{/Rotate 90}
    \fi
    \clearpage
     \endgroup
    \global\@colht=\textheight
    \global\vsize=\textheight
    \global\@colroom=\textheight}

% Define the lscapenum environment.
\newenvironment{lscapenum}{
 \clearpage\thispagestyle{empty}
  \begin{landscape}
   \pagestyle{fancy}
   \fancyhead{} % clear all header fields
   \fancyfoot{} % clear all footer fields
   \renewcommand{\headrulewidth}{0pt}
   \rfoot{
      \setlength{\unitlength}{\textheight}
     \begin{picture}(0,0)
         \put(.077,0.78){\begin{sideways}\thepage\end{sideways}}
     \end{picture}
   }
}
{
 \end{landscape}
 \pagestyle{plain}
}

% Set the starting page style
\pagestyle{empty} 

答案1

您可以在命令后立即放置以下代码片段\appendix

\makeatletter
\addtocontents{toc}{%
  \protect\renewcommand\protect\cftsecpresnum{Appendix }% Prepend Appendix
  \protect\setlength\protect\cftsecnumwidth{6em}% Adjust width of section number in ToC
}
\renewcommand{\@seccntformat}[1]{Appendix~\csname the#1\endcsname \quad}
\makeatother

第一个\addtocontents{toc}{...}部分将适当的更改放入 ToC 文件中。更具体地说,它在每个部分编号前面加上Appendix并提供部分编号宽度的调整(因为它现在Appendix也包含单词)。第二个部分将部分编号格式\@seccntformat添加Appendix~到前面(适用于所有部分单元。也许这就足够了。

相关内容