如何個性化章節標題前綴(Header)

如何個性化章節標題前綴(Header)

我想在章節標題的數字之前添加關鍵字chapter。我正在使用以下模板論文。例如,第一章是測試,\chapter{test} 這顯示了以下標題“1 Test”我想要將標題更改為以下“第一章:測試”,我認為以下是要更改的程式碼(來自的 cls 檔案)上面的模板):

 %  Simple interface for the user  to customize the chapter titles 
    \ProvideDocumentCommand{\abovechapterskip}{}{\vspace*{20pt}}
    \ProvideDocumentCommand{\chapterbelowskip}{}{\vspace*{40pt}}
    \ProvideDocumentCommand{\chapterinbetweenskip}{}{\vspace*{20pt}}
    \ProvideDocumentCommand{\autodot}{}{}
    \ProvideDocumentCommand{\mdtChapapp}{}{}
    \ProvideDocumentCommand{\chapteralign}{}{\raggedright}
    \ProvideDocumentCommand{\chapterfont}{}{\Huge\bfseries}
    \ProvideDocumentCommand{\chapterprefixfont}{}{\LARGE\bfseries}
    \DeclareDocumentCommand{\@makechapterhead}{ m }{%
        \abovechapterskip
        {\parindent \z@ \chapteralign \normalfont
            \ifnum \c@secnumdepth >\m@ne
            \if@mainmatter
            \ifbool{chapteroneline}{%
                \chapterfont \mdtChapapp\thechapter\autodot\enspace
            }{%
                \chapterprefixfont \@chapapp\space \thechapter
                \par\nobreak
                \chapterinbetweenskip
            }%
            \fi
            \fi
            \interlinepenalty\@M%
            \chapterfont #1\par\nobreak
            \chapterbelowskip
        }
        \thispagestyle{\chapter@p@gestyle}
    }
    \def\@makeschapterhead#1{%
        \abovechapterskip
        {\parindent \z@ \chapteralign
            \normalfont
            \interlinepenalty\@M
            \chapterfont  #1\par\nobreak
            \chapterbelowskip
        }
        \thispagestyle{\chapter@p@gestyle}
    }


% Addchap provides unnumbered chapters with an entry in the table of contents as well as an updated header
\ProvideDocumentCommand{\addchap}{ s o m }{%
    \chapter*{#3}%
    \markboth{}{}%
    \IfBooleanTF{#1}{%
    }{%
        \IfNoValueTF{#2}{%
            \addchaptertocentry{#3}%
            \markboth{\MakeMarkcase{#3}}{\MakeMarkcase{#3}}%
        }{%
            \addchaptertocentry{#2}%
            \markboth{\MakeMarkcase{#2}}{\MakeMarkcase{#2}}%
        }%
    }%
}%

\ProvideDocumentCommand{\addsec}{ s o m }{%
    \section*{#3}%
    \markright{}%
    \IfBooleanTF{#1}{%
    }{%
        \IfNoValueTF{#2}{%
            \addcontentsline{toc}{section}{#3}%
            \markright{\MakeMarkcase{#3}}%%
        }{%
            \addcontentsline{toc}{section}{#2}%
            \markright{\MakeMarkcase{#2}}%
        }%
    }%
}%

答案1

解決方案是評論chapterinoneline選項

相關內容