AtBeginEnvironment 不适用于 natbib

AtBeginEnvironment 不适用于 natbib

我怎样才能强制书目项目不跨页面分割?描述了如何设置参考书目的惩罚。我试过了,但它不适用于natbib。如果我在文件中写入惩罚.bbl,它会起作用,但由于它经常被覆盖,所以这不是一个好的解决方案。有办法解决这个问题吗?

\documentclass{article}


\usepackage{natbib}
\bibsep0mm

\bibliographystyle{plainnat}

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


\begin{document}


\providecommand{\noopsort}[1]{} \providecommand*{\donothing}[1]{}
  \providecommand*{\printsecond}[2]{#2}
\begin{thebibliography}{1420}
\providecommand{\natexlab}[1]{#1}
\providecommand{\url}[1]{#1}
\providecommand{\urlprefix}{}
\expandafter\ifx\csname urlstyle\endcsname\relax
  \providecommand{\doi}[1]{doi:\discretionary{}{}{}#1}\else
  \providecommand{\doi}{doi:\discretionary{}{}{}\begingroup
  \urlstyle{rm}\Url}\fi


\bibitem[{Abbott(1976)}]{Abbott76a-u}
Abbott, Barbara. 1976.
\newblock Right node raising as a test for constituenthood.
\newblock \emph{Linguistic Inquiry} 7(4). 639--642.

\bibitem[{Abeill{\'e}(1988)}]{Abeille88a}
Abeill{\'e}, Anne. 1988.
\newblock Parsing {French} with {Tree Adjoining Grammar}: {Some} linguistic
  accounts.
\newblock In D{\'e}nes Vargha (ed.), \emph{Proceedings of {COLING} 88}, 7--12.
  University of Budapest: Association for Computational Linguistics.
\newblock \urlprefix\url{http://www.aclweb.org/anthology/C/C88/C88-1002.pdf}.

\bibitem[{Abeill{\'e}(2006)}]{Abeille2006a}
Abeill{\'e}, Anne. 2006.
\newblock In defense of lexical coordination.
\newblock In Olivier Bonami \& Patricia Cabredo~Hofherr (eds.), \emph{Empirical
  issues in formal syntax and semantics}, vol.~6, 7--36. Paris: CNRS.
\newblock \urlprefix\url{http://www.cssp.cnrs.fr/eiss6/}.

\bibitem[{Abeill{\'e} \& Rambow(2000)}]{AR2000a-ed-not-crossreferenced}
Abeill{\'e}, Anne \& Owen Rambow (eds.). 2000.
\newblock \emph{{Tree Adjoining Grammars}: Formalisms, linguistic analysis and
  processing} (CSLI Lecture Notes 156).
\newblock Stanford, CA: CSLI Publications.

\bibitem[{Abeill{\'e} \& Schabes(1989)}]{AS89a}
Abeill{\'e}, Anne \& Yves Schabes. 1989.
\newblock Parsing idioms in {Lexicalized TAG}.
\newblock In Harold Somers \& Mary~McGee Wood (eds.), \emph{Proceedings of the
  {Fourth Conference of the European Chapter of the Association for
  Computational Linguistics}}, 1--9. Manchester, England: Association for
  Computational Linguistics.

\bibitem[{Abney(1987)}]{Abney87a}
Abney, Steven~P. 1987.
\newblock \emph{The {English} noun phrase in its sentential aspect}.
\newblock Cambridge, MA: MIT dissertation.
\newblock \urlprefix\url{http://www.vinartus.net/spa/87a.pdf}.

\bibitem[{Abney(1996)}]{Abney96a}
Abney, Steven~P. 1996.
\newblock Statistical methods and linguistics.
\newblock In Judith~L. Klavans \& Philip Resnik (eds.), \emph{The balancing
  act: Combining symbolic and statistical approaches to language}  (Language,
  Speech, and Communication), 1--26. London, England/""Cambridge, MA: MIT
  Press.

\bibitem[{Abney \& Cole(1986)}]{AC86a}
Abney, Steven~P. \& Jennifer Cole. 1986.
\newblock A {Government-Binding} parser.
\newblock In S.~Berman, J-W. Choe \& J.~McDonough (eds.), \emph{Proceedings of
  {NELS 16}}, 1--17. University of Massachusetts, Amherst: GLSA.

\bibitem[{Abraham(1995)}]{Abraham95a-u}
Abraham, Werner. 1995.
\newblock \emph{{Deutsche Syntax im Sprachenvergleich: Grundlegung einer
  typologischen Syntax des Deutschen}} (Studien zur deutschen Grammatik~41).
\newblock T{\"u}bingen: Stauffenburg Verlag.

\bibitem[{Abraham(2003)}]{Abraham2003a}
Abraham, Werner. 2003.
\newblock The syntactic link between thema and rhema: {The} syntax-discourse
  interface.
\newblock \emph{Folia Linguistica} 37(1--2). 13--34.

\bibitem[{Abraham(2005)}]{Abraham2005a}
Abraham, Werner. 2005.
\newblock \emph{{Deutsche Syntax im Sprachenvergleich: Grundlegung einer
  typologischen Syntax des Deutschen}} (Studien zur deutschen Grammatik~41).
\newblock T{\"u}bingen: Stauffenburg Verlag 2nd edn.

\bibitem[{Abzianidze(2011)}]{Abzianidze2011a-u}
Abzianidze, Lasha. 2011.
\newblock \emph{An {HPSG-based} formal grammar of a core fragment of {Georgian}
  implemented in {TRALE}}.
\newblock Charles University in Prague MA thesis.

\bibitem[{Ackerman \& Webelhuth(1998)}]{AW98a}
Ackerman, Farrell \& Gert Webelhuth. 1998.
\newblock \emph{A theory of predicates} (CSLI Lecture Notes~76).
\newblock Stanford, CA: CSLI Publications.

\bibitem[{Adams(1984)}]{Adams84a}
Adams, Marianne. 1984.
\newblock Multiple interrogation in {Italian}.
\newblock \emph{The Linguistic Review} 4(1). 1--27.

\bibitem[{Ades \& Steedman(1982)}]{AS82a}
Ades, Anthony~E. \& Mark~J. Steedman. 1982.
\newblock On the order of words.
\newblock \emph{Linguistics and Philosophy} 4(4). 517--558.

\bibitem[{Adger(2003)}]{Adger2003a}
Adger, David. 2003.
\newblock \emph{Core syntax: {A Minimalist} approach} (Oxford Core
  Linguistics~1). This book probably appeared in some series, what shall I write? Some more words to
  force the page break
\newblock Oxford: Oxford University Press Oxford.


\end{thebibliography}


\end{document}

答案1

在“begin”部分末尾添加代码:

\usepackage{etoolbox}
\makeatletter
\apptocmd{\thebibliography}{%
    \clubpenalty\@M
    \@clubpenalty\clubpenalty
    \widowpenalty\@M
}
{}{}
\makeatother

使用您的示例代码,第二页将出现两行,而不是一行。

答案2

您可以使用\interlinepenalty

.....  
\usepackage{etoolbox}
\makeatletter
\AtBeginEnvironment{thebibliography}{%
    \interlinepenalty=10000
    }
.....
\makeatother

答案3

与其尝试“修补”natbib 对thebibliography环境的重新定义,不如直接复制 natbib 的代码并简单地用 替换惩罚4000因子10000

相关代码片段从文件的第 1063 行开始natbib.sty

在您的代码中,删除以下行

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

并将其替换为

\makeatletter
\renewenvironment{thebibliography}[1]{%
 \bibsection
 \parindent\z@
 \bibpreamble
 \bibfont
 \list{\@biblabel{\the\c@NAT@ctr}}{\@bibsetup{#1}\global\c@NAT@ctr\z@}%
 \ifNAT@openbib
   \renewcommand\newblock{\par}%
 \else
   \renewcommand\newblock{\hskip .11em \@plus.33em \@minus.07em}%
 \fi
 \sloppy\clubpenalty10000\widowpenalty10000
 \sfcode`\.\@m
 \let\NAT@bibitem@first@sw\@firstoftwo
    \let\citeN\cite \let\shortcite\cite
    \let\citeasnoun\cite
}{%
 \bibitem@fin
 \bibpostamble
 \def\@noitemerr{%
  \PackageWarning{natbib}{Empty `thebibliography' environment}%
 }%
 \endlist
 \bibcleanup
}%
\makeatother

相关内容