![Центрирование нижнего колонтитула относительно бумаги в мемуарах](https://rvso.com/image/305762/%D0%A6%D0%B5%D0%BD%D1%82%D1%80%D0%B8%D1%80%D0%BE%D0%B2%D0%B0%D0%BD%D0%B8%D0%B5%20%D0%BD%D0%B8%D0%B6%D0%BD%D0%B5%D0%B3%D0%BE%20%D0%BA%D0%BE%D0%BB%D0%BE%D0%BD%D1%82%D0%B8%D1%82%D1%83%D0%BB%D0%B0%20%D0%BE%D1%82%D0%BD%D0%BE%D1%81%D0%B8%D1%82%D0%B5%D0%BB%D1%8C%D0%BD%D0%BE%20%D0%B1%D1%83%D0%BC%D0%B0%D0%B3%D0%B8%20%D0%B2%20%D0%BC%D0%B5%D0%BC%D1%83%D0%B0%D1%80%D0%B0%D1%85.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}