回憶錄中頁腳相對於紙張居中

回憶錄中頁腳相對於紙張居中

我想將頁面樣式的頁腳居中,而不是相對於頁面的邊距,而是相對於實體紙張的寬度。我專門為標題頁創建了一個頁面樣式。我認為該\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}

有沒有辦法讓頁腳相對於頁面居中,而不是邊距居中?

樣本 PDF

答案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

IMO 最簡單的事情是手動編碼這個特定的頁面樣式:

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

在此輸入影像描述

相關內容