我正在使用 scrbook 类制作歌曲集。每首歌曲都是使用 导入的单个文件\input
。我用它\enumerate
来制作歌词和副歌。目前,我将整首歌曲放在一个小页面中,以防止歌曲之间出现分页符,因此单个文件如下所示:
\begin{minipage}
\section*{Title of the song}
\begin{enumerate}
\item first line of first verse\\
second line of first verse\\
third line of first verse\\
and so on
\item [] first line of first refrain\\
and so on
\item etc...
\end{enumerate}
\end{minipage}
这可以防止任何分页符(如果一首歌曲太长,一页无法容纳,我必须手动插入 \newpage)。
我想要做的是允许从左手边页面到右手边页面的诗句之间进行分页,但不允许从右手边页面到左手边页面进行分页。
是否有一些命令或包可以做到这一点?
答案1
虽然我自己对这种“黑客”解决方案并不是很满意,但你可以通过有条件地更改列表的分页惩罚来实现这种行为:如果歌曲从奇数页开始,则enumerate
不允许环境之间的分页,但允许在偶数页上分页。
然而,这要求 (a) 没有一首歌曲(在奇数页上)大于一页,并且 (b) 一首歌曲只由一个enumerate
环境组成。
\documentclass[twoside]{article}
\usepackage{ifoddpage}
\makeatletter
\newcommand{\songpenalties}{%
\checkoddpage%
\ifoddpage%
\@itempenalty 10000% disallows page breaks between items in a list
\widowpenalties 1 10000% disallows page breaks between lines inside a verse
\else%
\@itempenalty 0% allows page breaks between items in a list
\widowpenalties 1 10000% disallows page breaks between lines inside a verse
% \widowpenalties 0% if you would like to have page breaks between lines
\fi%
}
\makeatother
\newcommand{\demosong}
{%
\section*{Title of the song}
\begin{enumerate}
\item first line of first verse\\
second line of first verse\\
third line of first verse\\
and so on
\item [] first line of first refrain\\
and so on
\item first line of second verse\\
second line of second verse\\
third line of second verse\\
and so on
\item [] first line of first refrain\\
and so on
\item etc...
\end{enumerate}
}
\begin{document}
\raggedbottom
\songpenalties % prepend each song with the \songpenalties
\demosong % replace these with your \input-s (without minipages)
\songpenalties
\demosong
\songpenalties
\demosong
\songpenalties
\demosong
\songpenalties
\demosong
\end{document}
编译后的文档如下所示: