머리글의 페이지 번호를 여백에 어떻게 배치하나요?

머리글의 페이지 번호를 여백에 어떻게 배치하나요?

다음 코드를 사용하고 있는데 왼쪽 페이지의 왼쪽과 오른쪽 페이지의 오른쪽에 머리글을 정렬하고 정의된 형상 대신 여백에 페이지 번호를 넣는 방법을 알 수 없습니다.

\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

관련 정보