3源代码说明49

122612271228122912301231123212331234123512361237123812391240

##1}}}}

\\else

\\def\\ps@headings{%

\\let\\@oddfoot\\@empty

\\def\\@oddhead{{\\slshape\\rightmark}\\hfil\\thepage}%\\let\\@mkboth\\markboth\\def\\chaptermark##1{%

\\markright{\\MakeUppercase{%\\ifnum\\c@secnumdepth>\\m@ne

%\\@chapapp\\\\thechapter.\\%

\\CTEXthechapter\\quad%\\fi

##1}}}}

\\fi

??/ctexcap|report??

然后是book类中的页眉定义

1241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268

??ctexcap??}{

???ctexcap|book??\\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\\if@mainmatter

%\\@chapapp\\\\thechapter.\\%

\\CTEXthechapter\\quad%\\fi\\fi

##1}}{}}%

\\def\\sectionmark##1{%

\\markright{\\MakeUppercase{%\\ifnum\\c@secnumdepth>\\z@

%\\thesection.\\%

\\CTEXthesection\\quad%\\fi

##1}}}}

\\else

\\def\\ps@headings{%

\\let\\@oddfoot\\@empty

\\def\\@oddhead{{\\slshape\\rightmark}\\hfil\\thepage}%

3源代码说明50

126912701271127212731274127512761277127812791280128112821283

%

\\let\\@mkboth\\markboth\\def\\chaptermark##1{%

\\markright{\\MakeUppercase{%\\ifnum\\c@secnumdepth>\\m@ne\\if@mainmatter

\\@chapapp\\\\thechapter.\\%\\CTEXthechapter\\quad%\\fi\\fi

##1}}}}

\\fi

??/ctexcap|book?????ctexcap??}}

??/ctexcap??

让前面的页眉定义生效:

1284

??ctexcap|cls??\\pagestyle{headings}

\\ps@fancy如果使用了fancyhdr宏包,需要修改其定义的宏,以正确显示中文页眉。

1285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309

???ctexcap|cls??

\\@ifundefined{ps@fancy}{}{%\\def\\ps@fancy{%

\\@ifundefined{@chapapp}{\\let\\@chapapp\\chaptername}{}%foramsbook\\@ifundefined{MakeUppercase}{\\def\\MakeUppercase{\%uppercase}}{}%\\@ifundefined{chapter}{\\def\\sectionmark##1{\\markboth{\\MakeUppercase{\\ifnum\\c@secnumdepth>\\z@%\\thesection\\hskip1em\\relax\\fi##1}}{}}%

\\CTEXthesection\\quad\\fi##1}}{}}%

\\def\\subsectionmark##1{\\markright{\\ifnum\\c@secnumdepth>\\@ne%\\thesubsection\\hskip1em\\relax\\fi##1}}}%

\\CTEXthesubsection\\quad\\fi##1}}}%

{\\def\\chaptermark##1{\\markboth{\\MakeUppercase{\\ifnum\\c@secnumdepth>\\m@ne%\\@chapapp\\\\thechapter.\\\\fi##1}}{}}%

\\ifCTEX@cls{book}{\\if@mainmatter\\CTEXthechapter\\quad\\fi}{\\CTEXthechapter\\quad}\\fi##1}}{}}%

\\def\\sectionmark##1{\\markright{\\MakeUppercase{\\ifnum\\c@secnumdepth>\\z@%\\thesection.\\\\fi##1}}}}%

\\CTEXthesection\\quad\\fi##1}}}}%\\ps@@fancy

\\gdef\\ps@fancy{\\@fancyplainfalse\\ps@@fancy}%\\ifdim\\headwidth<0sp

\\global\\advance\\headwidth123456789sp\\global\\advance\\headwidth\\textwidth\\fi}}