両側のフッターは余分な垂直スペースを生み出します

両側のフッターは余分な垂直スペースを生み出します

以下のコードは、奇数側ページには正しい間隔を生成しますが、偶数側ページには間違った間隔を生成します。

正しい間隔:

ここに画像の説明を入力してください

間隔が間違っています:

ここに画像の説明を入力してください

2 つの宣言を視覚的に区別しようとしたところ、3 つの違いが見つかりました。

  1. 私は右足ではなく左足で宣言しました。
  2. 奇数ページではなく偶数ページのフッターを宣言しました。
  3. mark私の宣言の順序は逆です。最初の宣言ではから始めて、その次に を続けます。 を発行して に続く\rlapと、間違ったスペースが生成されます。\llapmark

を発行せずに正しい間隔を生成することはできます\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

エグレが言うように彼の答え\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}

ここに画像の説明を入力してください

関連情報