Centralizando o rodapé em relação ao papel no livro de memórias

Centralizando o rodapé em relação ao papel no livro de memórias

Gostaria de centralizar o rodapé de um estilo de página não em relação às margens da página, mas sim em relação à largura do papel físico. Criei um estilo de página especificamente para a página de título. Achei que a \makerunningwidthlinha calcularia corretamente o centro da página, mas, como você pode ver claramente, o número da página não está alinhado com o resto do texto (que está absolutamente alinhado em relação ao centro do papel).

O documento é gerado com

\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}

Existe uma maneira de centralizar o rodapé em relação à página, não nas margens?

Exemplo de PDF

Responder1

A ideia é compensar o número da página para compensar as margens irregulares.

\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}

Responder2

Na IMO, a coisa mais fácil a fazer é codificar manualmente este estilo de página específico:

\makeatletter
\@namedef{ps@INRSDocExamTitle}{%
  \@namedef{@oddfoot}{%
    \hspace{-\spinemargin}%
      \parbox[b]{\paperwidth}{%
        \strut\hfill \thepage \hfill\strut%
        }%
    }%
}
\makeatother

Só para mostrar o efeito

\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}

insira a descrição da imagem aqui

informação relacionada