Three Methods to Order Citations by Appearance in BibTeX

Nov 13, 2025 · Programming · 12 views · 7.8

Keywords: BibTeX | Reference Sorting | biblatex

Abstract: This article details three main methods for ordering references by citation order in BibTeX: using the unsrt style, customizing with the makebst tool, and the recommended approach using the biblatex package. It focuses on the configuration methods and code examples of the biblatex package, including the setting of the sorting=none option, citation of bibliographic databases, and generation of reference lists. The article also provides complete LaTeX code examples and compilation considerations to help readers quickly master this practical technique.

Introduction

In academic writing, the order of references is crucial for the readability and standardization of papers. By default, BibTeX uses the plain style to arrange references alphabetically, which may not meet the requirements in certain disciplines. Many journals and conferences require references to be listed in the order they appear in the text, necessitating appropriate configuration of BibTeX's sorting mechanism.

Three Main Solutions

Using the unsrt Style

The simplest method is to use BibTeX's built-in unsrt style. This style is specifically designed to order references by citation order while maintaining a relatively concise format. To use this style, simply replace \bibliographystyle{plain} in the document with \bibliographystyle{unsrt}.

It is important to note that after switching styles, the document needs to be recompiled multiple times to ensure all intermediate files are updated correctly. Specifically, previously generated .aux and .bbl files should be deleted or overwritten, followed by recompiling the document using the standard LaTeX→BibTeX→LaTeX→LaTeX workflow.

Customizing with makebst Tool

For users requiring finer control, the makebst tool can be used to create custom bibliography styles. This tool guides users through an interactive question-and-answer process to set various formatting options, including sorting method, citation format, and handling of entry types.

The main steps for using makebst include: running the latex makebst command to start the configuration wizard, selecting the desired options based on prompts, and finally generating a custom .bst file. This file should be placed in the document directory and referenced in the document via \bibliographystyle{filename}.

Recommended Solution: biblatex Package

biblatex is currently the most complete and flexible bibliography processing tool, offering rich configuration options and better extensibility. To use biblatex for ordering by citation appearance, the sorting=none option must be specified when loading the package in the document preamble.

A complete configuration example is as follows:

\documentclass[12pt]{article}
\usepackage[sorting=none]{biblatex}
\addbibresource{journals.bib}
\addbibresource{phd-references.bib}
\begin{document}
This is the document body, citing references: \cite{robertson2007} and \cite{earnshaw1842}.
\printbibliography
\end{document}

In this example, the sorting=none option ensures references are ordered by citation order rather than the default alphabetical order. The \addbibresource command is used to add BibTeX database files, supporting multiple file references. The \printbibliography command generates the reference list at the end of the document.

Technical Details Analysis

Advantages of biblatex

Compared to traditional BibTeX, biblatex has several significant advantages: First, it provides more flexible sorting options, supporting not only sorting=none but also sorting by author, year, title, and more; second, it improves the handling of entry types, supporting more types of bibliographic entries; finally, its configuration is more intuitive, with most options directly set via package parameters.

Compilation Considerations

When using biblatex, the compilation workflow differs from traditional BibTeX. The following command sequence is recommended:

pdflatex document.tex
biber document.bcf
pdflatex document.tex
pdflatex document.tex

Here, biber is used as the backend processor instead of the traditional bibtex. biber handles Unicode characters and complex bibliographic data better, making it the preferred choice for modern LaTeX documents.

Style Compatibility

When choosing a sorting method, compatibility with the overall document style must also be considered. The unsrt style is simple but relatively fixed in format; makebst allows fully custom styles but requires more configuration time; biblatex offers predefined styles and flexible customization options, meeting most usage scenarios.

Practical Application Suggestions

For new LaTeX projects, the biblatex solution is highly recommended. It not only solves the sorting issue but also provides a solid foundation for future expansion needs. If modifications are needed in existing projects, the unsrt style or makebst tool can be chosen based on the specific situation.

In practical use, it is advisable to always use version control systems to manage documents and bibliographic files, facilitating rollbacks to previous states and avoiding issues caused by style changes.

Conclusion

Through the three methods introduced in this article, users can flexibly meet the requirement of ordering BibTeX references by citation appearance. Among them, the biblatex solution stands out as the preferred choice due to its comprehensive functionality and excellent extensibility. Regardless of the method chosen, attention to the correct compilation workflow and file management is essential to ensure the accuracy of the final result.

Copyright Notice: All rights in this article are reserved by the operators of DevGex. Reasonable sharing and citation are welcome; any reproduction, excerpting, or re-publication without prior permission is prohibited.