特定奇數(或偶數)頁

特定奇數(或偶數)頁

我需要在每個偶數(或奇數)頁上插入一個特定的頁面(填充用於記筆記的行)。我發現了一些關於修改頁首或頁尾的指示,但沒有任何跡象表明頁面本身上有特定的內容。

感謝大家的幫助

答案1

該解決方案使用\afterpage循環來實現插入。唯一的缺點是它總是在末尾添加一個額外的頁面。

為了提高效率,我將「特定頁面」放入了\savebox

\documentclass{article}
\usepackage{afterpage}
\usepackage{lipsum}
%\usepackage{showframe}

\newsavebox{\pagewithlines}
\newcommand{\numberlines}{10}

\savebox{\pagewithlines}{%
  \count1=\numberlines\relax
  \dimen0=\dimexpr\textheight/\count1 - \baselineskip\relax
  \parbox[c][\textheight][t]{\textwidth}{\null
    \loop\ifnum\count1>0
      \advance\count1 by -1
      \vskip\dimen0\hrulefill
    \repeat}}

% add notes to even pages
\newcommand{\addnotes}{\ifodd\value{page}\else\noindent\usebox\pagewithlines\fi
  \afterpage{\addnotes}}

\AtBeginDocument{\addnotes}

\begin{document}
\lipsum[1-6]
\end{document}

相關內容