3源代码说明45
106110621063106410651066106710681069107010711072107310741075
{\\normalfont\\parindent\\CTEX@chapter@indent\\CTEX@chapter@format\\ifnum\\c@secnumdepth>\\m@ne\\if@mainmatter%\\huge\\bfseries\\@chapapp\\space\\thechapter\\par\\nobreak\\vskip20\\p@
\\CTEX@chaptername\\fi\\fi
\\interlinepenalty\\@M
%\\Huge\\bfseries#1\\par\\nobreak
\\CTEX@chapter@titleformat#1\\par\\nobreak%\\vskip40\\p@
\\vskip\\CTEX@chapter@afterskip}}
??/ctexcap|book????ctexcap??}{}
有一些是report类和book类共有的
1076107710781079108010811082108310841085108610871088
???ctexcap|report|book??
\\def\\@makeschapterhead#1{%%\\vspace*{50\\p@}%
\\vspace*{\\CTEX@chapter@beforeskip}%
%{\\normalfont\\parindent\\z@\\raggedright
{\\normalfont\\parindent\\CTEX@chapter@indent\\CTEX@chapter@format\\interlinepenalty\\@M
%\\Huge\\bfseries#1\\par\\nobreak
\\CTEX@chapter@titleformat#1\\par\\nobreak%\\vskip40\\p@
\\vskip\\CTEX@chapter@afterskip}}
??/ctexcap|report|book??
3.8.4
1089
section的标题
???ctexcap|cls??
下面修改节的标题的显示方式
1090109110921093109410951096109710981099
\\def\\@seccntformat#1{%
\\@ifundefined{CTEX@#1name}%
{\\csnamethe#1\\endcsname\\quad}%{\\csnameCTEX@#1name\\endcsname}}\\def\\@sect#1#2#3#4#5#6[#7]#8{%\\ifnum#2>\\c@secnumdepth\\let\\@svsec\\@empty\\else
\\refstepcounter{#1}%
\\protected@edef\\@svsec{\\@seccntformat{#1}\\relax}%
3源代码说明46
11001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134
%
%
%
%
\\fi
\\@tempskipa#5\\relax\\ifdim\\@tempskipa>\\z@\\begingroup#6{%
\\@hangfrom{\\hskip#3\\relax\\@svsec}%\\interlinepenalty\\@M#8\\@@par}%\\interlinepenalty\\@M
\\csnameCTEX@#1@titleformat\\endcsname#8\\@@par}%\\endgroup
\\csname#1mark\\endcsname{#7}%\\addcontentsline{toc}{#1}{%
\\ifnum#2>\\c@secnumdepth\\else
\\protect\\numberline{\\csnamethe#1\\endcsname}%\\protect\\numberline{\\@ifundefined{CTEXthe#1}%
{\\csnamethe#1\\endcsname}%
{\\csnameCTEXthe#1\\endcsname}}%
\\fi#7}%\\else
\\def\\@svsechd{%#6{\\hskip#3\\relax\\@svsec#8}%
\\@svsec\\csnameCTEX@#1@titleformat\\endcsname#8}%\\csname#1mark\\endcsname{#7}%\\addcontentsline{toc}{#1}{%
\\ifnum#2>\\c@secnumdepth\\else
\\protect\\numberline{\\csnamethe#1\\endcsname}%\\protect\\numberline{\\@ifundefined{CTEXthe#1}%
{\\csnamethe#1\\endcsname}%
{\\csnameCTEXthe#1\\endcsname}}%
\\fi#7}}%\\fi
\\@xsect{#5}}
通常中文章节标题编号会比较长,因此目录中的缩进距离也要调整。我们通过修改\\numberline命令来实现。
1135113611371138113911401141
\\def\\numberline#1{%
\\settowidth\\@tempdimb{#1\\hspace{0.5em}}%\\ifdim\\@tempdima<\\@tempdimb%\\@tempdima=\\@tempdimb%\\fi%
\\hb@xt@\\@tempdima{#1\\hfil}}\\renewcommand\\section{\\@startsection{section}{1}%
3源代码说明47
1142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166
{\\CTEX@section@indent}%
{\\CTEX@section@beforeskip}%{\\CTEX@section@afterskip}%
{\\normalfont\\CTEX@section@format}}
\\renewcommand\\subsection{\\@startsection{subsection}{2}%
{\\CTEX@subsection@indent}%
{\\CTEX@subsection@beforeskip}%{\\CTEX@subsection@afterskip}%
{\\normalfont\\CTEX@subsection@format}}
\\renewcommand\\subsubsection{\\@startsection{subsubsection}{3}%
{\\CTEX@subsubsection@indent}%
{\\CTEX@subsubsection@beforeskip}%{\\CTEX@subsubsection@afterskip}%
{\\normalfont\\CTEX@subsubsection@format}}
\\renewcommand\\paragraph{\\@startsection{paragraph}{4}%
{\\CTEX@paragraph@indent}%
{\\CTEX@paragraph@beforeskip}%{\\CTEX@paragraph@afterskip}%
{\\normalfont\\CTEX@paragraph@format}}
\\renewcommand\\subparagraph{\\@startsection{subparagraph}{5}%
{\\CTEX@subparagraph@indent}%
{\\CTEX@subparagraph@beforeskip}%{\\CTEX@subparagraph@afterskip}%
{\\normalfont\\CTEX@subparagraph@format}}??/ctexcap|cls??
3.8.5页眉信息的修改
修改页眉中的标题,首先是article类中的定义
1167116811691170117111721173117411751176117711781179118011811182
???ctexcap??
\\ifCTEX@cls{article}{??/ctexcap??
???ctexcap|article??\\if@twoside
\\def\\ps@headings{%
\\let\\@oddfoot\\@empty\\let\\@evenfoot\\@empty
\\def\\@evenhead{\\thepage\\hfil\\slshape\\leftmark}%\\def\\@oddhead{{\\slshape\\rightmark}\\hfil\\thepage}%\\let\\@mkboth\\markboth\\def\\sectionmark##1{%
\\markboth{\\MakeUppercase{%\\ifnum\\c@secnumdepth>\\z@
%\\thesection\\quad
\\CTEXthesection\\quad%\\fi
3源代码说明48
1183118411851186118711881189119011911192119311941195119611971198119912001201120212031204
##1}}{}}%
\\def\\subsectionmark##1{%\\markright{%
\\ifnum\\c@secnumdepth>\\@ne
%\\thesubsection\\quad
\\CTEXthesubsection\\quad%\\fi##1}}}
\\else
\\def\\ps@headings{%
\\let\\@oddfoot\\@empty
\\def\\@oddhead{{\\slshape\\rightmark}\\hfil\\thepage}%\\let\\@mkboth\\markboth\\def\\sectionmark##1{%
\\markright{\\MakeUppercase{%\\ifnum\\c@secnumdepth>\\m@ne
%\\thesection\\quad
\\CTEXthesection\\quad%\\fi
##1}}}}
\\fi
??/ctexcap|article??
然后是report类中的页眉定义
120512061207120812091210121112121213121412151216121712181219122012211222122312241225
??ctexcap??}{\\ifCTEX@cls{report}{???ctexcap|report??\\if@twoside
\\def\\ps@headings{%
\\let\\@oddfoot\\@empty\\let\\@evenfoot\\@empty
\\def\\@evenhead{\\thepage\\hfil\\slshape\\leftmark}%\\def\\@oddhead{{\\slshape\\rightmark}\\hfil\\thepage}%\\let\\@mkboth\\markboth\\def\\chaptermark##1{%
\\markboth{\\MakeUppercase{%\\ifnum\\c@secnumdepth>\\m@ne
%\\@chapapp\\\\thechapter.\\%
\\CTEXthechapter\\quad%\\fi
##1}}{}}%
\\def\\sectionmark##1{%
\\markright{\\MakeUppercase{%\\ifnum\\c@secnumdepth>\\z@
%\\thesection.\\%
\\CTEXthesection\\quad%\\fi