如何个性化章节标题(Header)的前缀

如何个性化章节标题(Header)的前缀

我想在章节标题的数字前添加关键词“章节”。我使用以下模板论文。例如,第一章是测试,\chapter{test} 这显示以下标题“1 测试” 我想要的更改是将标题改为“第 1 章:测试” 并且我认为以下是需要更改的代码(来自上面模板的 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选项

相关内容