Banner of A Complete Guide to plain and unsrt Bibliography Styles in LaTeX

How to Use plain and unsrt Bibliography Styles in LaTeX


Category: Latex

Date: 8 days ago
Views: 71


LaTeX provides a powerful way to manage bibliographies using BibTeX. Two common bibliography styles are `plain` and `unsrt`. This article will demonstrate how to use both styles in your LaTeX documents.

Using the `plain` Style

The `plain` style sorts the references alphabetically by the author's last name. Here's an example:

LaTeX File (`main.tex`)

        
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{cite}

\begin{document}

\title{Sample Document}
\author{Author Name}
\date{\today}

\maketitle

\section{Introduction}
This document cites multiple sources \cite{goossens97, lamport94, knuth84, greenwade93, patashnik88}.

\bibliographystyle{plain}
\bibliography{references}

\end{document}
        
    

BibTeX File (`references.bib`)

        
@book{patashnik88,
  author    = "Oren Patashnik",
  title     = "BibTeXing",
  year      = "1988",
  publisher = "Oren Patashnik",
  address   = "Stanford, California"
}

@book{lamport94,
  author    = "Leslie Lamport",
  title     = "LaTeX: A Document Preparation System",
  year      = "1994",
  publisher = "Addison-Wesley",
  address   = "Reading, Massachusetts"
}

@book{knuth84,
  author    = "Donald E. Knuth",
  title     = "The TeXbook",
  year      = "1984",
  publisher = "Addison-Wesley",
  address   = "Reading, Massachusetts"
}

@book{goossens97,
  author    = "Michel Goossens and Frank Mittelbach and Alexander Samarin",
  title     = "The LaTeX Companion",
  year      = "1997",
  publisher = "Addison-Wesley",
  address   = "Reading, Massachusetts"
}

@article{greenwade93,
  author    = "George D. Greenwade",
  title     = "The {C}omprehensive {T}e{X} {A}rchive {N}etwork ({CTAN})",
  year      = "1993",
  journal   = "TUGBoat",
  volume    = "14",
  number    = "3",
  pages     = "342--351"
}
        
    

In the document above, the bibliography will be sorted alphabetically by the authors' last names.

latex bibliography
Latex Bibliography ordered alphabetically

Using the `unsrt` Style

The `unsrt` style lists references in the order they are cited in the document. Here's how to use it:

LaTeX File (`main.tex`)

        
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{cite}

\begin{document}

\title{Sample Document}
\author{Author Name}
\date{\today}

\maketitle

\section{Introduction}
This document cites multiple sources \cite{goossens97, lamport94, knuth84, greenwade93, patashnik88}.

\bibliographystyle{unsrt}
\bibliography{references}

\end{document}
        
    

BibTeX File (`references.bib`)

        
@book{patashnik88,
  author    = "Oren Patashnik",
  title     = "BibTeXing",
  year      = "1988",
  publisher = "Oren Patashnik",
  address   = "Stanford, California"
}

@book{lamport94,
  author    = "Leslie Lamport",
  title     = "LaTeX: A Document Preparation System",
  year      = "1994",
  publisher = "Addison-Wesley",
  address   = "Reading, Massachusetts"
}

@book{knuth84,
  author    = "Donald E. Knuth",
  title     = "The TeXbook",
  year      = "1984",
  publisher = "Addison-Wesley",
  address   = "Reading, Massachusetts"
}

@book{goossens97,
  author    = "Michel Goossens and Frank Mittelbach and Alexander Samarin",
  title     = "The LaTeX Companion",
  year      = "1997",
  publisher = "Addison-Wesley",
  address   = "Reading, Massachusetts"
}

@article{greenwade93,
  author    = "George D. Greenwade",
  title     = "The {C}omprehensive {T}e{X} {A}rchive {N}etwork ({CTAN})",
  year      = "1993",
  journal   = "TUGBoat",
  volume    = "14",
  number    = "3",
  pages     = "342--351"
}
        
    

In the document above, the bibliography will be listed in the order the references are cited in the text.

latex bibliography
Latex Bibliography ordered from bib file

Compiling the Document

To compile your LaTeX document with BibTeX, follow these steps:

  1. Run pdflatex main.tex to generate an initial `.aux` file.
  2. Run bibtex main.aux to generate the bibliography.
  3. Run pdflatex main.tex twice more to update references and generate the final document.

By using these steps and styles, you can control the order of your bibliography entries in LaTeX documents. Choose `plain` for alphabetical order or `unsrt` for citation order.



71 views

Previous Article Next Article

0 Comments, latest

No comments.