
아래 코드는 홀수 쪽 페이지에 대해서는 올바른 간격을 생성하지만 짝수 쪽 페이지에 대해서는 잘못된 간격을 생성합니다.
올바른 간격:
잘못된 간격:
두 선언을 시각적으로 구별하려는 시도에서 세 가지 차이점을 발견할 수 있었습니다.
- 오른쪽이 아닌 왼쪽 바닥글을 선언했습니다.
- 홀수 페이지가 아닌 짝수 페이지에 바닥글을 선언했습니다.
mark
내 선언 순서는 반대입니다. 첫 번째 선언과\rlap
그 옆에 있는 으로 시작합니다 .\llap
내 .mark
발행하지 않고도 올바른 간격을 생성할 수 있지만 \llap
거기에 페이지 번호를 표시하고 싶습니다.
선언으로 인해 생성된 불필요한 공간을 제거하는 방법은 무엇입니까 \fancyfoot[LE]
? / 홀수 페이지의 간격과 정확히 동일한 짝수 페이지의 올바른 간격을 생성하는 방법은 무엇입니까?
암호:
\documentclass[twoside]{article}
\usepackage{xcolor}
\usepackage{lipsum}
\usepackage{fancyhdr}
\newlength\titleindent
\setlength\titleindent{.25in}
\pagestyle{fancy}
\fancyhf{}
%\renewcommand{\sectionmark}[1]{\markboth{#1}{}}
%\renewcommand{\subsectionmark}[1]{\markright{#1}}
\fancyfoot[RO]{%
\leftmark\strut\rlap{\hskip\titleindent\parbox{\titleindent}{\color{blue}\thepage\strut}}%
}%
\fancyfoot[LE]{%
\llap{\parbox{\titleindent}{\color{blue}\thepage\strut}}\leftmark\strut%
}%
\renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{.4pt}
\begin{document}
\section{Section}
\lipsum\lipsum
\end{document}
답변1
egreg가 말했듯이그의 대답, \makebox
여기에서도 사용하세요.
\documentclass[twoside]{article}
\usepackage{xcolor}
\usepackage{lipsum}
\usepackage{fancyhdr}
\newlength\titleindent
\setlength\titleindent{.25in}
\pagestyle{fancy}
\fancyhf{}
%\renewcommand{\sectionmark}[1]{\markboth{#1}{}}
%\renewcommand{\subsectionmark}[1]{\markright{#1}}
\fancyfoot[RO]{%
\leftmark\strut\makebox[0pt][l]{\hspace{\titleindent}\color{blue}\thepage\strut}%
}%
\fancyfoot[LE]{%
\makebox[0pt][r]{\color{blue}\thesection\hspace{\titleindent}}\leftmark\strut%
}%
\renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{.4pt}
\begin{document}
\section{Section}
\lipsum\lipsum
\end{document}