![回想録の紙面に対してフッターを中央揃えにする](https://rvso.com/image/305762/%E5%9B%9E%E6%83%B3%E9%8C%B2%E3%81%AE%E7%B4%99%E9%9D%A2%E3%81%AB%E5%AF%BE%E3%81%97%E3%81%A6%E3%83%95%E3%83%83%E3%82%BF%E3%83%BC%E3%82%92%E4%B8%AD%E5%A4%AE%E6%8F%83%E3%81%88%E3%81%AB%E3%81%99%E3%82%8B.png)
ページスタイルのフッターを、ページの余白ではなく、物理的な用紙の幅を基準にして中央に配置したいと思います。タイトル ページ専用のページスタイルを作成しました。行によって\makerunningwidth
ページの中心が適切に計算されると思いましたが、ご覧のとおり、ページ番号が残りのテキスト (用紙の中央を基準にして完全に揃っている) と揃っていません。
文書は次のように生成されます
\documentclass{memoir}
\copypagestyle{INRSDocExamTitle}{plain}
\makerunningwidth{INRSDocExamTitle}{\paperwidth}
\makeoddfoot{INRSDocExamTitle}{}{\thepage}{}
\makeevenfoot{INRSDocExamTitle}{}{\thepage}{}
\begin{document}
\thispagestyle{INRSDocExamTitle}
\newlength{\centeradjust}
\calccentering{\centeradjust} % Calculate center length and stores in centeradjust
\begin{adjustwidth*}{\centeradjust}{-\centeradjust} % Adjust center
\begin{adjustwidth}{-1cm}{-1cm}
\begin{center}
\begin{OnehalfSpace}
\vspace*{3\baselineskip}
{\Large Centered text using adjustwidth (as per the \texttt{memoir} manual)}
\vfill
{\large This foooter is not centered with respect to the page,\\
but with respect to the type block. \\
$\downarrow$
}
\vspace*{3\baselineskip}
\end{OnehalfSpace}
\end{center}
\end{adjustwidth}
\end{adjustwidth*}
\end{document}
余白ではなくページに対してフッターを中央に配置する方法はありますか?
答え1
不均一な余白を補正するためにページ番号をオフセットするという考え方です。
\documentclass{memoir}
\copypagestyle{INRSDocExamTitle}{plain}
\makeoddfoot{INRSDocExamTitle}{}{\thepage\offset}{}
\makeevenfoot{INRSDocExamTitle{}{\thepage\offset}{}
\newcommand{\offset}% center page number in text area
{\ifodd\value{page}\hspace{\dimexpr 2in+2\oddsidemargin+\textwidth-\paperwidth}%
\else\hspace{\dimexpr 2in+2\evensidemargin+\textwidth-\paperwidth}%
\fi}
\usepackage{tikzpagenodes}% used only to show center of page
\begin{document}
\pagestyle{INRSDocExamTitle}
\begin{tikzpicture}[remember picture,overlay]
\draw[red] (current page.north) -- (current page.south);
\end{tikzpicture}
odd page
\newpage
\begin{tikzpicture}[remember picture,overlay]
\draw[red] (current page.north) -- (current page.south);
\end{tikzpicture}
even page
\end{document}
答え2
私の意見では、最も簡単な方法は、この特定のページスタイルを手動でコーディングすることです。
\makeatletter
\@namedef{ps@INRSDocExamTitle}{%
\@namedef{@oddfoot}{%
\hspace{-\spinemargin}%
\parbox[b]{\paperwidth}{%
\strut\hfill \thepage \hfill\strut%
}%
}%
}
\makeatother
効果を示すためだけに
\documentclass[a4paper]{memoir}
\setlrmarginsandblock{1cm}{4cm}{*}
\checkandfixthelayout
\makeatletter
\@namedef{ps@INRSDocExamTitle}{%
\@namedef{@oddfoot}{%
\hspace{-\spinemargin}%
\parbox[b]{\paperwidth}{%
\strut\hfill \thepage \hfill\strut%
}%
}%
}
\makeatother
\begin{document}
\thispagestyle{INRSDocExamTitle}
\newlength{\centeradjust}
\calccentering{\centeradjust} % Calculate center length and stores in centeradjust
\begin{adjustwidth*}{\centeradjust}{-\centeradjust} % Adjust center
\begin{adjustwidth}{-1cm}{-1cm}
\begin{center}
\begin{OnehalfSpace}
\vspace*{3\baselineskip}
{\Large Centered text using adjustwidth (as per the \texttt{memoir} manual)}
\vfill
This foooter is not centered with respect to the page,\\
but with respect to the type block.
$\downarrow$
\noindent
test\hfill\smash{%
\rule[-3.7cm]{0.4pt}{4cm}%
}\hfill test%
\vspace*{3\baselineskip}
\end{OnehalfSpace}
\end{center}
\end{adjustwidth}
\end{adjustwidth*}
\end{document}