我正在为一位朋友制作一本诗集,使用的是 Memoir 和诗歌包。她希望诗歌只打印在右手边的页面上。我可以让诗歌只从右手边的页面开始,但任何进入第二页的诗歌显然都会溢出到左手边的页面上。我该如何改变这种情况?
答案1
此解决方案也基于包atbegshi
。如果要打印“偶数”页诗,则先输出一个空白页。棘手的部分是修复页面上和文件中的页计数器.log
。
\documentclass{memoir}
\usepackage{atbegshi}
\usepackage{zref-abspage}
\usepackage{lipsum}
\newif\ifoddpoem
\newif\ifoddpoemPageInc
\AtBeginShipout{%
\ifoddpoem
\ifodd\value{abspage}%
\stepcounter{page}%
\global\oddpoemPageInctrue
\advance\value{page} by -1\relax
\else
\stepcounter{abspage}%
\global\oddpoemPageIncfalse
\addtocounter{page}{-1}%
\AtBeginShipoutOriginalShipout\null
\stepcounter{page}%
\fi
\fi
}
\newenvironment{oddpoem}{%
\cleardoublepage
\oddpoemtrue
}{%
\clearpage
\ifoddpoemPageInc
\addtocounter{page}{-1}%
\global\oddpoemPageIncfalse
\fi
}
\begin{document}
\section{Text before poem}
\lipsum[1-4]
\begin{oddpoem}
\section{Short poem}
\lipsum[5-8]
\end{oddpoem}
\section{Text after short poem}
\lipsum[9-12]
\begin{oddpoem}
\section{Long poem}
\lipsum[13-18]
\lipsum[22-24]
\end{oddpoem}
\section{Text after long poem}
\lipsum[25-29]
\end{document}