
\documentclass[twoside,11pt]{book}
\usepackage{fancyhdr,xcolor,lipsum}
\fancyhead{}
\renewcommand{\headrulewidth}{0pt}
\fancyfoot{}
\colorlet{myfancycolor}{black}
\fancypagestyle{mystyle}{
\renewcommand*\footrulewidth{1pt}
\fancyfoot[OR]{%
\color{myfancycolor}\rule{2em}{2em}\raisebox{0.5em}{\hspace{-2em}\color{white}\makebox[2em][c]{\textsf{\thepage}}}%
\vspace*{-0.8em}%
}
\fancyfoot[OL]{%
\leftmark
}
\fancyfoot[EL]{%
\color{myfancycolor}\rule{2em}{2em}\raisebox{0.5em}{\hspace{-2em}\color{white}\makebox[2em][c]{\textsf{\thepage}}}%
\vspace*{-0.8em}%
}
\fancyfoot[ER]{%
\rightmark
}
}
\pagestyle{mystyle}
\begin{document}
\frontmatter
\chapter{PREFACE}
\lipsum[1-2]
\tableofcontents
\mainmatter
\chapter{LALALA}
\lipsum[1-3]
\end{document}
상자 페이지 번호가 다음과 같이 정렬되기를 원합니다.
값을 -1 em, -2 em으로 변경하려고 했지만 \raisebox
레이아웃을 변경할 수 없습니다.
상자 페이지 번호를 일렬로 만드는 방법은 무엇입니까?
답변1
을 제거 \renewcommand\footrulewidth{1pt}
하고 자신만의 것을 만들 수 있습니다 \hrule
(즉, \hrule
사용된 패키지에 의해 생성되지 않음). Your \hrule
바로 뒤에는 가 올 수 있으므로 및 \hbox
사이에 공백이 없습니다 . 예를 들어 다음과 같이 보일 수 있습니다.\hrule
\hbox
\fancyfoot[EL]{%
\kern-3ex % all material is shifted up by 3ex
\color{myfancycolor}
\hrule height1pt % your \hrule
\hbox{\rlap{\vrule height1.3em width2em depth.7em}% you black box
\hbox to2em{\hss\color{white}{\textsf{\thepage}}\hss}}%
}
답변2
모든 것을 다른 곳에 넣으십시오 \raisebox
.
\raisebox{4pt}[2em]{\color{myfancycolor}\rule{2em}{2em}\raisebox{0.5em}{\hspace{-2em}\color{white}\makebox[2em][c]{\textsf{\thepage}}}%
\vspace*{-0.8em}}