我如何才能强制书目项目不跨页面拆分?

我如何才能强制书目项目不跨页面拆分?

可能重复:
如何防止段落或参考书目条目的行之间出现分页符?

\documentclass{mwrep}
\usepackage[nodisplayskipstretch]{setspace} \setstretch{1.9}
\begin{document}

Dummy

\begin{thebibliography}{999}

\bibitem{1}John Doe, Jane Doe, Captain America, Superman:
\emph{Bibliography item with a very long title: part one},
Some title of a magazine with a very long title, 2009, pages 1234--4321

\bibitem{2}John Doe, Jane Doe, Captain America, Superman:
\emph{Bibliography item with a very long title: part one},
Some title of a magazine with a very long title, 2009, pages 1234--4321

\bibitem{3}John Doe, Jane Doe, Captain America, Superman:
\emph{Bibliography item with a very long title: part one},
Some title of a magazine with a very long title, 2009, pages 1234--4321

\bibitem{4}John Doe, Jane Doe, Captain America, Superman:
\emph{Bibliography item with a very long title: part one},
Some title of a magazine with a very long title, 2009, pages 1234--4321

\bibitem{5}John Doe, Jane Doe, Captain America, Superman:
\emph{Bibliography item with a very long title: part one},
Some title of a magazine with a very long title, 2009, pages 1234--4321

\bibitem{6}John Doe, Jane Doe, Captain America, Superman:
\emph{Bibliography item with a very long title: part one},
Some title of a magazine with a very long title, 2009, pages 1234--4321

\bibitem{7}John Doe, Jane Doe, Captain America, Superman:
\emph{Bibliography item with a very long title: part one},
Some title of a magazine with a very long title, 2009, pages 1234--4321

\bibitem{8}John Doe, Jane Doe, Captain America, Superman:
\emph{Bibliography item with a very long title: part one},
Some title of a magazine with a very long title, 2009, pages 1234--4321

\bibitem{9}John Doe, Jane Doe, Captain America, Superman:
\emph{Bibliography item with a very long title: part one},
Some title of a magazine with a very long title, 2009, pages 1234--4321

\bibitem{10}John Doe, Jane Doe, Captain America, Superman:
\emph{Bibliography item with a very long title: part one},
Some title of a magazine with a very long title, 2009, pages 1234--4321


\end{thebibliography}
\end{document}

如您所见,第 10 项被拆分到两个页面。如何防止这种情况并强制 bibitem 出现在单个页面上?

别误会我的意思。我的目标不是将所有内容都放在一页上。我只是不喜欢我的参考书目中有破碎的实体。

答案1

请注意,@egreg 提出的解决方案正是您所要求的。但是,您可能需要重新考虑这是否真的是您想要的应该要求。如果书目条目跨越 4、5 甚至(颤抖)更多行怎么办?在这种情况下,您是否仍想禁止任何换行符,冒着创建可怕的未满页面的风险?或者,您只想告诉 LaTeX 不要在参考书目中创建“孤行”(页面底部的单行)或“寡行”(页面顶部的单行)?避免创建印刷孤行和孤行可能是一个更合理的目标。

不幸的是(在我看来),主要的 LaTeX 文档类为环境设置了和的thebibliography相当宽松的设置。这些参数用于为排版“寡妇”和“孤儿”(后者在 TeX 术语中称为“俱乐部”)分配惩罚。幸运的是,可以使用包的命令轻松将这些惩罚更改为——功能上等同于“无穷大” :\widowpenalty\clubpenalty400010000etoolbox\AtBeginEnvironment

\usepackage{etoolbox}
\makeatletter
\AtBeginEnvironment{thebibliography}{%
   \clubpenalty10000
   \@clubpenalty \clubpenalty
   \widowpenalty10000}
\makeatother

在您的序言中添加此内容后,您的参考书目的第 10 条条目(以及任何其他由 3 行或更少行组成的条目)将不再分布在两页上。

顺便说一句,如果您的需求是一次性的,您甚至不需要担心包裹。只需在第一条指令etoolbox之后和之前包含以下指令:\begin{thebibliography}{99}\bibitem

\makeatletter
    \clubpenalty10000
    \@clubpenalty \clubpenalty
    \widowpenalty10000
\makeatother

答案2

只需\interlinepenalty=10000添加\begin{thebibliography}

\begin{thebibliography}{99}
\interlinepenalty=10000

\bibitem{1}John Doe, Jane Doe, Captain America, Superman:
\emph{Bibliography item with a very long title: part one},
Some title of a magazine with a very long title, 2009, pages 1234--4321

...

\end{thebibliography}

这会阻止段落内的分页。

相关内容