Bibliography database & sorting

A .bib file has no idea how it will finally be printed, and that ignorance is the whole design. It is a plain-text database — @article{shannon1948, author = {Shannon, Claude E.}, …} — that records only what a work is, never how it should look, which is why a single .bib outlives every LaTeX paper you write and every journal you send them to. The catch is that a database has a grammar, and this grammar hides some surprises: in a .bib file % does not start a comment, a comma inside a name means something very specific, and one pair of curly braces is the only defence you have when a style decides to rewrite your title. This page is about the file itself: entry types, fields, how to choose a citation key, the syntax of names, accents, @string and crossref.

That division of labour is the design decision itself, made in the mid-1980s. Keep the data (.bib) apart from the appearance (a .bst style) and changing venue costs you one line of style, with the data untouched. Put the other way round: the moment you feel tempted to encode appearance into the .bib, you have usually already lost. How to drive the tools — the latex → bibtex → latex → latex order, how to pick a .bst — belongs to the BibTeX page, and how to write \cite in the body belongs to the citing page. Here we look strictly inside the file.

Inside one entry: @type{key, field = {value}}

An entry is made of three parts: a type after the @, a citation key immediately inside the brace, and a comma-separated run of fields. There is no fourth thing to learn. Here is one entry — Shannon’s 1948 paper founding information theory.

references.bib
@article{shannon1948,
  author  = {Shannon, Claude E.},
  title   = {A Mathematical Theory of Communication},
  journal = {Bell System Technical Journal},
  volume  = {27},
  number  = {3},
  pages   = {379--423},
  year    = {1948}
}

The details are forgiving. Values may be wrapped in braces { } or in double quotes " ", and a purely numeric value such as year = 1948 may be left bare. A trailing comma after the last field is optional. Type and field names are case-insensitive, so @Article and @article, Title and title, are the same thing. In practice, settle on braces: quotes break on any value that itself contains a ", and braces sit more comfortably next to @string macros. Note the double hyphen in pages = {379--423} — it typesets as an en dash “–”. A single hyphen comes out as a short hyphen, which is wrong for a range.

How to choose a citation key (and which characters are forbidden)

The citation key is entirely yours; anything goes as long as it is unique within the .bib. It must match \cite{shannon1948} in the body character for character, case included. The common convention is surname + year (shannon1948), with a letter appended on collision — shannon1948a, shannon1948b — and a key you can recall beats a machine-generated one every time. The forbidden characters are fixed: braces, commas, spaces, backslashes, #, % and ~ are barred everywhere, and biber additionally rejects round brackets, quotation marks and =. Define the same key twice and BibTeX says Repeated entry---line 15 of file refs.bib and throws the later entry away entirely. That is the classic accident after importing the same record twice from a reference manager, so the message is worth memorising.

Which entry type: @article, @book, @inproceedings or @misc

The type declares what a work is, and the moment you pick it the style also decides which fields appear and in what order. Classic BibTeX has these fourteen standard types. Each one comes with required fields (a warning if one is missing) and optional fields, and the file that holds that assignment is not yours — it is the style (.bst).

TypeWhat it is forKey required fields
@articleA paper in a journal or periodicalauthor, title, journal, year
@bookA book with a named publisherauthor or editor, title, publisher, year
@bookletA bound work with no named publishertitle (at minimum)
@inproceedingsA paper in conference proceedingsauthor, title, booktitle, year
@conferenceAlias for @inproceedings (Scribe compat.)(same as @inproceedings)
@proceedingsThe proceedings volume itself; the crossref parenttitle, year
@incollectionA titled chapter in an edited collectionauthor, title, booktitle, publisher, year
@inbookA part of a book (a chapter or page range)author/editor, title, chapter or pages, publisher, year
@phdthesisA doctoral dissertationauthor, title, school, year
@mastersthesisA master’s thesisauthor, title, school, year
@techreportA report from an institutionauthor, title, institution, year
@manualA technical or software manualtitle (at minimum)
@unpublishedAn unpublished manuscript or draftauthor, title, note
@miscAnything that fits nowhere abovenone required (fill in with howpublished, note)

Two pairs cause most of the hesitation. @inbook vs @incollection: the first is part of one book (chapter 3 of your own, say), the second is a self-contained piece by a different author inside an editor’s collection. @inproceedings vs @conference are functionally identical — @conference survives only as an alias for compatibility with Scribe, the typesetting system BibTeX descends from, so write @inproceedings in anything new. Theses split by degree between @phdthesis and @mastersthesis, and whatever fits nowhere drops into @misc, propped up by howpublished or note.

Modern biblatex subsumes nearly all of this and adds more: @online (alias @electronic) for web resources, a generic @report whose type field spells out the kind, a degree-agnostic @thesis, and @xdata — a pure data container that can never be cited or printed, existing only to be inherited from. @online suits arXiv and preprint records, paired with the eprint fields described below. These newer types assume biber/biblatex; classic bibtex with a .bst may not understand them.

Required and optional fields — and where the DOI and URL go

A field is a name = {value} pair. Which ones are required and which optional varies by type, and the style draws that line. Omit a required field and BibTeX warns; a field it does not recognise is (in most styles) ignored in silence — so the extra fields that ride in with imported metadata do no harm. These are the ones you meet across all types.

  • author / editor — author or editor; the multi-author syntax is the next section.
  • title — the title: a paper name, a book title, a chapter heading.
  • journal / booktitle — the journal name (@article), or the containing book or proceedings title (@inproceedings, @incollection).
  • year / month / date — classic BibTeX uses year and month; biblatex prefers an ISO form such as date = {2026-05-01} (a bare date = {2026} is fine).
  • volume / number / pages — volume, issue and pages; ranges take the double hyphen, pages = {379--423}.
  • publisher / institution / school — publisher / issuing institution (reports) / degree-granting university (theses).
  • doi / url / urldate — the DOI (just the 10.… body, no https://doi.org/ prefix), a URL, and biblatex’s access date.
  • eprint / eprinttype / eprintclass — biblatex’s preprint fields. For arXiv: eprint = {2405.00001}, eprinttype = {arxiv} (formerly archivePrefix), eprintclass (formerly primaryClass) for the subject.
  • note / howpublished — free-form remarks / “how it was published”, the usual home for a @misc entry’s URL.

Here is the pothole nearly everyone hits once. The classic standard styles know nothing about doi or url. The string url does not occur even once inside plain.bst, and a field you carefully filled in simply vanishes — without so much as a warning. There are three ways out: load \usepackage{url} and push the address into howpublished = {\url{https://…}}; switch to a style that does understand them, such as plainnat (natbib) or IEEEtran; or move to biblatex, where doi, url and urldate are first-class fields and output can be suppressed with an option like \usepackage[doi=false]{biblatex}. The right habit is to record both in the data always and let the style decide whether to print them.

references.bib
% classic BibTeX: standard .bst styles drop doi/url, so use howpublished
@misc{tug2024,
  author       = {{TeX Users Group}},
  title        = {TeX Live 2024},
  howpublished = {\url{https://tug.org/texlive/}},
  note         = {Accessed 7 August 2026},
  year         = {2024}
}

% biblatex: doi, url and urldate are proper fields
@online{arxiv2405,
  author     = {Doe, Jane},
  title      = {A Preprint with a {DOI}},
  date       = {2024-05-01},
  eprint     = {2405.00001},
  eprinttype = {arxiv},
  doi        = {10.1000/example},
  url        = {https://arxiv.org/abs/2405.00001},
  urldate    = {2026-08-07}
}

Writing author names: and, von, Jr and the four-part grammar

Separate several authors with and — never with a comma, because the comma has another job. BibTeX reads a single name as four parts: First, von, Last and Jr, and it accepts exactly three ways of writing one: First von Last, von Last, First, and von Last, Jr, First. The comma is the mark that shows where one part ends. That is why author = {Shannon, Claude E.} means surname Shannon, given name Claude E. The first, natural order is usually fine, but it fails in two cases: when there is a Jr part, and when the surname has several words but no von part. Write Per Brinch Hansen and BibTeX misreads “Brinch” as part of the first name; write Brinch Hansen, Per and no misreading is possible.

references.bib
@book{names2026,
  author = {de la Vall{\'e}e Poussin, Charles Louis Xavier Joseph
            and Brinch Hansen, Per
            and Ford, Jr., Henry
            and {The TeX Users Group}
            and others},
  title  = {Four Ways to Write One Name},
  publisher = {William Reid {and} Company},
  year   = {2026}
}

So how does BibTeX know that de la is a von part? The rule is disarmingly plain: a token counts as von if its first letter outside braces is lowercase. In de la Vall{\'e}e Poussin, de and la begin in lowercase and become the von part, and the two words that follow are the Last part. The rule can be gamed — prefixing a dummy control sequence that begins with a capital will push a lowercase surname into the Last part. Three practical consequences follow. When there are too many authors, end the list with and others and the style substitutes “et al.”. A corporate name must be wrapped whole in braces, {The TeX Users Group}, so the and inside it is not read as a separator. In biblatex the same rule reaches the literal lists publisher, institution, organization and location, where an and that belongs to a company name must be braced: publisher = {William Reid {and} Company}.

Accents and non-ASCII names: G{\"o}del is not the same as Gödel

To classic bibtex, an accented character is a “special character” — everything from a top-level opening brace immediately followed by a backslash, through to the matching closing brace. {\"o} and {\'e} are such things, and BibTeX counts the whole group as a single letter. The effect shows up plainly in labels. Under the alpha style, G{\"o}del produces the label G{\"o}d31, but the same name typed as raw UTF-8, Gödel, produces Gö31 — because ö occupies two bytes and bibtex 0.99d, counting bytes, has spent its three characters by then. Sorting suffers the same way, and names in Japanese, Chinese or Korean fare worse still. There is one practical conclusion: if you have non-ASCII names, use biber, which is built for UTF-8 and sorts with locale-aware collation. If you must stay on classic BibTeX, write the names in the {\"o} form or switch to the eight-bit bibtex8 / bibtexu.

references.bib
% classic bibtex + alpha.bst -> label [G{\"o}d31]
@article{godel1931a,
  author  = {G{\"o}del, Kurt},
  title   = {On Formally Undecidable Propositions},
  journal = {Monatshefte},
  year    = {1931}
}

% same name in raw UTF-8 -> label [Gö31] under bibtex 0.99d; fine under biber
@article{godel1931b,
  author  = {Gödel, Kurt},
  title   = {Same Name, Raw UTF-8},
  journal = {Monatshefte},
  year    = {1931}
}

Why {DNA} needs braces — and when it does not

The classic styles — plain, abbrv, unsrt, alphalowercase a paper’s title except for its first letter. So title = {A Theory of DNA and Galois Theory} is printed as “A theory of dna and galois theory”. Proper nouns and acronyms are shown no mercy. There is exactly one tool against it: wrap the span you want to keep in a second pair of braces. Written {DNA}, that span is placed outside the conversion. Not knowing this one move is the single biggest cause of a mangled bibliography. Why the processor behaves this way is a matter for the BibTeX page.

With biblatex and biber the story changes. The standard styles — numeric, authoryear and the rest — do not touch the case of a title at all; it comes out exactly as typed. Sentence casing happens only when you ask for it explicitly, with something like \DeclareFieldFormat{titlecase}{\MakeSentenceCase*{#1}}, and even then the default option bibtexcaseprotection=true reproduces BibTeX’s brace rule, so {DNA} is still protected. Set bibtexcaseprotection=false and braces stop protecting; you state your intention with \NoCaseChange{DNA} instead. The habit of bracing therefore still works under biblatex — you simply need it far less often than you used to.

One detail here repays knowing. Old .bib files often brace single capitals — title = {An Introduction to {L}a{T}e{X}} — but the biblatex manual advises against it, because braces kill the kerning on both sides of the letter they enclose, leaving the word subtly loose. Bracing the whole word, {LaTeX}, gives the same protection without damaging the spacing. A second detail: what is protected is what sits inside braces, not what sits inside a control sequence. A macro has to be wrapped along with its text, as in {\TeX book}; a bare \TeX is not protected.

references.bib
% unprotected: plain.bst prints "A theory of dna and galois theory"
% protected:   prints "A theory of DNA and Galois theory"
@article{protect2026,
  author  = {Doe, Jane},
  title   = {A Theory of {DNA} and {Galois} Theory},
  journal = {J. Test},
  year    = {2026}
}

% brace the whole word, not single letters: {LaTeX}, not {L}a{T}e{X}
% wrap a macro together with its text: {\TeX book}

@string abbreviations, @preamble, and comments in a .bib

When the same value keeps recurring, @string lets you define a macro. Put the defined name in a value position without braces, and join it to other strings with #. It is the standard way to switch between abbreviated and full journal names, and a common arrangement is to keep the @string definitions in their own .bib and read it first, as in \bibliography{strings,refs}. You are in fact already using the mechanism: the standard styles predefine the months jan through dec as @string macros, which is why month = jan is written without braces — month = {jan} gives you not the macro but the literal string “jan”.

references.bib
@string{bstj = {Bell System Technical Journal}}

@preamble{ "\newcommand{\noopsort}[1]{} " }

@article{shannon1948,
  author  = {Shannon, Claude E.},
  title   = {A Mathematical Theory of Communication},
  journal = bstj # { (Supplement)},
  month   = jan,
  year    = {1948}
}

@comment{ everything in here is skipped, portably }

@preamble is a different animal: it sends its contents — usually LaTeX macro definitions — straight to the top of the .bbl. Use it when a small helper such as the sorting trick \noopsort ought to travel with the data. As for comments, a famous misconception needs clearing up: % is not a comment character in a .bib file. Classic bibtex ignores everything outside an entry (@…{}), so a line starting with % simply passes through as ignored text and merely looks like a comment. The danger is inside: put a bare % in a field value and it flows into the .bbl, where it becomes a real LaTeX comment character and eats the rest of the line. Inside a value, always write \%.

The portable form is @comment{ … }, whose contents are skipped entirely and which is safe under biber too. That matters, because biber is stricter than classic bibtex: loose text outside an entry earns the warning warning: 30 characters of junk seen at toplevel. And if all you want is to disable an entry for a while, the shortest route is to delete one character — turn @article{…} into article{…} and it is no longer an entry, just a run of ignored text.

Writing the proceedings once: the crossref field

The crossref field makes one entry inherit the fields it lacks from another. When you cite five papers from the same volume, there is no need to type the conference name, the editors and the year five times. Put one @proceedings entry in as the parent, write crossref = {gg1988} in each child @inproceedings, and booktitle, editor and year all come down from above. The duplication disappears — and with it the nuisance of five slightly different spellings of the same conference name.

references.bib
@inproceedings{gneisser1988,
  crossref = {gg1988},
  author   = {Gneisser, Rocky},
  title    = {No Gnats Are Taken for Granite},
  pages    = {133--139}
}

% the parent must appear LATER in the file than every entry citing it
@proceedings{gg1988,
  editor    = {Ford, Gerald and Carter, Jimmy},
  title     = {The Gnats and Gnus 1988 Proceedings},
  booktitle = {The Gnats and Gnus 1988 Proceedings},
  year      = {1988}
}

Three rules attach. First, the parent must sit later in the file than every entry that references it — which is why the convention is to gather crossref parents at the end. Second, even if you never \cite the parent, it appears in the reference list of its own accord once two or more children point at it; with only one child it stays out, and its fields are instead printed inline inside that child. The threshold is adjustable with bibtex --min-crossrefs=N. Third, nested crossref is not reliable, so do not give a parent a parent of its own. biblatex offers a separate mechanism, xdata, which inherits data without establishing any parent–child relation — the natural choice for a bundle such as publisher plus location that is not itself a work.

Who decides the order of the reference list

Not you — and that is good news. The order entries appear in has nothing to do with the order you typed them; the tool decides. Under classic BibTeX the order is fixed by the style (.bst). You get almost no say, so choosing the style is choosing the order. plain and alpha sort alphabetically by author, unsrt uses order of first citation in the text, and engineering styles such as ieeetr do the same. Leave the data untouched, change \bibliographystyle{plain} to \bibliographystyle{unsrt}, and the whole list rearranges itself. Sorting Japanese references is the job of pbibtex / upbibtex (see the BibTeX page).

biblatex hands that decision back to you. Independently of the style, \usepackage[sorting=nyt]{biblatex} settles the order. Sort keys are spelled as letter combinations: n for name, y for year, t for title.

OptionKey orderMeaning
ntyname → title → yearname, then title, then year (biblatex default)
nytname → year → titlename, year, title (favoured for author–year)
yntyear → name → titleyear, then name, then title (chronological)
ydntyear (descending) → name → titlenewest year first, then older
none(no sorting)order of citation (the unsrt equivalent)

In short: to keep citation order, choose the unsrt style under BibTeX or sorting=none under biblatex. For alphabetical order, plain under BibTeX or the default nty under biblatex (nyt for author–year). Either way, you never reorder the entries in the .bib by hand. That is the tool’s job; yours is only to record the data accurately — pick the right type, write names along the four-part grammar, brace the capitals that must survive. A .bib that observes those three will outlive the paper you are writing right now.