自定义章节的标题格式

自定义章节的标题格式

以下代码用于在书籍环境中撰写论文时自定义章节和部分。我遇到的问题是我无法自定义章节和章节标题的字体大小。请问有人能提出解决方案吗

\makeatletter
\newcommand{\setappendix}{Appendix~\thechapter}
\newcommand{\setchapter}{Chapter~\thechapter~} 
\titleformat{\chapter}[display]{\sffamily\bfseries\huge\color{black}}{}{0.5ex} %
{\ifnum\pdfstrcmp{\@currenvir}{appendices}=0
    \setappendix
    \else
    \setchapter
    \fi 
    \filleft \\%
    \titlerule[1pt]
    \vspace{1ex}%
#1\filleft\\
    \vspace{1ex}%
    \titlerule[3pt]}

\titleformat{name=\chapter,numberless}[display]{ \color{black}\sffamily\bfseries\huge}{}{0.5ex}%
{ \titlerule[1pt]
    \vspace{1ex}%
    #1\filleft
    \addcontentsline{toc}{chapter}{#1}
    \markboth{}{#1}\\
    \vspace{1ex}%
    \titlerule[3pt]}
\makeatother

\titlespacing*{\chapter}{0ex}{-10ex}{0ex}

\titleformat{\section}{\Large\bfseries}{}{0.0ex} %
{\sffamily\color{black} \thesection~#1 \filright}[\smallskip]

\titleformat{name = \section, numberless}{\Large\bfseries}{}{0.0pt}%
{\sffamily\color{black}#1\filright}[\smallskip]

\titleformat{\subsection}[hang]{\sffamily\Large}{}{0.5ex}%
{\color{black}\thesubsection~#1\filright}[\smallskip]

\titleformat{name = \subsection, numberless}[hang] {\sffamily\Large}{}{0.5ex}%
{\color{black}#1\filright}[\smallskip] 

相关内容