如何使用 BibTeX 按外观对引文进行排序?

发布于 2024-07-06 11:06:40 字数 88 浏览 8 评论 0原文

默认情况下(使用 plain 样式)BibTeX 按字母顺序对引文进行排序。

如何按文档中出现的顺序对引文进行排序?

By default (using the plain style) BibTeX orders citations alphabetically.

How to order the citations by order of appearance in the document?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(13

把昨日还给我 2024-07-13 11:06:40

这个问题有三个很好的答案。

  • 如果您对其格式满意,请使用 unsrt 参考书目样式,否则
  • 使用 makebst (link) 工具来设计您自己的参考书目风格

我个人的建议:

  • 使用 biblatex(链接)。 它是 LaTeX 世界中最完整、最灵活的参考书目工具。

使用 biblatex,你可以写类似的东西

\documentclass[12pt]{article}
\usepackage[sorting=none]{biblatex}
\bibliography{journals,phd-references} % Where journals.bib and phd-references.bib are BibTeX databases
\begin{document}
\cite{robertson2007}
\cite{earnshaw1842}
\printbibliography
\end{document}

There are three good answers to this question.

  • Use the unsrt bibliography style, if you're happy with its formatting otherwise
  • Use the makebst (link) tool to design your own bibliography style

And my personal recommendation:

  • Use the biblatex package (link). It's the most complete and flexible bibliography tool in the LaTeX world.

Using biblatex, you'd write something like

\documentclass[12pt]{article}
\usepackage[sorting=none]{biblatex}
\bibliography{journals,phd-references} % Where journals.bib and phd-references.bib are BibTeX databases
\begin{document}
\cite{robertson2007}
\cite{earnshaw1842}
\printbibliography
\end{document}
情深已缘浅 2024-07-13 11:06:40

更改

\bibliographystyle{plain}

\bibliographystyle{ieeetr}

“然后重建它几次”以替换使用普通样式时生成的 .aux.bbl 文件。

或者只需删除 .aux.bbl 文件并重建。

如果您使用 MiKTeX,则无需下载任何额外内容。

Change

\bibliographystyle{plain}

to

\bibliographystyle{ieeetr}

Then rebuild it a few times to replace the .aux and .bbl files that were made when you used the plain style.

Or simply delete the .aux and .bbl files and rebuild.

If you use MiKTeX you shouldn't need to download anything extra.

紧拥背影 2024-07-13 11:06:40

我想到的最好的办法是使用 unsrt 样式,这似乎是一种经过调整的 plain 样式。 即

\bibliographystyle{unsrt}
\bibliography{bibliography}

但是如果我的样式不是默认样式怎么办?

The best I came up with is using the unsrt style, which seems to be a tweaked plain style. i.e.

\bibliographystyle{unsrt}
\bibliography{bibliography}

However what if my style is not the default?

东走西顾 2024-07-13 11:06:40

只是一个简短的说明 - 我正在使用 plain.bst 的修改版本位于包含我的 Latex 文件的目录中; 事实证明,按出现顺序排序是一个相对容易的更改; 只需找到一段代码:

...
ITERATE {presort}

SORT
...

...并对其进行评论 - 我将其变成:

...
%% % avoid sort:
%% ITERATE {presort}
%%
%% SORT
...

...然后,在运行 bibtex, pdflatex, pdflatex< /code> - 引文将按出现顺序排序(也就是说,它们将不排序:))。

干杯!

编辑:刚刚意识到我写的实际上是在 @ChrisN 的评论中:“你可以编辑它以删除 SORT 命令”;)

Just a brief note - I'm using a modified version of plain.bst sitting in the directory with my Latex files; it turns out having sorting by order of appearance is a relatively easy change; just find the piece of code:

...
ITERATE {presort}

SORT
...

... and comment it - I turned it to:

...
%% % avoid sort:
%% ITERATE {presort}
%%
%% SORT
...

... and then, after running bibtex, pdflatex, pdflatex - the citations will be sorted by order of appearance (that is, they will be unsorted :) ).

Cheers!

EDIT: just realized that what I wrote is actually in the comment by @ChrisN: "can you edit it to remove the SORT command" ;)

尤怨 2024-07-13 11:06:40

您回答了自己的问题——当您希望对 ne 的引用按出现顺序列出时,请使用 unsrt

但您可能还想看看 natbib ,一个极其灵活的引文包。 我无法想象没有它的生活。

You answered your own question---unsrt is to be used when you want references to ne listed in the order of appeareance.

But you might also want to have a look at natbib, an extremely flexible citation package. I can not imagine living without it.

留蓝 2024-07-13 11:06:40

我对 Bibtex(以及一般的 Latex)有点陌生,我想重温这篇旧文章,因为我发现它出现在我的许多关于 Latex 中参考书目排序的 Google 搜索查询中。

我对这个问题提供了更详细的答案,希望它可以帮助一些和我面临同样困难的新手。

以下是调用参考书目的主 .tex 文件的示例:

\documentclass{article}
\begin{document}

So basically this is where the body of your document goes.

``FreeBSD is easy to install,'' said no one ever \cite{drugtrafficker88}.

``Yeah well at least I've got chicken,'' said Leeroy Jenkins \cite{goodenough04}.

\newpage
\bibliographystyle{ieeetr} % Use ieeetr to list refs in the order they're cited
\bibliography{references} % Or whatever your .bib file is called
\end{document}

...以及 .bib 文件本身的示例:

@ARTICLE{ goodenough04,
AUTHOR    = "G. D. Goodenough and others", 
TITLE     = "What it's like to have a sick-nasty last name",
JOURNAL   = "IEEE Trans. Geosci. Rem. Sens.",
YEAR      = "xxxx",
volume    = "xx",
number    = "xx",
pages     = "xx--xx"
}
@BOOK{ drugtrafficker88,
AUTHOR    = "G. Drugtrafficker", 
TITLE     = "What it's Like to Have a Misleading Last Name",
YEAR      = "xxxx",
PUBLISHER = "Harcourt Brace Jovanovich, Inc."
ADDRESS   = "The Florida Alps, FL, USA"
}

请注意 .bib 文件中的引用以相反的顺序列出,但引用列在它们在论文中被引用的顺序。

有关 .bib 文件格式的更多信息,请访问:http://en.wikibooks。 org/wiki/LaTeX/Bibliography_Management

I'm a bit new to Bibtex (and to Latex in general) and I'd like to revive this old post since I found it came up in many of my Google search inquiries about the ordering of a bibliography in Latex.

I'm providing a more verbose answer to this question in the hope that it might help some novices out there facing the same difficulties as me.

Here is an example of the main .tex file in which the bibliography is called:

\documentclass{article}
\begin{document}

So basically this is where the body of your document goes.

``FreeBSD is easy to install,'' said no one ever \cite{drugtrafficker88}.

``Yeah well at least I've got chicken,'' said Leeroy Jenkins \cite{goodenough04}.

\newpage
\bibliographystyle{ieeetr} % Use ieeetr to list refs in the order they're cited
\bibliography{references} % Or whatever your .bib file is called
\end{document}

...and an example of the .bib file itself:

@ARTICLE{ goodenough04,
AUTHOR    = "G. D. Goodenough and others", 
TITLE     = "What it's like to have a sick-nasty last name",
JOURNAL   = "IEEE Trans. Geosci. Rem. Sens.",
YEAR      = "xxxx",
volume    = "xx",
number    = "xx",
pages     = "xx--xx"
}
@BOOK{ drugtrafficker88,
AUTHOR    = "G. Drugtrafficker", 
TITLE     = "What it's Like to Have a Misleading Last Name",
YEAR      = "xxxx",
PUBLISHER = "Harcourt Brace Jovanovich, Inc."
ADDRESS   = "The Florida Alps, FL, USA"
}

Note the references in the .bib file are listed in reverse order but the references are listed in the order they are cited in the paper.

More information on the formatting of your .bib file can be found here: http://en.wikibooks.org/wiki/LaTeX/Bibliography_Management

放手` 2024-07-13 11:06:40

我经常使用参考书目风格 natbib 因为它为我们提供了相当完整的格式和标签集。

I often use the bibliography style natbib because it supplies quite complete set of formats as well as tags for us.

逐鹿 2024-07-13 11:06:40

如果您希望引用数量在文档中按顺序显示,请添加此项
它们只会在参考页面中未排序:

\bibliographystyle{unsrt}

Add this if you want the number of citations to appear in order in the document
they will only be unsorted in the reference page:

\bibliographystyle{unsrt}
夜访吸血鬼 2024-07-13 11:06:40

我在背面使用了以下内容并按升序排列:

\usepackage{cite}

\bibliographystyle{unsrt}

I used the following in overleaf and become in ascending order:

\usepackage{cite}

\bibliographystyle{unsrt}

一生独一 2024-07-13 11:06:40

对于unsrt,问题在于格式。 使用 \bibliographystyle{ieeetr} 按文档中引用的顺序获取参考文献。

with unsrt the problem is the format. use \bibliographystyle{ieeetr} to get refences in order of citation in document.

樱花坊 2024-07-13 11:06:40

如果您碰巧使用 amsrefs,它们将覆盖上述所有内容 - 因此请注释掉:

\usepackage{amsrefs}

If you happen to be using amsrefs they will override all the above - so comment out:

\usepackage{amsrefs}

郁金香雨 2024-07-13 11:06:40

datatool 包提供了一种按任意标准对参考书目进行排序的好方法,首先将其转换为某种数据库格式。

简短的示例,取自此处并发布记录:

\documentclass{article}

\usepackage{databib}

\begin{document}
% First argument is the name of new datatool database
% Second argument is list of .bib files
\DTLloadbbl{mybibdata}{acmtr}
% Sort database in order of year starting from most recent
\DTLsort{Year=descending}{mybibdata}
% Add citations
\nocite{*}

% Display bibliography
\DTLbibliography{mybibdata}
\end{document}

The datatool package offers a nice way to sort bibliography by an arbitrary criterion, by converting it first into some database format.

Short example, taken from here and posted for the record:

\documentclass{article}

\usepackage{databib}

\begin{document}
% First argument is the name of new datatool database
% Second argument is list of .bib files
\DTLloadbbl{mybibdata}{acmtr}
% Sort database in order of year starting from most recent
\DTLsort{Year=descending}{mybibdata}
% Add citations
\nocite{*}

% Display bibliography
\DTLbibliography{mybibdata}
\end{document}
放赐 2024-07-13 11:06:40

我将 natbibbibliographystyle{apa} 结合使用。 例如:

\begin{document}

The body of the document goes here...

\newpage

\bibliography{bibliography} % Or whatever you decided to call your .bib file 

\usepackage[round, comma, sort&compress ]{natbib} 

bibliographystyle{apa}
\end{document}

I use natbib in combination with bibliographystyle{apa}. Eg:

\begin{document}

The body of the document goes here...

\newpage

\bibliography{bibliography} % Or whatever you decided to call your .bib file 

\usepackage[round, comma, sort&compress ]{natbib} 

bibliographystyle{apa}
\end{document}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文