如何将页眉的页码放在页边距中?

如何将页眉的页码放在页边距中?

我正在使用以下代码,但无法弄清楚如何将页眉在左页上对齐到左侧,在右页上对齐到右侧,并将页码放在页边距中,而不是在定义的几何图形内。

\makeatletter
\def\chapapp2{Chapter}

\def\appendix{\par
 \setcounter{chapter}{0}
 \setcounter{section}{0}
 \def\chapapp2{Appendix}
 \def\@chapapp{Appendix}
 \def\thechapter{\Alph{chapter}}}

\def\ps@uheadings{\let\@mkboth\markboth
% modifications
\def\@oddhead{\protect\makebox[\textwidth][l]
        {\small\scshape\MakeUppercase{\rightmark}\hfill\thepage}}
\def\@oddfoot{}
\def\@evenfoot{}
\def\@evenhead{\protect\makebox[\textwidth][l]
        {\thepage\hfill\small\scshape\MakeUppercase{\leftmark}}}
% end of modifications
\def\chaptermark##1{\markboth {\ifnum \c@secnumdepth >\m@ne
 \chapapp2\ \thechapter. \ \fi ##1}{}}%
\def\sectionmark##1{\markright {\ifnum \c@secnumdepth >\z@
   \thesection. \ \fi ##1}}}
\makeatother

相关内容