使用 natbib 更改引用样式(将 [1-4] 更改为 [1]-[4],将 [5, 8-9] 更改为 [5], [8]-[9])?

使用 natbib 更改引用样式(将 [1-4] 更改为 [1]-[4],将 [5, 8-9] 更改为 [5], [8]-[9])?

我花了一整天时间尝试解决以下问题。如果您知道如何解决,请帮忙。

我正在使用natbib( ),并且我\usepackage[sort&compress,square,comma]{natbib}当前的引用样式如下[1-4][5, 8-9]

[1]-[4]将引用样式更改为和的最简单方法是什么[5],[8]-[9]

答案1

这是一个不寻常的要求。

natbib请下载修改后的版本pastebin(它太长了,无法直接粘贴到这里)。将此文件保存到modnatbib.styTeX 可以找到的地方(例如,您当前的工作目录),并在您的文档中使用此包,而不是natbib使用以下numbers,sort&compress选项:

\usepackage[numbers,sort&compress]{modnatbib}

下面是一个完整的例子。

文件biblio.bib

@BOOK{Carey,
   AUTHOR="G. V. Carey",
   TITLE="Mind the Stop: A Brief Guide to Punctuation",
   PUBLISHER="Penguin", YEAR="1958"}

@BOOK{Cooper,
   AUTHOR="Bruce M. Cooper",
   TITLE="Writing Technical Reports",
   PUBLISHER="Penguin", YEAR="1964"}

@BOOK{Fowler-ModernEnglish,
   AUTHOR="H. W. Fowler",
   TITLE="[A Dictionary of] Modern {E}nglish Usage",
   PUBLISHER="Oxford University Press",
   EDITION="2", YEAR="1965"}
   (but first published in 1926)

@BOOK{Fowler-KingsEnglish,
   AUTHOR="H. W. Fowler and F. G. Fowler",
   TITLE="The {K}ing's {E}nglish",
   PUBLISHER="Oxford University Press",
   EDITION="3", YEAR="1931"}
   (but first published in 1906)

@BOOK{Gowers,
   AUTHOR="Sir Ernest Gowers",
   TITLE="The Complete Plain Words",
   PUBLISHER="Penguin", YEAR="1954"}
   (but first published by HMSO)

@BOOK{Hart,
   AUTHOR="Horace Hart",
   TITLE="[Hart's] Rules for Compositors and Readers 
          [at the Oxford University Press]",
   PUBLISHER="Oxford University Press",
   EDITION="39", YEAR="1983"}
   (but first published in 1893)

@BOOK{Partridge,
   AUTHOR="Eric Partridge",
   TITLE="Use and Abuse: a Guide to Good {E}nglish",
   PUBLISHER="Hamish Hamilton",
   EDITION="4", YEAR="1970"}
   (but first published in 1947)

@BOOK{Quirk-CompGram,
   AUTHOR="Randolph Quirk and Sydney Greenbaum and Geoffrey Leach and
           Jan Svartnik",
   TITLE="A Comprehensive Grammar of the {E}nglish Language",
   PUBLISHER="Longman", YEAR="1985"}

.tex文件:

\documentclass{article}
\usepackage[numbers,sort&compress]{modnatbib}

\begin{document}

\nocite{*}

\cite{Carey,Cooper,Fowler-ModernEnglish}

\cite{Carey,Gowers,Hart,Partridge,Quirk-CompGram}

\cite{Carey,Cooper,Fowler-ModernEnglish,Gowers,Hart,Partridge,Quirk-CompGram}

\cite{Carey,Cooper,Fowler-KingsEnglish,Gowers,Partridge,Quirk-CompGram}

\cite{Carey,Cooper,Fowler-ModernEnglish,Fowler-KingsEnglish,Gowers,Hart,Partridge,Quirk-CompGram}

\bibliographystyle{plainnat}
\bibliography{biblio}

\end{document}

输出:

在此处输入图片描述

在下面的评论中提到,书目样式是IEEEtran;由于这不是与直接兼容的样式之一natbib,我预计会出现一些问题,但以下示例(使用.bib与之前相同的文件)不会产生任何错误并产生预期的结果:

\documentclass{IEEEtran}
\usepackage[numbers,sort&compress]{modnatbib}

\begin{document}

\nocite{*}

\cite{Carey,Cooper,Fowler-ModernEnglish}

\cite{Carey,Gowers,Hart,Partridge,Quirk-CompGram}

\cite{Carey,Cooper,Fowler-ModernEnglish,Gowers,Hart,Partridge,Quirk-CompGram}

\cite{Carey,Cooper,Fowler-KingsEnglish,Gowers,Partridge,Quirk-CompGram}

\cite{Carey,Cooper,Fowler-ModernEnglish,Fowler-KingsEnglish,Gowers,Hart,Partridge,Quirk-CompGram}

\bibliographystyle{IEEEtran}
\bibliography{biblio}

\end{document}

输出:

在此处输入图片描述

相关内容