Bibliography mkiv

From ConTeXt wiki

< Bibliographies in mkii | sample bib file >

ConTeXt MkIV Bibliography

Please see


From the manual:


a citation: \cite[article,book]



Database Formats

ConTeXt MkIV Bibliography can read several different formats of bibliographic databases:

BibTeX .bib format

ConTeXt is independent from the BibTeX program, but can read .bib databases, if it’s not polluted with non-standarddized (LaTeX) commands. This format is the oldest, but supported by most bibliography management programs. The other supported formats use the same structure of records, just ported to different “languages”.

A BibTeX database is a text file, consisting of entries like:

@Article {Hagen2010,

 author = "One or more authors",
 title = "Some interesting title",
 journal = "Publisher’s Weekly",
 volume = "27",
 number = "2",
 pages = "21--30",
 month = may,
 year = "2020",
 ISSN = "1234-5678"


@Article is an example for a common category, like @Book, @unpublished etc. Letter case doesn’t matter. The first argument reference must not contain spaces and is ended with a comma. Spacing within an entry doesn’t matter. If values consist of only one word, you don’t need quotes, otherwise you can also use brackets.

ConTeXt understands UTF-8 encoded bib files as well as old fashioned TeX accent combinations.


Some known fields of @Article are (see manual p.14):

  • Title (also Title:en, Title:de etc.), Subtitle
  • Author (see manual for possible formats)
  • Journal, Type, Number, Volume, Pages, Review
  • Year, Month, Day
  • Warning, Comment, Note
  • XCrossref
  • Doi
  • Keywords
  • Language
  • Url
  • author, editor: fields are parsed as "Firstname(s) Lastname", multiple entries separated by 'and' (see manual p.6/14)
  • keywords: separated by semicolons

There’s a (complete?) overview of categories and their fields in the manual on page 18 (Table 3.2).

Commands in entries

You can define unknown commands like this:

\definebtxcommand\TUB {TUGboat}

btx commands use a separate namespace.

MkII .bbl format

This intermediate format is still supported, but obsolete. Just an example to let you know what it means:

\startpublication[k=Hagen:Second,t=article,a={Hans Hagen},y=2013,s=HH01] 
    \arttitle{Who knows more?}

Lua tables

Since internally everything anyway are Lua tables, you can use them directly as a database format:

   return { ["Hagen:First"] = {
       author = "Hans Hagen",
       category = "article",
       issn = "1234-5678",
       issue = "3",
       journal = "MyJournal",
       month = "8",
       pages = "123--126",
       tag = "Hagen:First",
       title = "Who knows nothing?",
       volume = "1",
       year = "2013", },


    <?xml version="2.0" standalone="yes" ?>
        <entry tag="Hagen:First" category="article">
            <field name="author">Hans Hagen</field>
            <field name="category">article</field>
            <field name="issn">1234-5678</field>
            <field name="issue">3</field>
            <field name="journal">MyJournal</field>
            <field name="month">8</field>
            <field name="pages">123--126</field>
            <field name="tag">Hagen:First</field>
            <field name="title">Who knows nothing?</field>
            <field name="volume">1</field>
            <field name="year">2013</field>


\usebtxdefinitions[apa] % see p.15
  • The mentioned database file formats are recognized by their extension: .bib, .bbl., .lua and .xml
  • default is the name for this database. If you load several files into the same name space, they get merged.
  • \definebtxrendering, \setupbtxrendering
\definebtxrendering[example][apa][%  setup "example" inherits from "apa"


  • default, none, cite, list: don’t sort, use original order
  • dataset, index: sort after dataset index
  • reference: sort by reference tag
  • key: sort by key (traditionally used in BibTeX as sortkey)
  • short: sort by short
  • authoryear: sort by author(s) and publication year


See manual, p.24ff.

  margin=3em % hanging list

Predefined renderings include:

  • apa (by American Psychological Assoc.)
  • mla
  • chicago
  • harvard
  • ieee,
  • aps (used in physical sciences)
  • vancouver (used in biological sciences)

Note: Only apa and aps styles are currently provided as a showcase.


Bibliography lists and citations are rendered in the language of the document (\mainlanguage). If an entry includes a language field, this can be used, depending on the rendering specification.

You can force the main language on all entries with \setupdelimitedtext[language=global].

You can define and use translated titles with language modifiers, e.g. title:de or booktitle:fr.


See p.31ff. of the manual. E.g.

\cite[num][reference] % [77]
\cite[authoryear][reference] % (Hagen 1977)
\cite[short][reference] % [HHH+77b]
and even
\cite[num][ref1,ref2,ref3] % [2,15,77] see p.35f.

The first argument defaults to the default citation rendering, as defined by \setupbtx[default:cite][alternative=num].

(work in progress)

Simple manual bibliography

If you don’t need bibliographical databases, but just references within one document, this approach might be enough for you:



\def\bibitemrule{\noindentation\vrule height0.5pt width4em depth0pt\thinspace}

\definereferenceformat [cite]  [type=title,left={},right={}]
\definereferenceformat [bibpage]   [type=page]



While we wait for the perfect book about ConTeXt\footnote{Maybe \cite[Hagen 2050]}, we can at least read a nice novel (\cite[Hagen 2014]).


\startbibitem[Hagen 2014]
Hagen, Hans: \emph{The Cow in the Ridderstraat.} Hasselt 2014.

\startbibitem[Hagen 2050]
\bibitemrule \emph{ConTeXt complete compendium.} Hasselt 2050.

\startbibitem[Hagen 2060][The Wizard 1899] % First parameter is reference, second gets displayed
\bibitemrule \emph{Optional differing reference title.} Hasselt 2060


Here’s a similar approach using \defineitemgroup.